Created
February 22, 2021 15:48
-
-
Save mhepeyiler/bea25610934af8c3da0a1dc39324c1a1 to your computer and use it in GitHub Desktop.
Move Semantics Medium Article Type Trait
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <type_traits> | |
int main() | |
{ | |
int x = 0; | |
int &rx = x; | |
int &&rri = 10; | |
std::cout << std::boolalpha; | |
std::cout << std::is_lvalue_reference_v<decltype(rx)> << '\n'; // true | |
std::cout << std::is_rvalue_reference_v<decltype(rx)> << '\n'; // false | |
std::cout << std::is_lvalue_reference_v<decltype(rri)> << '\n'; // false | |
std::cout << std::is_rvalue_reference_v<decltype(rri)> << '\n'; //true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment