From Jason Turner

[intseq.general]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpa7ih6siu/{from.md → to.md} +22 -0
tmp/tmpa7ih6siu/{from.md → to.md} RENAMED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### In general <a id="intseq.general">[[intseq.general]]</a>
2
+
3
+ The library provides a class template that can represent an integer
4
+ sequence. When used as an argument to a function template the parameter
5
+ pack defining the sequence can be deduced and used in a pack expansion.
6
+
7
+ ``` cpp
8
+ template<class F, class Tuple, std::size_t... I>
9
+ decltype(auto) apply_impl(F&& f, Tuple&& t, index_sequence<I...>) {
10
+ return std::forward<F>(f)(std::get<I>(std::forward<Tuple>(t))...);
11
+ }
12
+
13
+ template<class F, class Tuple>
14
+ decltype(auto) apply(F&& f, Tuple&& t) {
15
+ using Indices = make_index_sequence<std::tuple_size<std::decay_t<Tuple>>::value>;
16
+ return apply_impl(std::forward<F>(f), std::forward<Tuple>(t), Indices());
17
+ }
18
+ ```
19
+
20
+ The `index_sequence` alias template is provided for the common case of
21
+ an integer sequence of type `size_t`.
22
+