From Jason Turner

[intseq]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpe2wh3uxp/{from.md → to.md} +8 -18
tmp/tmpe2wh3uxp/{from.md → to.md} RENAMED
@@ -4,33 +4,21 @@
4
 
5
  The library provides a class template that can represent an integer
6
  sequence. When used as an argument to a function template the parameter
7
  pack defining the sequence can be deduced and used in a pack expansion.
8
 
9
- ``` cpp
10
- template<class F, class Tuple, std::size_t... I>
11
- decltype(auto) apply_impl(F&& f, Tuple&& t, index_sequence<I...>) {
12
- return std::forward<F>(f)(std::get<I>(std::forward<Tuple>(t))...);
13
- }
14
-
15
- template<class F, class Tuple>
16
- decltype(auto) apply(F&& f, Tuple&& t) {
17
- using Indices = make_index_sequence<std::tuple_size<std::decay_t<Tuple>>::value>;
18
- return apply_impl(std::forward<F>(f), std::forward<Tuple>(t), Indices());
19
- }
20
- ```
21
-
22
- The `index_sequence` alias template is provided for the common case of
23
- an integer sequence of type `size_t`.
24
 
25
  ### Class template `integer_sequence` <a id="intseq.intseq">[[intseq.intseq]]</a>
26
 
27
  ``` cpp
28
  namespace std {
29
  template<class T, T... I>
30
  struct integer_sequence {
31
- typedef T value_type;
32
  static constexpr size_t size() noexcept { return sizeof...(I); }
33
  };
34
  }
35
  ```
36
 
@@ -45,8 +33,10 @@ template<class T, T N>
45
 
46
  If `N` is negative the program is ill-formed. The alias template
47
  `make_integer_sequence` denotes a specialization of `integer_sequence`
48
  with `N` template non-type arguments. The type
49
  `make_integer_sequence<T, N>` denotes the type
50
- `integer_sequence<T, 0, 1, ..., N-1>`. `make_integer_sequence<int, 0>`
51
- denotes the type `integer_sequence<int>`
 
 
52
 
 
4
 
5
  The library provides a class template that can represent an integer
6
  sequence. When used as an argument to a function template the parameter
7
  pack defining the sequence can be deduced and used in a pack expansion.
8
 
9
+ [*Note 1*: The `index_sequence` alias template is provided for the
10
+ common case of an integer sequence of type `size_t`; see also
11
+ [[tuple.apply]]. — *end note*]
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
  ### Class template `integer_sequence` <a id="intseq.intseq">[[intseq.intseq]]</a>
14
 
15
  ``` cpp
16
  namespace std {
17
  template<class T, T... I>
18
  struct integer_sequence {
19
+ using value_type = T;
20
  static constexpr size_t size() noexcept { return sizeof...(I); }
21
  };
22
  }
23
  ```
24
 
 
33
 
34
  If `N` is negative the program is ill-formed. The alias template
35
  `make_integer_sequence` denotes a specialization of `integer_sequence`
36
  with `N` template non-type arguments. The type
37
  `make_integer_sequence<T, N>` denotes the type
38
+ `integer_sequence<T, 0, 1, ..., N-1>`.
39
+
40
+ [*Note 1*: `make_integer_sequence<int, 0>` denotes the type
41
+ `integer_sequence<int>` — *end note*]
42