Skip to content

Instantly share code, notes, and snippets.

@takiyu
Created June 1, 2019 03:37
Show Gist options
  • Save takiyu/470bb48c5dccfa621777de8ffa7271bb to your computer and use it in GitHub Desktop.
Save takiyu/470bb48c5dccfa621777de8ffa7271bb to your computer and use it in GitHub Desktop.
nested_initializer_list
template <typename T, std::size_t T_levels>
struct NestedInitList {
using type = std::initializer_list<
typename NestedInitList<T, T_levels - 1>::type>;
};
template <typename T>
struct NestedInitList<T, 0> {
using type = T;
};
template <typename T, std::size_t T_levels>
using NestedInitListT =
typename NestedInitList<T, T_levels>::type;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment