#include <iostream>
#include <utility>
using namespace std;

template<typename X>
struct thing {
};

template<typename T>
decltype (auto) f(T&& t) {
 if (std::is_same<typename std::remove_reference<T>::type, T>::value) {
  cout << "not ";
 }
 cout << "a reference" << endl;
 return std::forward<T>(t);
}
template<
 template<class> class T,
 typename A>
decltype (auto) g(T<A>&& t) {
 return std::forward<T<A>>(t);
}

int main(int, char**) {
 thing<int> it {};
 f(thing<int> {});
 f(it);
 // T = thing<int> &
 // T&& = thing<int>& && = thing<int>&
 g(thing<int> {});
 //g(it);
 // T = thing
 // A = int
 // T<A>&& = thing<int>&&
 return 0;
}