Created
October 19, 2017 04:56
-
-
Save utilForever/daff9e5d33e32591035eb8e9b0a9f287 to your computer and use it in GitHub Desktop.
Examples for C++17 structured bindings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <tuple> | |
int main() | |
{ | |
auto tuple = std::make_tuple(1, 'a', 2.3); | |
// unpack the tuple into individual variables declared at the call site | |
auto[i, c, d] = tuple; | |
std::cout << "i=" << i << " c=" << c << " d=" << d << '\n'; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment