Is there anything horribly wrong with creating different representations of data behind the scenes when constructing a std::vector<T>
from a std::vector<U>
?
std::vector<Color> initialScene(Settings::HRes * Settings::VRes);
std::vector<Pixel> finalScene(std::begin(initialScene), std::end(initialScene));
With the Pixel(const Color&)
constructor doing something along the lines of:
explicit Pixel(const Color& color) {
// Basically swaps blue and red channels
data[0] = color.blue;
data[1] = color.green;
data[2] = color.red;
}
Note: this is not exactly what the converting constructor does; it's more of an illustration.