From Jason Turner

[refwrap]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmphtaepc2s/{from.md → to.md} +16 -47
tmp/tmphtaepc2s/{from.md → to.md} RENAMED
@@ -3,15 +3,11 @@
3
  ``` cpp
4
  namespace std {
5
  template <class T> class reference_wrapper {
6
  public :
7
  // types
8
- typedef T type;
9
- typedef see below result_type; // not always defined
10
- typedef see below argument_type; // not always defined
11
- typedef see below first_argument_type; // not always defined
12
- typedef see below second_argument_type; // not always defined
13
 
14
  // construct/copy/destroy
15
  reference_wrapper(T&) noexcept;
16
  reference_wrapper(T&&) = delete; // do not bind to temporary objects
17
  reference_wrapper(const reference_wrapper& x) noexcept;
@@ -23,46 +19,24 @@ namespace std {
23
  operator T& () const noexcept;
24
  T& get() const noexcept;
25
 
26
  // invocation
27
  template <class... ArgTypes>
28
- result_of_t<T&(ArgTypes&&...)>
29
  operator() (ArgTypes&&...) const;
30
  };
 
 
 
31
  }
32
  ```
33
 
34
  `reference_wrapper<T>` is a `CopyConstructible` and `CopyAssignable`
35
  wrapper around a reference to an object or function of type `T`.
36
 
37
- `reference_wrapper<T>` has a weak result type ([[func.require]]). If
38
- `T` is a function type, `result_type` shall be a synonym for the return
39
- type of `T`.
40
-
41
- The template specialization `reference_wrapper<T>` shall define a nested
42
- type named `argument_type` as a synonym for `T1` only if the type `T` is
43
- any of the following:
44
-
45
- - a function type or a pointer to function type taking one argument of
46
- type `T1`
47
- - a pointer to member function `R T0::f` *cv* (where *cv* represents the
48
- member function’s cv-qualifiers); the type `T1` is *cv* `T0*`
49
- - a class type with a member type `argument_type`; the type `T1` is
50
- `T::argument_type`.
51
-
52
- The template instantiation `reference_wrapper<T>` shall define two
53
- nested types named `first_argument_type` and `second_argument_type` as
54
- synonyms for `T1` and `T2`, respectively, only if the type `T` is any of
55
- the following:
56
-
57
- - a function type or a pointer to function type taking two arguments of
58
- types `T1` and `T2`
59
- - a pointer to member function `R T0::f(T2)` *cv* (where *cv* represents
60
- the member function’s cv-qualifiers); the type `T1` is *cv* `T0*`
61
- - a class type with member types `first_argument_type` and
62
- `second_argument_type`; the type `T1` is `T::first_argument_type` and
63
- the type `T2` is `T::second_argument_type`.
64
 
65
  #### `reference_wrapper` construct/copy/destroy <a id="refwrap.const">[[refwrap.const]]</a>
66
 
67
  ``` cpp
68
  reference_wrapper(T& t) noexcept;
@@ -98,47 +72,42 @@ operator T& () const noexcept;
98
  T& get() const noexcept;
99
  ```
100
 
101
  *Returns:* The stored reference.
102
 
103
- #### reference_wrapper invocation <a id="refwrap.invoke">[[refwrap.invoke]]</a>
104
 
105
  ``` cpp
106
  template <class... ArgTypes>
107
- result_of_t<T&(ArgTypes&&... )>
108
  operator()(ArgTypes&&... args) const;
109
  ```
110
 
111
- *Returns:*
112
- *`INVOKE`*`(get(), std::forward<ArgTypes>(args)...)`. ([[func.require]])
113
 
114
- `operator()` is described for exposition only. Implementations are not
115
- required to provide an actual `reference_wrapper::operator()`.
116
- Implementations are permitted to support `reference_wrapper` function
117
- invocation through multiple overloaded operators or through other means.
118
-
119
- #### reference_wrapper helper functions <a id="refwrap.helpers">[[refwrap.helpers]]</a>
120
 
121
  ``` cpp
122
  template <class T> reference_wrapper<T> ref(T& t) noexcept;
123
  ```
124
 
125
- *Returns:* `reference_wrapper<T>(t)`
126
 
127
  ``` cpp
128
  template <class T> reference_wrapper<T> ref(reference_wrapper<T> t) noexcept;
129
  ```
130
 
131
- *Returns:* `ref(t.get())`
132
 
133
  ``` cpp
134
  template <class T> reference_wrapper<const T> cref(const T& t) noexcept;
135
  ```
136
 
137
- *Returns:* `reference_wrapper <const T>(t)`
138
 
139
  ``` cpp
140
  template <class T> reference_wrapper<const T> cref(reference_wrapper<T> t) noexcept;
141
  ```
142
 
143
- *Returns:* `cref(t.get());`
144
 
 
3
  ``` cpp
4
  namespace std {
5
  template <class T> class reference_wrapper {
6
  public :
7
  // types
8
+ using type = T;
 
 
 
 
9
 
10
  // construct/copy/destroy
11
  reference_wrapper(T&) noexcept;
12
  reference_wrapper(T&&) = delete; // do not bind to temporary objects
13
  reference_wrapper(const reference_wrapper& x) noexcept;
 
19
  operator T& () const noexcept;
20
  T& get() const noexcept;
21
 
22
  // invocation
23
  template <class... ArgTypes>
24
+ invoke_result_t<T&, ArgTypes...>
25
  operator() (ArgTypes&&...) const;
26
  };
27
+
28
+ template<class T>
29
+ reference_wrapper(reference_wrapper<T>) -> reference_wrapper<T>;
30
  }
31
  ```
32
 
33
  `reference_wrapper<T>` is a `CopyConstructible` and `CopyAssignable`
34
  wrapper around a reference to an object or function of type `T`.
35
 
36
+ `reference_wrapper<T>` shall be a trivially copyable type (
37
+ [[basic.types]]).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
 
39
  #### `reference_wrapper` construct/copy/destroy <a id="refwrap.const">[[refwrap.const]]</a>
40
 
41
  ``` cpp
42
  reference_wrapper(T& t) noexcept;
 
72
  T& get() const noexcept;
73
  ```
74
 
75
  *Returns:* The stored reference.
76
 
77
+ #### `reference_wrapper` invocation <a id="refwrap.invoke">[[refwrap.invoke]]</a>
78
 
79
  ``` cpp
80
  template <class... ArgTypes>
81
+ invoke_result_t<T&, ArgTypes...>
82
  operator()(ArgTypes&&... args) const;
83
  ```
84
 
85
+ *Returns:* *INVOKE*(get(),
86
+ std::forward\<ArgTypes\>(args)...). ([[func.require]])
87
 
88
+ #### `reference_wrapper` helper functions <a id="refwrap.helpers">[[refwrap.helpers]]</a>
 
 
 
 
 
89
 
90
  ``` cpp
91
  template <class T> reference_wrapper<T> ref(T& t) noexcept;
92
  ```
93
 
94
+ *Returns:* `reference_wrapper<T>(t)`.
95
 
96
  ``` cpp
97
  template <class T> reference_wrapper<T> ref(reference_wrapper<T> t) noexcept;
98
  ```
99
 
100
+ *Returns:* `ref(t.get())`.
101
 
102
  ``` cpp
103
  template <class T> reference_wrapper<const T> cref(const T& t) noexcept;
104
  ```
105
 
106
+ *Returns:* `reference_wrapper <const T>(t)`.
107
 
108
  ``` cpp
109
  template <class T> reference_wrapper<const T> cref(reference_wrapper<T> t) noexcept;
110
  ```
111
 
112
+ *Returns:* `cref(t.get())`.
113