mardi 27 mars 2018

Transform array of elements into an array of reference_wrappered elements

I have an array of some elements. I would like to create a function that will generate an array of reference_wrapper containing the references of the element.

Something that will have an interface like:

template<typename T, size_t N>
std::array<std::reference_wrapper<T>,N> wrap(std::array<T,N>& a);

What would be the best way to do it?

Note: I don't want to use vector.

Aucun commentaire:

Enregistrer un commentaire