Skip to content

Instantly share code, notes, and snippets.

@mhepeyiler
Created February 22, 2021 15:48
Show Gist options
  • Save mhepeyiler/bea25610934af8c3da0a1dc39324c1a1 to your computer and use it in GitHub Desktop.
Save mhepeyiler/bea25610934af8c3da0a1dc39324c1a1 to your computer and use it in GitHub Desktop.
Move Semantics Medium Article Type Trait
#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