mercredi 28 décembre 2016

How to fill an array of unique_ptr?

Is it possible to use std:fill to fill an array of unique_ptrs? The intention is to have distinct pointers to distinct objects which are initialized with the same parameters.

For example:

std::unique_ptr<int> ar[3];
std::fill(ar.begin(), ar.end(), make_unique_for_each_element_somehow<int>(1));

Aucun commentaire:

Enregistrer un commentaire