Skip to content

Instantly share code, notes, and snippets.

@utilForever
Created October 19, 2017 04:56
Show Gist options
  • Save utilForever/daff9e5d33e32591035eb8e9b0a9f287 to your computer and use it in GitHub Desktop.
Save utilForever/daff9e5d33e32591035eb8e9b0a9f287 to your computer and use it in GitHub Desktop.
Examples for C++17 structured bindings
#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