mardi 22 septembre 2015

Dynamic array using shared_ptr

I was wondering why dynamic arrays creation is possible using unique_ptr but not possible using shared_ptr?

unique_ptr<int[]> ptr1(new int[n]); /// OK!
shared_ptr<int[]> ptr2(new int[n]); /// Incorrect

Aucun commentaire:

Enregistrer un commentaire