mercredi 27 avril 2016

Converting possible lvalue reference template to lvalue

What I'm trying to achieve is something like this:

template<typename T>
void foo(T t) {
    TWithoutReferenceType t1 = Magic(t); //some magic here
}

TWithoutReference is the same type of T but without reference, so for example:

Magic(int i) -> int i
Magic(int& i) -> int i
Magic(int&& i) -> int i 

I don't know if this is possible for rvalue references or what it could mean in practice though.

Aucun commentaire:

Enregistrer un commentaire