I think you want something like:
std::vector<std::pair<int,double>> a; auto a_it = a | boost::adaptors::transformed([](const std::pair<int, double>& p){return p.second;});
Which will create a conversion iterator over the container (iteration to double) without creating a copy of the container.
ronag source share