Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
auto decltype - Return Type Decltype
//Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x64 #include <iostream> #include <windows.h> //1) auto //auto will not deduce the type of the variable if it's a lambdas, reference, constant & volatile qualifiers //2) decltype(auto) //in above case, we should decltype(auto) int main() { float a = 10; auto a1 = a; auto& a2 = a; auto a4 = a2; decltype(auto) a3 = a2; std::cout << typeid(a4).name() << std::endl; std::cout << typeid(a3).name() << std::endl; //Actual O/P should be => int& int&& x = 20; auto x1 = x; decltype(auto) x2 = x1; std::cout << typeid(x1).name() << std::endl; std::cout << typeid(x2).name() << std::endl; //Actual O/P should be => int& }
run
|
edit
|
history
|
help
0
Iterate_Variac_Template
3 sayinin toplami
constexpr internal error
#18
#22.2
why fatal error C1083
c++functor
#21
throwing an exception containing a unique_ptr is dangerous
Wrong type deduction of std::valarray expression