Title
Incomplete comment in late_check example
Status
concepts
Section
_N2960_.6.9 [stmt.late]
Submitter
Daniel Krügler

Created on 2009-04-06.00:00:00 last changed 186 months ago

Messages

Date: 2010-03-29.00:00:00

_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:00adminsetstatus: open -> concepts
2009-04-06 00:00:00admincreate