Skip to content

Instantly share code, notes, and snippets.

@y-yu
Last active December 29, 2015 09:49
Show Gist options
  • Save y-yu/7652552 to your computer and use it in GitHub Desktop.
Save y-yu/7652552 to your computer and use it in GitHub Desktop.
map example
std::array<int, 5> a = {1, 2, 3, 4, 5};
std::array<char, 5> b = {'a', 'b', 'c', 'd', 'e'};
// 前に作ったzip
auto z1 = zip<5>(a, b);
// map
auto z2 = map<5>(
[](int x, char y) -> std::tuple<int, char> {
return std::make_tuple(x, y);
},
a, b
);
// 同じになる!
z1 == z2; // true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment