Add definition of my_integer_sequence.

This commit is contained in:
Anthony Calandra
2017-04-24 21:50:58 -04:00
parent a48cfaecf9
commit b887e0eb55

View File

@@ -100,6 +100,11 @@ MyContainer c2; // OK MyContainer<float>
### Declaring non-type template parameters with auto ### Declaring non-type template parameters with auto
Following the deduction rules of `auto`, while respecting the non-type template parameter list of allowable types[\*], template arguments can be deduced from the types of its arguments: Following the deduction rules of `auto`, while respecting the non-type template parameter list of allowable types[\*], template arguments can be deduced from the types of its arguments:
```c++ ```c++
template <auto ... seq>
struct my_integer_sequence {
// Implementation here ...
};
// Explicitly pass type `int` as template argument. // Explicitly pass type `int` as template argument.
auto seq = std::integer_sequence<int, 0, 1, 2>(); auto seq = std::integer_sequence<int, 0, 1, 2>();
// Type is deduced to be `int`. // Type is deduced to be `int`.