fork download
  1. #include <set>
  2. using namespace std;
  3.  
  4. struct some_struct {
  5. int i;
  6. char c;
  7. };
  8.  
  9. int main()
  10. {
  11. int sgn=-1;
  12. set<some_struct*, bool(*)(some_struct* s1, some_struct* s2)> s_s(
  13. [sgn](some_struct* s1, some_struct* s2)->bool {return sgn*s1->i < sgn*s2->i;}
  14. );
  15. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:14:2: error: no matching function for call to ‘std::set<some_struct*, bool (*)(some_struct*, some_struct*)>::set(main()::<lambda(some_struct*, some_struct*)>)’
  );
  ^
In file included from /usr/include/c++/6/set:61:0,
                 from prog.cpp:1:
/usr/include/c++/6/bits/stl_set.h:252:9: note: candidate: template<class _InputIterator> std::set<_Key, _Compare, _Alloc>::set(_InputIterator, _InputIterator, const allocator_type&)
         set(_InputIterator __first, _InputIterator __last,
         ^~~
/usr/include/c++/6/bits/stl_set.h:252:9: note:   template argument deduction/substitution failed:
prog.cpp:14:2: note:   candidate expects 3 arguments, 1 provided
  );
  ^
In file included from /usr/include/c++/6/set:61:0,
                 from prog.cpp:1:
/usr/include/c++/6/bits/stl_set.h:246:7: note: candidate: std::set<_Key, _Compare, _Alloc>::set(std::initializer_list<_Tp>, const allocator_type&) [with _Key = some_struct*; _Compare = bool (*)(some_struct*, some_struct*); _Alloc = std::allocator<some_struct*>; std::set<_Key, _Compare, _Alloc>::allocator_type = std::allocator<some_struct*>]
       set(initializer_list<value_type> __l, const allocator_type& __a)
       ^~~
/usr/include/c++/6/bits/stl_set.h:246:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/6/bits/stl_set.h:240:7: note: candidate: std::set<_Key, _Compare, _Alloc>::set(std::set<_Key, _Compare, _Alloc>&&, const allocator_type&) [with _Key = some_struct*; _Compare = bool (*)(some_struct*, some_struct*); _Alloc = std::allocator<some_struct*>; std::set<_Key, _Compare, _Alloc>::allocator_type = std::allocator<some_struct*>]
       set(set&& __x, const allocator_type& __a)
       ^~~
/usr/include/c++/6/bits/stl_set.h:240:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/6/bits/stl_set.h:236:7: note: candidate: std::set<_Key, _Compare, _Alloc>::set(const std::set<_Key, _Compare, _Alloc>&, const allocator_type&) [with _Key = some_struct*; _Compare = bool (*)(some_struct*, some_struct*); _Alloc = std::allocator<some_struct*>; std::set<_Key, _Compare, _Alloc>::allocator_type = std::allocator<some_struct*>]
       set(const set& __x, const allocator_type& __a)
       ^~~
/usr/include/c++/6/bits/stl_set.h:236:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/6/bits/stl_set.h:232:7: note: candidate: std::set<_Key, _Compare, _Alloc>::set(const allocator_type&) [with _Key = some_struct*; _Compare = bool (*)(some_struct*, some_struct*); _Alloc = std::allocator<some_struct*>; std::set<_Key, _Compare, _Alloc>::allocator_type = std::allocator<some_struct*>]
       set(const allocator_type& __a)
       ^~~
