std::Same (3) - Linux Manuals

std::Same: std::Same

NAME

std::Same - std::Same

Synopsis


Defined in header <concepts>
template < class T, class U > (since C++20)
concept Same = /* see below */;


The concept Same<T, U> is satisfied if and only if T and U denote the same type.
std::Same<T, U> subsumes std::Same<U, T> and vice versa.

Possible implementation


  namespace detail {
      template< class T, class U >
      concept SameHelper = std::is_same_v<T, U>;
  }


  template< class T, class U >
  concept Same = detail::SameHelper<T, U> && detail::SameHelper<U, T>;

See also


is_same checks if two types are the same
        (class template)
(C++11)