What is a good clean way to convert a std::vector<int> intVec to std::vector<double> doubleVec. Or, more generally, to convert two vectors of convertible types?
std::vector<int> intVec
std::vector<double> doubleVec
Use std::vector's range constructor:
std::vector
std::vector<int> intVec; std::vector<double> doubleVec(intVec.begin(), intVec.end());
1.4m articles
1.4m replys
5 comments
57.0k users