tst_containerapisymmetry: use an algorithm

In preparation for the next changes.

Change-Id: Ibe0635dfa040842073749aa3e2ae140f27dc983a
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Giuseppe D'Angelo 2020-10-17 03:00:29 +02:00
parent b2ea30dde0
commit dc091e7443

View File

@ -608,9 +608,9 @@ template <typename Container>
Container make(int size)
{
Container c;
int i = 1;
while (size--)
c.push_back(typename Container::value_type(i++));
c.reserve(size);
using V = typename Container::value_type;
std::generate_n(std::inserter(c, c.end()), size, [i = 1]() mutable { return V(i++); });
return c;
}