| ▲ | vitus 8 months ago | |
The first code block (with the raw loop) also has an unnecessary copy in the form of `response.data = transformed_data;` -- that should be std::move(transformed_data), or else you're copying every element in the vector. That further eliminates the copies outside of the loop. At that point, you basically have created every element just once, with no moves or copies. Meanwhile, the ranges approach incurs a move followed by a copy for every element. It's not obvious to me how to eliminate those. | ||