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?
Use std::vector
's range constructor:
std::vector<int> intVec; std::vector<double> doubleVec(intVec.begin(), intVec.end());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With