Created on 2009-04-06.00:00:00 last changed 186 months ago
_N2960_.6.9 [stmt.late] paragraph 2 consists of the following example:
concept Semigroup<typename T> { T::T(const T&); T operator+(T, T); } concept_map Semigroup<int> { int operator+(int x, int y) { return x * y; } } template<Semigroup T> T add(T x, T y) { T r = x + y; // uses Semigroup<T>::operator+ late_check { r = x + y; // uses operator+ found at instantiation time (not considering Semigroup<T>::operator+) } return r; }
The second comment is correct but incomplete, because the assignment operator is also found at instantiation time. The assignment would be ill-formed outside the late_check block, because the Semigroup concept has no copy assignment operator. The comment should be extended accordingly.
History | |||
---|---|---|---|
Date | User | Action | Args |
2009-08-03 00:00:00 | admin | set | status: open -> concepts |
2009-04-06 00:00:00 | admin | create |