/usr/include/c++/6/bits/stl_set.h:232:7: note:   no known conversion for argument 1 from ‘main()::<lambda(some_struct*, some_struct*)>’ to ‘const allocator_type& {aka const std::allocator<some_struct*>&}’
/usr/include/c++/6/bits/stl_set.h:224:7: note: candidate: std::set<_Key, _Compare, _Alloc>::set(std::initializer_list<_Tp>, const _Compare&, const allocator_type&) [with _Key = some_struct*; _Compare = bool (*)(some_struct*, some_struct*); _Alloc = std::allocator<some_struct*>; std::set<_Key, _Compare, _Alloc>::allocator_type = std::allocator<some_struct*>]
       set(initializer_list<value_type> __l,
       ^~~
/usr/include/c++/6/bits/stl_set.h:224:7: note:   no known conversion for argument 1 from ‘main()::<lambda(some_struct*, some_struct*)>’ to ‘std::initializer_list<some_struct*>’
/usr/include/c++/6/bits/stl_set.h:210:7: note: candidate: std::set<_Key, _Compare, _Alloc>::set(std::set<_Key, _Compare, _Alloc>&&) [with _Key = some_struct*; _Compare = bool (*)(some_struct*, some_struct*); _Alloc = std::allocator<some_struct*>]
       set(set&& __x)
       ^~~
/usr/include/c++/6/bits/stl_set.h:210:7: note:   no known conversion for argument 1 from ‘main()::<lambda(some_struct*, some_struct*)>’ to ‘std::set<some_struct*, bool (*)(some_struct*, some_struct*)>&&’
/usr/include/c++/6/bits/stl_set.h:199:7: note: candidate: std::set<_Key, _Compare, _Alloc>::set(const std::set<_Key, _Compare, _Alloc>&) [with _Key = some_struct*; _Compare = bool (*)(some_struct*, some_struct*); _Alloc = std::allocator<some_struct*>]
       set(const set& __x)
       ^~~
/usr/include/c++/6/bits/stl_set.h:199:7: note:   no known conversion for argument 1 from ‘main()::<lambda(some_struct*, some_struct*)>’ to ‘const std::set<some_struct*, bool (*)(some_struct*, some_struct*)>&’
/usr/include/c++/6/bits/stl_set.h:186:2: note: candidate: template<class _InputIterator> std::set<_Key, _Compare, _Alloc>::set(_InputIterator, _InputIterator, const _Compare&, const allocator_type&)
  set(_InputIterator __first, _InputIterator __last,
  ^~~
/usr/include/c++/6/bits/stl_set.h:186:2: note:   template argument deduction/substitution failed:
prog.cpp:14:2: note:   candidate expects 4 arguments, 1 provided
  );
  ^
In file included from /usr/include/c++/6/set:61:0,
                 from prog.cpp:1:
/usr/include/c++/6/bits/stl_set.h:169:2: note: candidate: template<class _InputIterator> std::set<_Key, _Compare, _Alloc>::set(_InputIterator, _InputIterator)
  set(_InputIterator __first, _InputIterator __last)
  ^~~
/usr/include/c++/6/bits/stl_set.h:169:2: note:   template argument deduction/substitution failed:
prog.cpp:14:2: note:   candidate expects 2 arguments, 1 provided
  );
  ^
In file included from /usr/include/c++/6/set:61:0,
                 from prog.cpp:1:
/usr/include/c++/6/bits/stl_set.h:154:7: note: candidate: std::set<_Key, _Compare, _Alloc>::set(const _Compare&, const allocator_type&) [with _Key = some_struct*; _Compare = bool (*)(some_struct*, some_struct*); _Alloc = std::allocator<some_struct*>; std::set<_Key, _Compare, _Alloc>::allocator_type = std::allocator<some_struct*>]
       set(const _Compare& __comp,
       ^~~
/usr/include/c++/6/bits/stl_set.h:154:7: note:   no known conversion for argument 1 from ‘main()::<lambda(some_struct*, some_struct*)>’ to ‘bool (* const&)(some_struct*, some_struct*)’
/usr/include/c++/6/bits/stl_set.h:142:7: note: candidate: std::set<_Key, _Compare, _Alloc>::set() [with _Key = some_struct*; _Compare = bool (*)(some_struct*, some_struct*); _Alloc = std::allocator<some_struct*>]
       set()
       ^~~
/usr/include/c++/6/bits/stl_set.h:142:7: note:   candidate expects 0 arguments, 1 provided
stdout
Standard output is empty