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
c++functor
CStringA
This is the first one
Regex pipe and tabs c++
dhar1
Template
hgh
For NULL-embedded strings, CStringT::Find() produces what you may not expect
post_decrement_example
rvalue lifetime