mercredi 3 mai 2017

Is there a use case for std::unique_ptr

I came across something like:

using arr_t=std::array<std::array<std::array<int,1000>,1000>,1000>;
std::unique_ptr<arr_t> u_ptr;

The unique pointer was used, obviously, to overcome stackoverflow problem. Is there any case to use the previous code rather than just using std::vector ? Is there a real use case for std::unique_ptr<std::array<T,N>> ?

Aucun commentaire:

Enregistrer un commentaire