GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
libstdc++

Use type_identity_t for operator<=> parameter [PR114400]

This commit updates the `operator<=>` parameter type in `std::string_view` to use `type_identity_t`.

This commit modifies the parameter type of the operator<=> in std::string_view to use type_identity_t instead of __type_identity_t. This change aligns with a similar update to operator== and fully addresses LWG3950, which concerns the specification of std::basic_string_view comparison operators.

In Details

This commit changes the parameter type of operator<=> in std::string_view to use type_identity_t instead of __type_identity_t. This resolves LWG3950 and matches a prior change to operator==. The difference between __type_identity and type_identity is observable, ensuring exact resolution.

For Context

This commit pertains to the std::string_view class in the C++ standard library, which provides a non-owning reference to a string. The operator<=> is the three-way comparison operator (introduced in C++20) that returns a result indicating whether one value is less than, equal to, or greater than another. Using type_identity_t ensures consistent type handling in comparisons.

Filed Under: libstdc++string_viewcpp20