mardi 16 mars 2021

What does the following error mean C2100 illegal indirection

I am coming from java and new in C++ I was wondering why the following code gives an error

  Error C2100 illegal indirection   

template<typename T>
auto assigns(T object) {
    decltype(*object) newObject;
    return *object;
}

I read the documentation and saw that decltype makes the type of newObject with the same type of object so I don't know what I did wrong.

Aucun commentaire:

Enregistrer un commentaire