This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of NAD Concepts status.

1149. Reformulating NonemptyRange axiom

Section: 99 [rand.concept.urng] Status: NAD Concepts Submitter: Walter Brown Opened: 2009-06-25 Last modified: 2016-01-28

Priority: Not Prioritized

View all issues with NAD Concepts status.

Discussion:

In 99 [rand.concept.urng], we have the following:

concept UniformRandomNumberGenerator<typename G> : Callable<G> {
  ...
  axiom NonemptyRange(G& g) {
    G::min() < G::max();
  }
  ...
}

Since the parameter G is in scope throughout the concept, there is no need for the axiom to be further parameterized, and so the axiom can be slightly simplified as:

axiom NonemptyRange()  {
  G::min() < G::max();
}

We can further reformulate so as to avoid any axiom machinery as:

requires True< G::min() < G::max() >;

This is not only a simpler statement of the same requirement, but also forces the requirement to be checked.

[ Post-Rapperswil: ]

Moved to Tentatively Ready after 5 positive votes on c++std-lib.

Proposed resolution:

In 99 [rand.concept.urng], replace the NonemptyRange axiom by:

axiom NonemptyRange(G& g) { 
   G::min() < G::max(); 
}
requires True< G::min() < G::max() >;