If we have the following:
template <class T>
struct B{
T data;
}
struct A{
int data_array[100];
}
int main()
{
A x;
const A x_const;
auto y1 = f(A());
auto y2 = f(x);
auto y3 = f(x_const);
auto y4 = f(std::move(x));
}
I want to know f(preferably a function, but the macro is fine too) to:
decltype(y1) == B<A>
decltype(y2) == B<A&>
decltype(y3) == B<const A&>
decltype(y4) == B<A&&>
That is, it fperfectly transfers xto the object B.
source
share