Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <annex/data/variant/variant.hpp>
- template<int I>
- struct dummy {
- operator int() const { return -1; }
- };
- template<int N>
- int expand()
- {
- return []<std::size_t... Indices>(std::index_sequence<Indices...>) -> auto
- {
- using annex::variant;
- variant<dummy<Indices>..., int> v = 7;
- variant<dummy<Indices>..., int> w = 8;
- variant<dummy<Indices>..., int> z = 5;
- auto compute = [](auto i, auto j, auto k) { return (i + j) * k; };
- return apply(compute, v, w, z);
- }(std::make_index_sequence<N> {});
- }
- int main()
- {
- return expand<40>();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement