I try to define a class A
as follows:
template< typename T >
class A
{
public:
A( T elem )
: _elem( elem )
{}
private:
TYPE _elem; // "TYPE" should be either "T" in case "elem" is an r-value or "T&" in case "elem" is an l-value.
};
Here, I want _elem
to have either the type T
in case that the constructor's argument elem
is an r-value or the type T&
in case elem
is an l-value.
Does anyone know how this can be implemented?