I have a vector of digits, for example {3, 6, 0, 1, 8} I need to covert it to an integer using every digit of a vector consistently. So the number i'll get is 36018.
Possible solution:
std::vector<int> values = {1, 3, 4, 5};
int res = 0, s = values.size();
for(int num : values) res += num * pow(10, --s);
I want to know if there is some more "elegant", or short maybe, way to do this using stl algorithms.