Nui
tuple_for_each.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <tuple>
4 #include <type_traits>
5 
6 namespace Nui
7 {
8  namespace Detail
9  {
10  template <typename T, typename FuncT, int... Is>
11  void tupleForEachImpl(T&& t, FuncT&& func, std::integer_sequence<int, Is...>)
12  {
13  (..., func(std::get<Is>(t)));
14  };
15  }
16 
17  template <typename FuncT, typename... Types>
18  void tupleForEach(std::tuple<Types...>& t, FuncT&& func)
19  {
20  Detail::tupleForEachImpl(t, std::forward<FuncT>(func), std::make_integer_sequence<int, sizeof...(Types)>());
21  }
22 
23  template <typename FuncT, typename... Types>
24  void tupleForEach(std::tuple<Types...> const& t, FuncT&& func)
25  {
26  Detail::tupleForEachImpl(t, std::forward<FuncT>(func), std::make_integer_sequence<int, sizeof...(Types)>());
27  }
28 }
void tupleForEachImpl(T &&t, FuncT &&func, std::integer_sequence< int, Is... >)
Definition: tuple_for_each.hpp:11
Definition: file_dialog.hpp:6
void tupleForEach(std::tuple< Types... > &t, FuncT &&func)
Definition: tuple_for_each.hpp:18