Skip to content

Instantly share code, notes, and snippets.

@minamiyama1994
Created November 25, 2013 08:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save minamiyama1994/c79a5f72a323e6614bf8 to your computer and use it in GitHub Desktop.
Save minamiyama1994/c79a5f72a323e6614bf8 to your computer and use it in GitHub Desktop.
template<int N, typename... T>
auto zip(const std::array<T, N>&... containers) -> std::array < std::tuple < T ... > , N >
{
std::array < std::tuple < T ... > , N > res ;
for ( std::size_t i = 0 ; i != N ; ++ i )
{
res [ i ] = std::make_tuple ( containers [ i ] ... ) ;
}
return res ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment