Skip to content

Instantly share code, notes, and snippets.

@gene9
Forked from qbit86/type-inference.cpp
Created December 15, 2016 20:44
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 gene9/ce9b06036a07d33e90700cce04557682 to your computer and use it in GitHub Desktop.
Save gene9/ce9b06036a07d33e90700cce04557682 to your computer and use it in GitHub Desktop.
Type Inference in C++11
int original = 42;
decltype(original) copy = original;
decltype((original)) reference = original;
original = 1729;
std::cout << copy << std::endl; // 42
std::cout << reference << std::endl; // 1729
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment