New paper: N3749, Constexpr Library Additions: functional -- Marshall Clow

A new WG21 paper is available. A copy is linked below, and the paper will also appear in the next normal WG21 mailing. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.

Document number: N3749

Date: 2013-08-31

Constexpr Library Additions: functional

by Marshall Clow

Excerpt:

I propose that we make the following change:

template <class T = void> struct less {
  typedef T first_argument_type;
  typedef T second_argument_type;
  typedef bool result_type;

  constexpr bool operator()(const T& x, const T& y) const { return x < y; }

  };

This will allow people to use less<T>{}(x,y) at compile time.

This should also apply to all the relational operators (less, greater, less_equal, greater_equal, not_equal_to, equal_to), the arithmetic operators (plus, minus, multiplies, divides, modulus, negates), the bit manipulations (bit_and, bit_or, bit_xor, bit_not) and the negators (unary_negate, binary_negate, no1, not2).

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.