Здравствуйте, jazzer, Вы писали:
J>Здравствуйте, b.armaley, Вы писали:
J>std::greater<int> — это тип, а тебе надо объект, т.е. std::greater<int>(), поэтому
BA>>BA>>std::set<int, std::greater<int>> m3(m1.cbegin(), m1.cend(), std::greater<int>());
J>
я пробовал
std::set<int> m3(m1.cbegin(), m1.cend(), std::greater<int>() );
$ c++ -std=c++11 test.cpp && ./a.out
ошибка: нет подходящей функции для вызова «std::set<int>::set(std::set<int>::iterator, std::set<int>::iterator, std::greater<int>)»
замечание: candidates are:
In file included from /usr/include/c++/4.7/set:61:0,
from less4_5-1.cpp:2:
/usr/include/c++/4.7/bits/stl_set.h:219:7: замечание: std::set<_Key, _Compare, _Alloc>::set(std::initializer_list<_CharT>, const _Compare&, const allocator_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::set<_Key, _Compare, _Alloc>::allocator_type = std::allocator<int>]
...
BA>>P.S. другие конструкторы нормально отработали:
BA>>BA>>std::set<int> m3(std::greater<int>);
BA>>
J>Это — объявление функции.
согласен, просто промахнулся при наборе поста