Top "Decltype" questions

decltype is a C++11 keyword that can be used to find the type of an expression.

What are some uses of decltype(auto)?

In c++14 the decltype(auto) idiom is introduced. Typically its use is to allow auto declarations to use the decltype …

c++ auto c++14 decltype return-type-deduction
arrow operator (->) in function heading

I came across the following code: template <typename T, typename T1> auto compose(T a, T1 b) -&…

c++ c++11 auto decltype
What is decltype and how is it used?

I haven't been able to find a good explanation of decltype. Please tell me, as a beginning programmer, what it …

c++ c++11 decltype
Difference between std::result_of and decltype

I have some trouble understanding the need for std::result_of in C++0x. If I understood correctly, result_of …

c++ c++11 decltype result-of
Can C++11 decltype be used to create a typedef for function pointer from an existing function?

Given struct A { int foo(double a, std::string& b) const; }; I can create a member function pointer like …

c++ c++11 decltype
How to get element type from STL container instance?

I know about value_type, key_type... but they operate on types, not on instances. I tried stuff like : std::…

c++ stl c++11 decltype
Get return type of member function without an object

I have a number of classes that I cannot modify. Each has a copy constructor, at least one other constructor, …

c++ templates c++11 decltype
How can I determine the return type of a C++11 member function

I am trying to determine the return type of a various C++ member functions. I understand that decltype and std::…

c++ c++11 decltype
C++11 lambda in decltype

For the following code: auto F(int count) -> decltype([](int m) { return 0; }) { return [](int m) { return 0; }; } g++ 4.5 gives …

c++ lambda c++11 decltype
Using decltype to get an expression's type, without the const

Consider the following program: int main () { const int e = 10; for (decltype(e) i{0}; i < e; ++i) { // do something } } This …

c++ c++11 decltype