mercredi 28 juin 2017

CMap Lookup() std::unique_ptr hits attempting to reference a deleted function

I have below code

class ObjectA
{

}

Class ADeleter
{
//used to delete ObjectA
}

using AUniquePtr = std::unique_ptr<ObjectA, ADelter>;

using myMap = CMap<CString, CString, AUniquePtr, AUniquePtr>;

myMap mapA;

mapA.insert(pairA);
mapA.insert(pairB);
mapA.insert(pairC);
mapA.insert(pairD);

AUniquePtr ptr;
CString stringA = "xxxx";
mapA.Lookup(stringA, ptr);

I hit error - attempting to reference a deleted function. I know unique_ptr can not be copied, but I do not know how to fix it. Please help.

Aucun commentaire:

Enregistrer un commentaire