fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <list>
  4. using namespace std;
  5.  
  6. int main() {
  7. std::list<std::string> list ("the", "the", "friend", "hello", "the");
  8. list.sort();
  9. for( auto const& str : list )
  10. {
  11.  
  12. }
  13. return 0;
  14. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:7:69: error: no matching function for call to ‘std::__cxx11::list<std::__cxx11::basic_string<char> >::list(const char [4], const char [4], const char [7], const char [6], const char [4])’
  std::list<std::string> list ("the", "the", "friend", "hello", "the");
                                                                     ^
In file included from /usr/include/c++/6/list:63:0,
                 from prog.cpp:3:
/usr/include/c++/6/bits/stl_list.h:705:9: note: candidate: template<class _InputIterator, class> std::__cxx11::list<_Tp, _Alloc>::list(_InputIterator, _InputIterator, const allocator_type&)
         list(_InputIterator __first, _InputIterator __last,
         ^~~~
/usr/include/c++/6/bits/stl_list.h:705:9: note:   template argument deduction/substitution failed:
prog.cpp:7:69: note:   candidate expects 3 arguments, 5 provided
  std::list<std::string> list ("the", "the", "friend", "hello", "the");
                                                                     ^
In file included from /usr/include/c++/6/list:63:0,
                 from prog.cpp:3:
/usr/include/c++/6/bits/stl_list.h:681:7: note: candidate: std::__cxx11::list<_Tp, _Alloc>::list(std::__cxx11::list<_Tp, _Alloc>&&, const allocator_type&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; std::__cxx11::list<_Tp, _Alloc>::allocator_type = std::allocator<std::__cxx11::basic_string<char> >]
       list(list&& __x, const allocator_type& __a)
       ^~~~
/usr/include/c++/6/bits/stl_list.h:681:7: note:   candidate expects 2 arguments, 5 provided
/usr/include/c++/6/bits/stl_list.h:677:7: note: candidate: std::__cxx11::list<_Tp, _Alloc>::list(const std::__cxx11::list<_Tp, _Alloc>&, const allocator_type&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; std::__cxx11::list<_Tp, _Alloc>::allocator_type = std::allocator<std::__cxx11::basic_string<char> >]
       list(const list& __x, const allocator_type& __a)
       ^~~~
/usr/include/c++/6/bits/stl_list.h:677:7: note:   candidate expects 2 arguments, 5 provided
/usr/include/c++/6/bits/stl_list.h:672:7: note: candidate: std::__cxx11::list<_Tp, _Alloc>::list(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; std::__cxx11::list<_Tp, _Alloc>::allocator_type = std::allocator<std::__cxx11::basic_string<char> >]
       list(initializer_list<value_type> __l,
       ^~~~
/usr/include/c++/6/bits/stl_list.h:672:7: note:   candidate expects 2 arguments, 5 provided
/usr/include/c++/6/bits/stl_list.h:661:7: note: candidate: std::__cxx11::list<_Tp, _Alloc>::list(std::__cxx11::list<_Tp, _Alloc>&&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >]
       list(list&& __x) noexcept
       ^~~~
/usr/include/c++/6/bits/stl_list.h:661:7: note:   candidate expects 1 argument, 5 provided
/usr/include/c++/6/bits/stl_list.h:648:7: note: candidate: std::__cxx11::list<_Tp, _Alloc>::list(const std::__cxx11::list<_Tp, _Alloc>&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >]
       list(const list& __x)
       ^~~~
/usr/include/c++/6/bits/stl_list.h:648:7: note:   candidate expects 1 argument, 5 provided
/usr/include/c++/6/bits/stl_list.h:621:7: note: candidate: std::__cxx11::list<_Tp, _Alloc>::list(std::__cxx11::list<_Tp, _Alloc>::size_type, const value_type&, const allocator_type&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; std::__cxx11::list<_Tp, _Alloc>::size_type = long unsigned int; std::__cxx11::list<_Tp, _Alloc>::value_type = std::__cxx11::basic_string<char>; std::__cxx11::list<_Tp, _Alloc>::allocator_type = std::allocator<std::__cxx11::basic_string<char> >]
       list(size_type __n, const value_type& __value,
       ^~~~
/usr/include/c++/6/bits/stl_list.h:621:7: note:   candidate expects 3 arguments, 5 provided
/usr/include/c++/6/bits/stl_list.h:609:7: note: candidate: std::__cxx11::list<_Tp, _Alloc>::list(std::__cxx11::list<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; std::__cxx11::list<_Tp, _Alloc>::size_type = long unsigned int; std::__cxx11::list<_Tp, _Alloc>::allocator_type = std::allocator<std::__cxx11::basic_string<char> >]
       list(size_type __n, const allocator_type& __a = allocator_type())
       ^~~~
/usr/include/c++/6/bits/stl_list.h:609:7: note:   candidate expects 2 arguments, 5 provided
/usr/include/c++/6/bits/stl_list.h:596:7: note: candidate: std::__cxx11::list<_Tp, _Alloc>::list(const allocator_type&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; std::__cxx11::list<_Tp, _Alloc>::allocator_type = std::allocator<std::__cxx11::basic_string<char> >]
       list(const allocator_type& __a) _GLIBCXX_NOEXCEPT
       ^~~~
/usr/include/c++/6/bits/stl_list.h:596:7: note:   candidate expects 1 argument, 5 provided
/usr/include/c++/6/bits/stl_list.h:585:7: note: candidate: std::__cxx11::list<_Tp, _Alloc>::list() [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >]
       list()
       ^~~~
/usr/include/c++/6/bits/stl_list.h:585:7: note:   candidate expects 0 arguments, 5 provided
stdout

Standard output is empty