#include <iostream>
#include <boost/type_index.hpp>
struct x{};
int main()
{
x&& t = x();
std::cout << "\nnaked types";
std::cout << "\n l: " << std::is_lvalue_reference<x&>::value;
std::cout << "\nlr: " << std::is_lvalue_reference<x&&>::value;
std::cout << "\n r: " << std::is_rvalue_reference<x&>::value;
std::cout << "\nrr: " << std::is_rvalue_reference<x&&>::value;
std::cout << "\nlref, decltype";
std::cout << "\n t: " << std::is_lvalue_reference<decltype(t)>::value;
std::cout << "\n 1: " << std::is_lvalue_reference<decltype(x())>::value;
std::cout << "\n m: " << std::is_lvalue_reference<decltype(std::move(t))>::value;
std::cout << "\nrref, decltype";
std::cout << "\n t: " << std::is_rvalue_reference<decltype(t)>::value;
std::cout << "\n 1: " << std::is_rvalue_reference<decltype(x())>::value;
std::cout << "\n m: " << std::is_rvalue_reference<decltype(std::move(t))>::value;
std::cout << "\nlref, decltype(())";
std::cout << "\n t: " << std::is_lvalue_reference<decltype((t))>::value;
std::cout << "\n 1: " << std::is_lvalue_reference<decltype((x()))>::value;
std::cout << "\n m: " << std::is_lvalue_reference<decltype((std::move(t)))>::value;
std::cout << "\nrref, decltype(())";
std::cout << "\n t: " << std::is_rvalue_reference<decltype((t))>::value;
std::cout << "\n 1: " << std::is_rvalue_reference<decltype((x()))>::value;
std::cout << "\n m: " << std::is_rvalue_reference<decltype((std::move(t)))>::value;
std::cout << "\nexpr is lvalue";
std::cout << "\n t: " << std::is_same<decltype((t)), x&>::value;
std::cout << "\n 1: " << std::is_same<decltype((x())), x&>::value;
std::cout << "\n m: " << std::is_same<decltype((std::move(t))), x&>::value;
std::cout << "\nexpr is xvalue";
std::cout << "\n t: " << std::is_same<decltype((t)), x&&>::value;
std::cout << "\n 1: " << std::is_same<decltype((x())), x&&>::value;
std::cout << "\n m: " << std::is_same<decltype((std::move(t))), x&&>::value;
std::cout << "\nexpr is neither";
std::cout << "\n t: " << std::is_same<decltype((t)), x>::value;
std::cout << "\n 1: " << std::is_same<decltype((x())), x>::value;
std::cout << "\n m: " << std::is_same<decltype((std::move(t))), x>::value;
}