I am trying to get the address of all the elements in this collection and copy them to std :: set. In principle, instead of
std::set<T> s1;
std::copy(first1, last1, std::inserter(s1, s1.begin()));
I would like to insert their addresses. Sort of:
std::set<std::add_pointer<T>> s1;
std::copy(reference_iterator(first1), reference_iterator(last1),
std::inserter(s1, s1.begin()));
Here, reference_iterator will be an iterator that returns the address of its element, not the element, something opposite to what boost_iterator boost does. Is there a standard way to do this? Many thanks.
Lecoc source
share