fork(1) download
  1. #include <set>
  2. #include <iostream>
  3.  
  4. std::ostream& operator<<(std::ostream& os, const std::set<int>& myset) {
  5. for (std::set<int>::const_iterator it = myset.begin(); it < myset.end(); ++it) {
  6. os << *it;
  7. return os;
  8. }
  9.  
  10. int main () {}
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'std::ostream& operator<<(std::ostream&, const std::set<int>&)':
prog.cpp:5:63: error: no match for 'operator<' (operand types are 'std::set<int>::const_iterator {aka std::_Rb_tree_const_iterator<int>}' and 'std::set<int>::iterator {aka std::_Rb_tree_const_iterator<int>}')
     for (std::set<int>::const_iterator it = myset.begin(); it < myset.end(); ++it) {
                                                               ^
In file included from /usr/include/c++/5/bits/ios_base.h:46:0,
                 from /usr/include/c++/5/ios:42,
                 from /usr/include/c++/5/ostream:38,
                 from /usr/include/c++/5/iostream:39,
                 from prog.cpp:2:
/usr/include/c++/5/system_error:274:3: note: candidate: bool std::operator<(const std::error_condition&, const std::error_condition&)
   operator<(const error_condition& __lhs,
   ^
/usr/include/c++/5/system_error:274:3: note:   no known conversion for argument 1 from 'std::set<int>::const_iterator {aka std::_Rb_tree_const_iterator<int>}' to 'const std::error_condition&'
/usr/include/c++/5/system_error:200:3: note: candidate: bool std::operator<(const std::error_code&, const std::error_code&)
   operator<(const error_code& __lhs, const error_code& __rhs) noexcept
   ^
/usr/include/c++/5/system_error:200:3: note:   no known conversion for argument 1 from 'std::set<int>::const_iterator {aka std::_Rb_tree_const_iterator<int>}' to 'const std::error_code&'
In file included from /usr/include/c++/5/string:52:0,
                 from /usr/include/c++/5/bits/locale_classes.h:40,
                 from /usr/include/c++/5/bits/ios_base.h:41,
                 from /usr/include/c++/5/ios:42,
                 from /usr/include/c++/5/ostream:38,
                 from /usr/include/c++/5/iostream:39,
                 from prog.cpp:2:
/usr/include/c++/5/bits/basic_string.h:5009:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const std::basic_string<_CharT, _Traits, _Alloc>&)
     operator<(const _CharT* __lhs,
     ^
/usr/include/c++/5/bits/basic_string.h:5009:5: note:   template argument deduction/substitution failed:
prog.cpp:5:75: note:   mismatched types 'const _CharT*' and 'std::_Rb_tree_const_iterator<int>'
     for (std::set<int>::const_iterator it = myset.begin(); it < myset.end(); ++it) {
                                                                           ^
In file included from /usr/include/c++/5/string:52:0,
                 from /usr/include/c++/5/bits/locale_classes.h:40,
                 from /usr/include/c++/5/bits/ios_base.h:41,
                 from /usr/include/c++/5/ios:42,
                 from /usr/include/c++/5/ostream:38,
                 from /usr/include/c++/5/iostream:39,
                 from prog.cpp:2:
/usr/include/c++/5/bits/basic_string.h:4997:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const std::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*)
     operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
     ^
/usr/include/c++/5/bits/basic_string.h:4997:5: note:   template argument deduction/substitution failed:
prog.cpp:5:75: note:   'std::set<int>::const_iterator {aka std::_Rb_tree_const_iterator<int>}' is not derived from 'const std::basic_string<_CharT, _Traits, _Alloc>'
     for (std::set<int>::const_iterator it = myset.begin(); it < myset.end(); ++it) {
                                                                           ^
In file included from /usr/include/c++/5/string:52:0,
                 from /usr/include/c++/5/bits/locale_classes.h:40,
                 from /usr/include/c++/5/bits/ios_base.h:41,
                 from /usr/include/c++/5/ios:42,
                 from /usr/include/c++/5/ostream:38,
                 from /usr/include/c++/5/iostream:39,
                 from prog.cpp:2:
/usr/include/c++/5/bits/basic_string.h:4985:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const std::basic_string<_CharT, _Traits, _Alloc>&, const std::basic_string<_CharT, _Traits, _Alloc>&)
     operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
     ^
/usr/include/c++/5/bits/basic_string.h:4985:5: note:   template argument deduction/substitution failed:
prog.cpp:5:75: note:   'std::set<int>::const_iterator {aka std::_Rb_tree_const_iterator<int>}' is not derived from 'const std::basic_string<_CharT, _Traits, _Alloc>'
     for (std::set<int>::const_iterator it = myset.begin(); it < myset.end(); ++it) {
                                                                           ^
In file included from /usr/include/c++/5/set:62:0,
                 from prog.cpp:1:
/usr/include/c++/5/bits/stl_multiset.h:840:5: note: candidate: template<class _Key, class _Compare, class _Alloc> bool std::operator<(const std::multiset<_Key, _Compare, _Alloc>&, const std::multiset<_Key, _Compare, _Alloc>&)
     operator<(const multiset<_Key, _Compare, _Alloc>& __x,
     ^
/usr/include/c++/5/bits/stl_multiset.h:840:5: note:   template argument deduction/substitution failed:
prog.cpp:5:75: note:   'std::set<int>::const_iterator {aka std::_Rb_tree_const_iterator<int>}' is not derived from 'const std::multiset<_Key, _Compare, _Alloc>'
     for (std::set<int>::const_iterator it = myset.begin(); it < myset.end(); ++it) {
                                                                           ^
In file included from /usr/include/c++/5/set:61:0,
                 from prog.cpp:1:
/usr/include/c++/5/bits/stl_set.h:857:5: note: candidate: template<class _Key, class _Compare, class _Alloc> bool std::operator<(const std::set<_Key, _Compare, _Alloc>&, const std::set<_Key, _Compare, _Alloc>&)
     operator<(const set<_Key, _Compare, _Alloc>& __x,
     ^
/usr/include/c++/5/bits/stl_set.h:857:5: note:   template argument deduction/substitution failed:
prog.cpp:5:75: note:   'std::set<int>::const_iterator {aka std::_Rb_tree_const_iterator<int>}' is not derived from 'const std::set<_Key, _Compare, _Alloc>'
     for (std::set<int>::const_iterator it = myset.begin(); it < myset.end(); ++it) {
                                                                           ^
In file included from /usr/include/c++/5/set:60:0,
                 from prog.cpp:1:
/usr/include/c++/5/bits/stl_tree.h:1283:5: note: candidate: template<class _Key, class _Val, class _KeyOfValue, class _Compare, class _Alloc> bool std::operator<(const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&, const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&)
     operator<(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
     ^
/usr/include/c++/5/bits/stl_tree.h:1283:5: note:   template argument deduction/substitution failed:
prog.cpp:5:75: note:   'std::set<int>::const_iterator {aka std::_Rb_tree_const_iterator<int>}' is not derived from 'const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>'
     for (std::set<int>::const_iterator it = myset.begin(); it < myset.end(); ++it) {
                                                                           ^
In file included from /usr/include/c++/5/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/5/bits/stl_tree.h:63,
                 from /usr/include/c++/5/set:60,
                 from prog.cpp:1:
/usr/include/c++/5/bits/stl_iterator.h:1095:5: note: candidate: template<class _Iterator> bool std::operator<(const std::move_iterator<_Iterator>&, const std::move_iterator<_Iterator>&)
     operator<(const move_iterator<_Iterator>& __x,
     ^
/usr/include/c++/5/bits/stl_iterator.h:1095:5: note:   template argument deduction/substitution failed:
prog.cpp:5:75: note:   'std::set<int>::const_iterator {aka std::_Rb_tree_const_iterator<int>}' is not derived from 'const std::move_iterator<_Iterator>'
     for (std::set<int>::const_iterator it = myset.begin(); it < myset.end(); ++it) {
                                                                           ^
In file included from /usr/include/c++/5/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/5/bits/stl_tree.h:63,
                 from /usr/include/c++/5/set:60,
                 from prog.cpp:1:
/usr/include/c++/5/bits/stl_iterator.h:1089:5: note: candidate: template<class _IteratorL, class _IteratorR> bool std::operator<(const std::move_iterator<_Iterator>&, const std::move_iterator<_IteratorR>&)
     operator<(const move_iterator<_IteratorL>& __x,
     ^
/usr/include/c++/5/bits/stl_iterator.h:1089:5: note:   template argument deduction/substitution failed:
prog.cpp:5:75: note:   'std::set<int>::const_iterator {aka std::_Rb_tree_const_iterator<int>}' is not derived from 'const std::move_iterator<_Iterator>'
     for (std::set<int>::const_iterator it = myset.begin(); it < myset.end(); ++it) {
                                                                           ^
In file included from /usr/include/c++/5/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/5/bits/stl_tree.h:63,
                 from /usr/include/c++/5/set:60,
                 from prog.cpp:1:
/usr/include/c++/5/bits/stl_iterator.h:348:5: note: candidate: template<class _IteratorL, class _IteratorR> bool std::operator<(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)
     operator<(const reverse_iterator<_IteratorL>& __x,
     ^
/usr/include/c++/5/bits/stl_iterator.h:348:5: note:   template argument deduction/substitution failed:
prog.cpp:5:75: note:   'std::set<int>::const_iterator {aka std::_Rb_tree_const_iterator<int>}' is not derived from 'const std::reverse_iterator<_Iterator>'
     for (std::set<int>::const_iterator it = myset.begin(); it < myset.end(); ++it) {
                                                                           ^
In file included from /usr/include/c++/5/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/5/bits/stl_tree.h:63,
                 from /usr/include/c++/5/set:60,
                 from prog.cpp:1:
/usr/include/c++/5/bits/stl_iterator.h:298:5: note: candidate: template<class _Iterator> bool std::operator<(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)
     operator<(const reverse_iterator<_Iterator>& __x,
     ^
/usr/include/c++/5/bits/stl_iterator.h:298:5: note:   template argument deduction/substitution failed:
prog.cpp:5:75: note:   'std::set<int>::const_iterator {aka std::_Rb_tree_const_iterator<int>}' is not derived from 'const std::reverse_iterator<_Iterator>'
     for (std::set<int>::const_iterator it = myset.begin(); it < myset.end(); ++it) {
                                                                           ^
In file included from /usr/include/c++/5/bits/stl_algobase.h:64:0,
                 from /usr/include/c++/5/bits/stl_tree.h:63,
                 from /usr/include/c++/5/set:60,
                 from prog.cpp:1:
/usr/include/c++/5/bits/stl_pair.h:220:5: note: candidate: template<class _T1, class _T2> constexpr bool std::operator<(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)
     operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
     ^
/usr/include/c++/5/bits/stl_pair.h:220:5: note:   template argument deduction/substitution failed:
prog.cpp:5:75: note:   'std::set<int>::const_iterator {aka std::_Rb_tree_const_iterator<int>}' is not derived from 'const std::pair<_T1, _T2>'
     for (std::set<int>::const_iterator it = myset.begin(); it < myset.end(); ++it) {
                                                                           ^
prog.cpp:10:13: error: a function-definition is not allowed here before '{' token
 int main () {}
             ^
prog.cpp:10:14: error: expected '}' at end of input
 int main () {}
              ^
stdout
Standard output is empty