From Jason Turner

[func.wrap.ref.class]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpara_611s/{from.md → to.md} +58 -0
tmp/tmpara_611s/{from.md → to.md} RENAMED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ##### Class template `function_ref` <a id="func.wrap.ref.class">[[func.wrap.ref.class]]</a>
2
+
3
+ ``` cpp
4
+ namespace std {
5
+ template<class R, class... ArgTypes>
6
+ class function_ref<R(ArgTypes...) cv noexcept(noex)> {
7
+ public:
8
+ // [func.wrap.ref.ctor], constructors and assignment operators
9
+ template<class F> function_ref(F*) noexcept;
10
+ template<class F> constexpr function_ref(F&&) noexcept;
11
+ template<auto f> constexpr function_ref(nontype_t<f>) noexcept;
12
+ template<auto f, class U> constexpr function_ref(nontype_t<f>, U&&) noexcept;
13
+ template<auto f, class T> constexpr function_ref(nontype_t<f>, cv T*) noexcept;
14
+
15
+ constexpr function_ref(const function_ref&) noexcept = default;
16
+ constexpr function_ref& operator=(const function_ref&) noexcept = default;
17
+ template<class T> function_ref& operator=(T) = delete;
18
+
19
+ // [func.wrap.ref.inv], invocation
20
+ R operator()(ArgTypes...) const noexcept(noex);
21
+
22
+ private:
23
+ template<class... T>
24
+ static constexpr bool is-invocable-using = see belownc; // exposition only
25
+
26
+ R (*thunk-ptr)(BoundEntityType, ArgTypes&&...) noexcept(noex); // exposition only
27
+ BoundEntityType bound-entity; // exposition only
28
+ };
29
+
30
+ // [func.wrap.ref.deduct], deduction guides
31
+ template<class F>
32
+ function_ref(F*) -> function_ref<F>;
33
+ template<auto f>
34
+ function_ref(nontype_t<f>) -> function_ref<see below>;
35
+ template<auto f, class T>
36
+ function_ref(nontype_t<f>, T&&) -> function_ref<see below>;
37
+ }
38
+ ```
39
+
40
+ An object of class `function_ref<R(Args...) cv noexcept(noex)>` stores a
41
+ pointer to function *`thunk-ptr`* and an object *`bound-entity`*. The
42
+ object *`bound-entity`* has an unspecified trivially copyable type
43
+ *`BoundEntityType`*, that models `copyable` and is capable of storing a
44
+ pointer to object value or a pointer to function value. The type of
45
+ *`thunk-ptr`* is `R(*)(BoundEntityType, Args&&...) noexcept(noex)`.
46
+
47
+ Each specialization of `function_ref` is a trivially copyable type
48
+ [[term.trivially.copyable.type]] that models `copyable`.
49
+
50
+ Within subclause  [[func.wrap.ref]], `call-args` is an argument pack
51
+ with elements such that
52
+
53
+ ``` cpp
54
+ decltype((call-args))...
55
+ ```
56
+
57
+ denote `ArgTypes&&...` respectively.
58
+