std::semiregular

From cppreference.com
< cpp‎ | concepts
Defined in header <concepts>
template <class T>
concept semiregular = std::copyable<T> && std::default_initializable<T>;
(since C++20)

The semiregular concept specifies that a type is both copyable and default constructible. It is satisfied by types that behave similarly to built-in types like int, except that they need not support comparison with ==.

Example

#include <concepts>
#include <iostream>
 
template<std::semiregular T>
struct Single {
    T value;
};
 
int main()
{
    Single<int> myInt1{4};
    Single<int> myInt2;
    myInt2 = myInt1;
//  myInt2 == myInt1; // error: no match for 'operator=='
 
    std::cout << myInt1.value << ' ' << myInt2.value << '\n';
}

Output:

4 4

See also

(C++20)
specifies that a type is regular, that is, it is both semiregular and equality_comparable
(concept)