lundi 25 mai 2015

Custom deleter specifications for std::unique_ptr

I am reading Josuttis` C++ standard library. I could not find the reasoning for the (2) and (3) comments on following example:

D d;  //instance of the deleter type(1)
unique_ptr<int,D> p1(new int, D()); //D must be  MoveConstructible(2)
unique_ptr<int,D> p2(new int, d);  //D must be CopyConstructible(3)

What are the reasons for comment (2) and (3) in this context?

What are the specifications for custom deleter for std::unique_ptr?

Aucun commentaire:

Enregistrer un commentaire