Код: Выделить всё
#include
#include
#include
#include
#include
struct Values
{
uint32_t a = 0;
uint32_t b = 0;
Values(uint32_t x, uint32_t y): a(x), b(y) {}
};
template
auto foo(MapType&& map)
{
std::vector v;
v.reserve(map.size());
std::transform(map.begin(), map.end(), std::back_inserter(v), [](const auto& kv) -> decltype(auto) { return std::move(kv); });
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79382582/how-to-move-elements-from-stdmap-to-stdvector[/url]
Мобильная версия