83 lines
3.6 KiB
Markdown
83 lines
3.6 KiB
Markdown
[exec.queryable]
|
||
|
||
# 33 Execution control library [[exec]](./#exec)
|
||
|
||
## 33.2 Queries and queryables [exec.queryable]
|
||
|
||
### [33.2.1](#general) General [[exec.queryable.general]](exec.queryable.general)
|
||
|
||
[1](#general-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L115)
|
||
|
||
A [*queryable object*](#def:object,queryable "33.2.1 General [exec.queryable.general]") is
|
||
a read-only collection of key/value pair
|
||
where each key is a customization point object known as a [*query object*](#def:query_object "33.2.1 General [exec.queryable.general]")[.](#general-1.sentence-1)
|
||
|
||
A [*query*](#def:query "33.2.1 General [exec.queryable.general]") is an invocation of a query object
|
||
with a queryable object as its first argument and
|
||
a (possibly empty) set of additional arguments[.](#general-1.sentence-2)
|
||
|
||
A query imposes syntactic and semantic requirements on its invocations[.](#general-1.sentence-3)
|
||
|
||
[2](#general-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L124)
|
||
|
||
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&[.](#general-2.sentence-1)
|
||
|
||
The expression q(env, args...) is equal to ([[concepts.equality]](concepts.equality "18.2 Equality preservation"))
|
||
the expression q(cenv, args...)[.](#general-2.sentence-2)
|
||
|
||
[3](#general-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L134)
|
||
|
||
The type of a query expression cannot be void[.](#general-3.sentence-1)
|
||
|
||
[4](#general-4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L137)
|
||
|
||
The expression q(env, args...) is
|
||
equality-preserving ([[concepts.equality]](concepts.equality "18.2 Equality preservation")) and
|
||
does not modify the query object or the arguments[.](#general-4.sentence-1)
|
||
|
||
[5](#general-5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L142)
|
||
|
||
If the expression env.query(q, args...) is well-formed,
|
||
then it is expression-equivalent to q(env, args...)[.](#general-5.sentence-1)
|
||
|
||
[6](#general-6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L146)
|
||
|
||
Unless otherwise specified,
|
||
the result of a query is valid as long as the queryable object is valid[.](#general-6.sentence-1)
|
||
|
||
### [33.2.2](#concept) queryable concept [[exec.queryable.concept]](exec.queryable.concept)
|
||
|
||
namespace std {template<class T>concept [*queryable*](#concept:queryable "33.2.2 queryable concept [exec.queryable.concept]") = [destructible](concept.destructible#concept:destructible "18.4.10 Concept destructible [concept.destructible]")<T>; // *exposition only*}
|
||
|
||
[1](#concept-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L159)
|
||
|
||
The exposition-only [*queryable*](#concept:queryable "33.2.2 queryable concept [exec.queryable.concept]") concept specifies
|
||
the constraints on the types of queryable objects[.](#concept-1.sentence-1)
|
||
|
||
[2](#concept-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L163)
|
||
|
||
Let env be an object of type Env[.](#concept-2.sentence-1)
|
||
|
||
The type Env models [*queryable*](#concept:queryable "33.2.2 queryable concept [exec.queryable.concept]") 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[.](#concept-2.sentence-2)
|