Skip to content

Instantly share code, notes, and snippets.

@JohanMabille
Created January 7, 2020 10:05
Show Gist options
  • Save JohanMabille/b9b4d345fa5edec0b030a0346666399f to your computer and use it in GitHub Desktop.
Save JohanMabille/b9b4d345fa5edec0b030a0346666399f to your computer and use it in GitHub Desktop.
template <class T, std::size_t I>
struct nested_initializer_list
{
using nested_type =
typename nested_initializer_list<T, I - 1>::type;
using type = std::initializer_list<nested_type>;
};
template <class T>
struct nested_initializer_list<T, 0>
{
using type = T;
};
template <class T, std::size_t I>
using nested_initializer_list_t =
typename nested_initializer_list<T, I>::type;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment