I’ve got problem with decltype which doesnt work for vector.
Vector Eq
is the same type as holder
and itemGrabbed
.
item* itemGrabbed;
item* holder;
std::vector<std::vector<item*>> Eq;
Everything is initialized etc.
Eq stores pointers to “inherited” objects – for example objects from class itemAxe
Every item class and inherited objects have the same constructor with this argument -> grapicsData.
this->itemGrabbed = new std::remove_pointer<decltype(Eq[x][y]) > ::type{graphicsData};
this->itemGrabbed = new std::remove_pointer<decltype(holder) > ::type{graphicsData};
I guess I could just go with something like this
item* temp=Eq[x][y];
this->itemGrabbed = new std::remove_pointer<decltype(temp) > ::type{graphicsData};
but I was wondering if it is possible to do it without temp.
The problem is that 2nd option works but I need to use 1st one
All that because I need diferent assign and copy operators.
How can I achive this?
Mateusz Biernat is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.