From Jason Turner

[tuple.apply]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpj2pf3d29/{from.md → to.md} +10 -9
tmp/tmpj2pf3d29/{from.md → to.md} RENAMED
@@ -1,27 +1,27 @@
1
- #### Calling a function with a `tuple` of arguments <a id="tuple.apply">[[tuple.apply]]</a>
2
 
3
  ``` cpp
4
  template<class F, class Tuple>
5
  constexpr decltype(auto) apply(F&& f, Tuple&& t);
6
  ```
7
 
8
  *Effects:* Given the exposition-only function:
9
 
10
  ``` cpp
11
  template<class F, class Tuple, size_t... I>
12
- constexpr decltype(auto)
13
- apply_impl(F&& f, Tuple&& t, index_sequence<I...>) { // exposition only
14
- return INVOKE(std::forward<F>(f), std::get<I>(std::forward<Tuple>(t))...);
15
  }
16
  ```
17
 
18
  Equivalent to:
19
 
20
  ``` cpp
21
- return apply_impl(std::forward<F>(f), std::forward<Tuple>(t),
22
- make_index_sequence<tuple_size_v<decay_t<Tuple>>>{});
23
  ```
24
 
25
  ``` cpp
26
  template<class T, class Tuple>
27
  constexpr T make_from_tuple(Tuple&& t);
@@ -29,20 +29,21 @@ template <class T, class Tuple>
29
 
30
  *Effects:* Given the exposition-only function:
31
 
32
  ``` cpp
33
  template<class T, class Tuple, size_t... I>
34
- constexpr T make_from_tuple_impl(Tuple&& t, index_sequence<I...>) { // exposition only
35
  return T(get<I>(std::forward<Tuple>(t))...);
36
  }
37
  ```
38
 
39
  Equivalent to:
40
 
41
  ``` cpp
42
- return make_from_tuple_impl<T>(forward<Tuple>(t),
43
- make_index_sequence<tuple_size_v<decay_t<Tuple>>>{});
 
44
  ```
45
 
46
  [*Note 1*: The type of `T` must be supplied as an explicit template
47
  parameter, as it cannot be deduced from the argument
48
  list. — *end note*]
 
1
+ ### Calling a function with a `tuple` of arguments <a id="tuple.apply">[[tuple.apply]]</a>
2
 
3
  ``` cpp
4
  template<class F, class Tuple>
5
  constexpr decltype(auto) apply(F&& f, Tuple&& t);
6
  ```
7
 
8
  *Effects:* Given the exposition-only function:
9
 
10
  ``` cpp
11
  template<class F, class Tuple, size_t... I>
12
+ constexpr decltype(auto) apply-impl(F&& f, Tuple&& t, index_sequence<I...>) {
13
+ // exposition only
14
+ return INVOKE(std::forward<F>(f), std::get<I>(std::forward<Tuple>(t))...); // see [func.require]
15
  }
16
  ```
17
 
18
  Equivalent to:
19
 
20
  ``` cpp
21
+ return apply-impl(std::forward<F>(f), std::forward<Tuple>(t),
22
+ make_index_sequence<tuple_size_v<remove_reference_t<Tuple>>>{});
23
  ```
24
 
25
  ``` cpp
26
  template<class T, class Tuple>
27
  constexpr T make_from_tuple(Tuple&& t);
 
29
 
30
  *Effects:* Given the exposition-only function:
31
 
32
  ``` cpp
33
  template<class T, class Tuple, size_t... I>
34
+ constexpr T make-from-tuple-impl(Tuple&& t, index_sequence<I...>) { // exposition only
35
  return T(get<I>(std::forward<Tuple>(t))...);
36
  }
37
  ```
38
 
39
  Equivalent to:
40
 
41
  ``` cpp
42
+ return make-from-tuple-impl<T>(
43
+ forward<Tuple>(t),
44
+ make_index_sequence<tuple_size_v<remove_reference_t<Tuple>>>{});
45
  ```
46
 
47
  [*Note 1*: The type of `T` must be supplied as an explicit template
48
  parameter, as it cannot be deduced from the argument
49
  list. — *end note*]