Every major platform and compiler now supports some aspect of the new C++ standard accepted in 2011. This means it is currently possible to write code that uses some of C++11 while maintaining cross-platform compatibility.
Why should you care?
decltype is a type specifier introduced in C++11. It behaves like a function that evaluates to the type of an object at compile time. This article is helping provide some more background information necessary for the more meatier C++11 articles to come.
decltype(4.23 * 5) v = 4.23*5;
In this example, the compiler is determining for us what the type of 4.23 * 5 would be and then giving that type to v.
With some help from typeid we can see that the type assigned by the compiler is double.
Recent comments
1 week 3 days ago
2 weeks 1 day ago
2 weeks 5 days ago
2 weeks 5 days ago
2 weeks 6 days ago
3 weeks 4 days ago
3 weeks 4 days ago
4 weeks 4 days ago
11 weeks 6 days ago
16 weeks 6 hours ago