Files
cppdraft_translate/cppdraft/exec/queryable.md
2025-10-25 03:02:53 +03:00

3.6 KiB

[exec.queryable]

33 Execution control library [exec]

33.2 Queries and queryables [exec.queryable]

33.2.1 General [exec.queryable.general]

1

#

A queryable object is a read-only collection of key/value pair where each key is a customization point object known as a query object.

A query is an invocation of a query object with a queryable object as its first argument and a (possibly empty) set of additional arguments.

A query imposes syntactic and semantic requirements on its invocations.

2

#

Let q be a query object, let args be a (possibly empty) pack of subexpressions, let env be a subexpression that refers to a queryable object o of type O, and let cenv be a subexpression referring to o such that decltype((cenv)) is const O&.

The expression q(env, args...) is equal to ([concepts.equality]) the expression q(cenv, args...).

3

#

The type of a query expression cannot be void.

4

#

The expression q(env, args...) is equality-preserving ([concepts.equality]) and does not modify the query object or the arguments.

5

#

If the expression env.query(q, args...) is well-formed, then it is expression-equivalent to q(env, args...).

6

#

Unless otherwise specified, the result of a query is valid as long as the queryable object is valid.

33.2.2 queryable concept [exec.queryable.concept]

namespace std {templateconcept queryable = destructible; // exposition only}

1

#

The exposition-only queryable concept specifies the constraints on the types of queryable objects.

2

#

Let env be an object of type Env.

The type Env models queryable if for each callable object q and a pack of subexpressions args, if requires { q(env, args...) } is true thenq(env, args...) meets any semantic requirements imposed by q.