DWARF Debugging Standard Wiki |
---|
For detail description of the feature, please refer to:
http://en.wikipedia.org/wiki/C%2B%2B0x#Type_inference
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2194.pdf
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2337.pdf
The definition of a variable with an explicit initialization can use the
auto
keyword. This creates a variable of the specific type of the
initializer.
auto x = 7; // x has type int
template<class T> void printall(const vector<T>& v)
{
for (auto p = v.begin(); // p has type vector<T>::const_iterator
p!=v.end();
++p)
cout << *p << "\n";
}
decltype
can be used to compile-time determine the type of an
expression.
const std::vector<int> v(1);
decltype(v[0]) b; // b has type const int&, the return type of
// std::vector<int>::operator[](size_type)
none.
auto
and decltype
are resolved to an actual type during compile
time. DWARF type entries describes the actual type of the object.
dwarfstd.org is supported by Sourceware. Contributions are welcome.
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest © 2007-2022 by DWARF Standards Committee. |