std::array, unlike vector, stores its objects on the stack. The code bellow is my attempt to push std::array and in particular (this is what is important)...push the items that std::array manages on to the heap.
class X{
private:
array<Y,10> data;
}
auto upA = make_unique<X>();
Are the array elements of std::array in my example on the heap? Is there a more elegant way to push std::array to heap?
Aucun commentaire:
Enregistrer un commentaire