[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_]