| 1 |
The following concepts specify just one template type parameter. Their generic |
| 2 |
form is |
| 3 |
verb( template <typename Type> |
| 4 |
concept Name = |
| 5 |
... requirements ... |
| 6 |
;) |
| 7 |
When used in compound requirements only their names have to be |
| 8 |
specified. For example (using the concept tt(std::boolean) (see below)), to |
| 9 |
require that a function tt(fun) receiving an argument of some type tt(Type) |
| 10 |
returns a boolean value, the following concept could be defined: |
| 11 |
verb(template<typename Type> |
| 12 |
concept BoolFun = |
| 13 |
requires(Type param) |
| 14 |
{ |
| 15 |
{ fun(param) } -> std::boolean; |
| 16 |
};) |
| 17 |
|
| 18 |
itemization( |
| 19 |
ittq(boolean)(requires that its type can be used in boolean expressions) |
| 20 |
|
| 21 |
ittq(copy_constructible)(requires that objects of its type supports copy- and |
| 22 |
move-construction;) |
| 23 |
|
| 24 |
ittq(copyable)(requires that objects of its type support copy- and move- |
| 25 |
construction and assignment, and that two objects of its type can be |
| 26 |
swapped;) |
| 27 |
|
| 28 |
ittq(default_initializable)(requires that objects of its type support default |
| 29 |
constructors;) |
| 30 |
|
| 31 |
ittq(destructible)(requires that the destructor of its type is defined as |
| 32 |
tt(noexcept(true));) |
| 33 |
|
| 34 |
ittq(equality_comparable)(requires that tt(operator==) is available to compare |
| 35 |
two objects of its type;) |
| 36 |
|
| 37 |
ittq(floating_point)(requires that its type is a floating-point type;) |
| 38 |
|
| 39 |
ittq(integral)(requires that its type is an integral type;) |
| 40 |
|
| 41 |
ittq(movable)(requires that its type supports moving and swapping. Note that |
| 42 |
full support for moving requires that its type supports move construction |
| 43 |
and move assignment;) |
| 44 |
|
| 45 |
ittq(move_constructible)(requires that its type supports move construction;) |
| 46 |
|
| 47 |
ittq(regular)(requires that its type satisfies the requirements of the |
| 48 |
tt(semiregular) and tt(equality_comparable) concepts;) |
| 49 |
|
| 50 |
ittq(semiregular)(requires that its type supports default construction, |
| 51 |
copying, moving, and swapping;) |
| 52 |
|
| 53 |
ittq(signed_integral)(requires that its type is a signed integral type;) |
| 54 |
|
| 55 |
ittq(swappable)(requires that two objects of the same type can be swapped. The |
| 56 |
generic variant (see below) is named tt(swappable_with);) |
| 57 |
|
| 58 |
ittq(unsigned_integral)(requires that its type is an unsigned integral type;) |
| 59 |
|
| 60 |
ittq(totally_ordered)(requires that two objects of identical |
| 61 |
types can be ordered using the operators tt(==, !=, <, <=, >,) and |
| 62 |
tt(>=). The requirements for ordering is hi(ordering: strict)em(strict): |
| 63 |
for any two objects tt(one) and tt(two) either tt(one < two, one == two,) |
| 64 |
or tt(one > two) is true. The generic variant is named |
| 65 |
tt(totally_ordered_with).) |
| 66 |
) |