Код: Выделить всё
#include
#include
auto GetSet()
{
const auto cmp = [](auto n1, auto n2) { return n1 < n2; };
std::set mySet(cmp); // compiler error, see below
mySet.insert(13);
mySet.insert(31);
return mySet;
}
int main()
{
auto mySet = GetSet();
for (auto i : mySet)
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/63878001/return-a-stdset-with-a-custom-comparator[/url]
Мобильная версия