[concepts.callable] (original) (raw)

18 Concepts library [concepts]

18.7.2 Concept invocable [concept.invocable]

The invocable concept specifies a relationship between a callable type ([func.def]) F and a set of argument types Args... which can be evaluated by the library function invoke ([func.invoke]).

template<class F, class... Args> concept [invocable](#concept:invocable "18.7.2 Concept invocable [concept.invocable]") = requires(F&& f, Args&&... args) { invoke(std::forward<F>(f), std::forward<Args>(args)...); // not required to be equality-preserving };

[Example 1:

A function that generates random numbers can model invocable, since the invoke function call expression is not required to be equality-preserving ([concepts.equality]).

— _end example_]

18.7.3 Concept regular_­invocable [concept.regularinvocable]

template<class F, class... Args> concept [regular_­invocable](#concept:regular%5Finvocable "18.7.3 Concept regular_­invocable [concept.regularinvocable]") = [invocable](#concept:invocable "18.7.2 Concept invocable [concept.invocable]")<F, Args...>;

The invoke function call expression shall be equality-preserving ([concepts.equality]) and shall not modify the function object or the arguments.

[Note 1:

This requirement supersedes the annotation in the definition ofinvocable.

— _end note_]

[Example 1:

A random number generator does not model regular_­invocable.

— _end example_]

[Note 2:

The distinction between invocable and regular_­invocableis purely semantic.

— _end note_]

18.7.5 Concept relation [concept.relation]

template<class R, class T, class U> concept [relation](#concept:relation "18.7.5 Concept relation [concept.relation]") = [predicate](#concept:predicate "18.7.4 Concept predicate [concept.predicate]")<R, T, T> && [predicate](#concept:predicate "18.7.4 Concept predicate [concept.predicate]")<R, U, U> && [predicate](#concept:predicate "18.7.4 Concept predicate [concept.predicate]")<R, T, U> && [predicate](#concept:predicate "18.7.4 Concept predicate [concept.predicate]")<R, U, T>;

18.7.6 Concept equivalence_­relation [concept.equiv]

template<class R, class T, class U> concept [equivalence_­relation](#concept:equivalence%5Frelation "18.7.6 Concept equivalence_­relation [concept.equiv]") = [relation](#concept:relation "18.7.5 Concept relation [concept.relation]")<R, T, U>;

A relation models equivalence_­relation only if it imposes an equivalence relation on its arguments.

18.7.7 Concept strict_­weak_­order [concept.strictweakorder]

template<class R, class T, class U> concept [strict_­weak_­order](#concept:strict%5Fweak%5Forder "18.7.7 Concept strict_­weak_­order [concept.strictweakorder]") = [relation](#concept:relation "18.7.5 Concept relation [concept.relation]")<R, T, U>;

A relation models strict_­weak_­order only if it imposes a strict weak ordering on its arguments.

The termstrictrefers to the requirement of an irreflexive relation (!comp(x, x) for all x), and the termweakto requirements that are not as strong as those for a total ordering, but stronger than those for a partial ordering.

If we defineequiv(a, b)as!comp(a, b) && !comp(b, a), then the requirements are thatcompandequivboth be transitive relations:

[Note 1:

Under these conditions, it can be shown that

— _end note_]