| Home | Libraries | People | FAQ | More

## Predefined Concepts

In the following tables, `T` and `U` are the types that the operation applies to, `R` is the result type. `T` always defaults to `_self` to match the default behavior of any. These concepts assume normal semantics. Thus, comparison operators always return bool, and references will be added to the arguments and results as appropriate.

Except as otherwise noted, primitive concepts defined by the library can be specialized to provide concept maps. `copy_constructible`, and the iterator concepts cannot be specialized because they are composites. `constructible`, `destructible`, `typeid_`, and `same_type` cannot be specialized because they require special handling in the library.

Table 39.1. Special Members

concept | notes
--- | ---
`constructible``<Sig>` | -
`copy_constructible``<T>` | -
`destructible``<T>` | -
`assignable``<T, U = const T&>` | -
`typeid_``<T>` | -

Table 39.2. Unary Operators

operator | concept | notes
--- | --- | ---
`operator++` | `incrementable``<T>` | There is no separate post-increment
`operator--` | `decrementable``<T>` | There is no separate post-decrement
`operator*` | `dereferenceable``<R, T>` | `R` should usually be a reference
`operator~` | `complementable``<T, R = T>` | -
`operator-` | `negatable``<T, R = T>` | -

Table 39.3. Binary Operators

operator | concept | notes
--- | --- | ---
`operator+` | `addable``<T, U = T, R = T>` | -
`operator-` | `subtractable``<T, U = T, R = T>` | -
`operator*` | `multipliable``<T, U = T, R = T>` | -
`operator/` | `dividable``<T, U = T, R = T>` | -
`operator%` | `modable``<T, U = T, R = T>` | -
`operator&` | `bitandable``<T, U = T, R = T>` | -
`operator|` | `bitorable``<T, U = T, R = T>` | -
`operator^` | `bitxorable``<T, U = T, R = T>` | -
`operator<<` | `left_shiftable``<T, U = T, R = T>` | -
`operator>>` | `right_shiftable``<T, U = T, R = T>` | -
`operator==` and `!=` | `equality_comparable``<T, U = T>` | `!=` is implemented in terms of `==`
`operator<`, `>`, `<=`, and `>=` | `less_than_comparable``<T, U = T>` | All are implemented in terms of `<`
`operator+=` | `add_assignable``<T, U = T>` | -
`operator-=` | `subtract_assignable``<T, U = T>` | -
`operator*=` | `multiply_assignable``<T, U = T>` | -
`operator/=` | `divide_assignable``<T, U = T>` | -
`operator%=` | `mod_assignable``<T, U = T>` | -
`operator&=` | `bitand_assignable``<T, U = T>` | -
`operator|=` | `bitor_assignable``<T, U = T>` | -
`operator^=` | `bitxor_assignable``<T, U = T>` | -
`operator<<=` | `left_shift_assignable``<T, U = T>` | -
`operator>>=` | `right_shift_assignable``<T, U = T>` | -
`operator<<` | `ostreamable``<Os = std::ostream, T = _self>` | -
`operator>>` | `istreamable``<Is = std::istream, T = _self>` | -

Table 39.4. Miscellaneous Operators

operator | concept | notes
--- | --- | ---
`operator()` | `callable``<Sig, T>` | `Sig` should be a function type. T may be const qualified.
`operator[]` | `subscriptable``<R, T, N = std::ptrdiff_t>` | `R` should usually be a reference. `T` can be optionally const qualified.

Table 39.5. Iterator Concepts

concept | notes
--- | ---
`iterator``<Traversal, T, Reference, Difference>` | Use `same_type` to control the iterator's value type.
`forward_iterator``<T, Reference, Difference>` | -
`bidirectional_iterator``<T, Reference, Difference>` | -
`random_access_iterator``<T, Reference, Difference>` | -

Table 39.6. Special Concepts

concept | notes
--- | ---
`same_type``<T>` | Indicates that two types are the same.