Concepts in the header <concepts>
Concept EqualityComparableauto concept EqualityComparable<typename T, typename U = T> {
bool operator==(T a, U b);
} Concept EqualityComparable requires that two values be comparable with operator== .
When T and U are identical, operator== is an equivalence relation, that is, it satisfied the following properties:
- For all
a , a == a .
- If
a == b , then b == a .
- If
a == b and b == c , then a == c .
Concept LessThanComparableauto concept LessThanComparable<typename T, typename U = T> {
bool operator<(T, U);
}; Concept LessThanComparable requires the ability to order values via operator< .
operator< is a strict weak ordering relation.
Concept CopyConstructibleauto concept CopyConstructible<typename T> {
T::T(T const&);
T::~T();
}; Concept CopyConstructible requires the ability to create and destroy copies of an object.
Note that, unlike the copy construction requirements in the C++98 Standard Library, this definition of CopyConstructible does not contain requirements for the address-of operator& . These requirements are unrelated to copy construction, and their inclusion would prevent references from meeting the CopyConstructible requirements.
Concept Swappableauto concept Swappable<typename T> {
void swap(T& t, T& u);
}; Concept Swappable requires that two values t and u can be swapped, after which t has the value originally held by u and u has the value originally held by t .
Concept DefaultConstructibleauto concept DefaultConstructible<typename T> {
T::T();
}; Concept DefaultConstructible requires the existence of an accessible default constructor.
Concept Assignableauto concept Assignable<typename T, typename U = T> {
typename result_type;
result_type T::operator=(U const&);
}; Concept Assignable requires the existence of a suitable
assignment operator.
Concept Convertibleauto concept Convertible<typename T, typename U> {
operator U(const T&);
};
Â
template<typename T> concept_map Convertible {};
template<typename T> concept_map Convertible {};
template<typename T> concept_map Convertibleconst T&> {}; Concept Convertible requires an implicit conversion from one type to another.
Concept SameTypeconcept SameType<typename T, typename U> { /* unspecified */ };
template<typename T> concept_map SameType { /* unspecified */ }; Concept SameType requires that its two type parameters have precisely the same type. Note that compiler support is required to
correctly implement the type-checking semantics of the
SameType concept.
Concept Trueconcept True<bool> { };
concept_map True<true> { }; Concept True requires that its argument (a bool value that must be an integral constant expression) be true.
Concept Dereferenceableauto concept Dereferenceable<typename T> {
typename reference;
reference operator*(T);
}; Concept Dereferenceable requires the existence of a dereference operator *.
Concept Integralconcept Integral<typename T>
: DefaultConstructible, CopyConstructible,
LessThanComparable, EqualityComparable {
T::T(long long);
Â
T& operator++(T&);
T operator++(T&, int);
T& operator--(T&);
T operator--(T&, int);
T operator+(T);
T operator+(T, T);
T& operator+=(T&, T);
T operator-(T, T);
T& operator-=(T&, T);
T operator*(T, T);
T& operator*=(T&, T);
T operator/(T, T);
T& operator/=(T&, T);
T operator%(T, T);
T& operator%=(T&, T);
Â
T operator&(T, T);
T& operator&=(T&, T);
T operator|(T, T);
T& operator|=(T&, T);
T operator^(T, T);
T& operator^=(T&, T);
Â
T operator<<(T, T);
T& operator<<=(T&, T);
T operator>>(T, T);
T& operator>>=(T&, T);
Â
bool operator>(T, T);
bool operator<=(T, T);
bool operator>=(T, T);
bool operator!=(T, T);
Â
requires Assignable, SameType<Assignable::result_type, T&>;
} Concept Integral requires all of the operations available on
built-in integral types.
Concept SignedIntegralconcept SignedIntegral<typename T> : Integral {
T operator-(T);
};
Â
concept_map SignedIntegral<signed char> { };
concept_map SignedIntegral<short> { };
concept_map SignedIntegral<int> { };
concept_map SignedIntegral<long> { };
concept_map SignedIntegral<long long> { }; Concept SignedIntegral requires all of the operations of
built-in signed integral types. All of the built-in signed integral types are models of ths concept.
Concept UnsignedIntegralconcept UnsignedIntegral<typename T> : Integral { };
Â
concept_map UnsignedIntegral<unsigned char> { };
concept_map UnsignedIntegral<unsigned short> { };
concept_map UnsignedIntegral<unsigned int> { };
concept_map UnsignedIntegral<unsigned long> { };
concept_map UnsignedIntegral<unsigned long long> { }; Concept UnsignedIntegral requires all of the operations of built-in unsigned integral types. Every built-in unsigned integral type is a model of this concept.
Concept Addableauto concept Addable<typename T, typename U = T> {
typename result_type;
result_type operator+(T, U);
}; The Addable concept requires that two values can be added with the + operator.
Concept Multiplicableauto concept Multiplicable<typename T, typename U = T> {
typename result_type;
result_type operator*(T, U);
}; The Multiplicable concept requires that two values can be multiplied with the * operator.
Concept CallableNauto concept CallableN<typename F, typename T1, typename T2, ..., typename TN> {
typename result_type;
result_type operator()(F&, T1, T2, ..., TN);
}; The Callable family of concepts--Callable0,
Callable1, ..., CallableM requires that the given
parameter F be callable given arguments of types T1,
T2, ..., TN.
Concept Predicateauto concept Predicate<typename F, typename T1> : Callable1 {
requires Convertiblebool>;
}; The Predicate concept requires that a function object be
callable with a single argument, the result of which can be used in a
context that requires a bool. Predicate function objects shall not apply any non-constant function
through the predicate arguments.
Concept BinaryPredicateauto concept BinaryPredicate<typename F, typename T1, typename T2> : Callable2 {
requires Convertiblebool>;
}; The BinaryPredicate concept requires that a function object be
callable with two arguments, the result of which can be used in a
context that requires a bool.
Predicate function objects shall not apply any non-constant function
through the predicate arguments.
|