mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-12 21:05:51 +00:00

In many places, std::copy was used with back_inserters, or other std::inserters. These have in most cases been replaced by using the ranged insert member function of each stl container. Firstly, this makes more readable code. Also, this is often more efficient because, if the compiler can find the distance between the source iterators, it only has to make one block allocation and then fill it with values. In other cases, containers were being default constructed and then std::copy'd into with some form of inserter. These were cleaned up by using the iterator range constructor instead. Use of std::copy was especially egregious in the case of associative containers such as map and set. Sometimes back_inserter was being used, other times std::inserter set at front, but it doesn't matter because there is no front or back when inserting, and it's much cleaner to just use set or map::insert(iterator begin, iterator end).