Last active
November 27, 2017 07:41
-
-
Save swkwon/5c8c1eda768dadae37418a2f1211cc63 to your computer and use it in GitHub Desktop.
decltype type deduction
This file contains 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
// ---------------------------------- | |
// example 1 | |
const int i = 0; // decltype(i) is const int | |
bool f(const Widget& w); // decltype(w) is const Widget& | |
// decltype(f) is bool(const Widget&) | |
struct Point { | |
int x, y; // decltype(Point::x) is int | |
} // decltype(Point::y) is int | |
Widget w; // decltype(w) is Widget | |
std::vector<int> v; // decltype(v) is std::vector<int> | |
// decltype(v[0]) is int& |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment