jeudi 3 mars 2016

unique_ptr and pointer by reference argument type

I have code where I am trying to pass the underlying pointer of a unique_ptr in to a method accepting a pointer by reference:

unique_ptr<A> a;

func(a.get());

to call:

void func(A*& a){   // I am modifying what `a` points to in here

}

but I am getting compiler errors because get() is not returning what I expected was just the raw pointer. Is it possible to achieve what I am trying to do here?

Aucun commentaire:

Enregistrer un commentaire