Skip to content

Instantly share code, notes, and snippets.

@fabiogaluppo
Created January 25, 2016 18:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabiogaluppo/c717c5a0189f577cdb1c to your computer and use it in GitHub Desktop.
Save fabiogaluppo/c717c5a0189f577cdb1c to your computer and use it in GitHub Desktop.
decltype(z) u = 4; //int
decltype(w) t = u; //int&
std::cout << u << " " << t << "\n"; //4 4
t = 16;
std::cout << u << " " << t << "\n"; //16 16
decltype(e + e) a1 = e + e; //decltype with expression
std::cout << a1 << "\n"; //5.43656
decltype(make_square_pair(10)) a2 = make_square_pair(10);
std::cout << get_y(a2) << " -> "<< typeid(a2).name() << "\n"; //100 -> struct f_pair<int>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment