Trigger custom implicit conversion on "copy" Is there anything horribly wrong with creating different representations of data behind the scenes when constructing a std::vector&lt;T&gt; from a std::vector&lt;U&gt;?

std::vector&lt;Color&gt; initialScene(Settings::HRes * Settings::VRes);

std::vector&lt;Pixel&gt; finalScene(std::begin(initialScene), std::end(initialScene));


With the Pixel(const Color&amp;) constructor doing something along the lines of:

explicit Pixel(const Color&amp; 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.
No problem with that at all, since it's not the copy which is doing the conversion (which would be strange) but the constructor.  Since the vector templates you've mentioned are clearly of different types, the operation you describe would not at all be unexpected.  It's little different from using std::copy to read from a file into an STL container, which is a common idiom.