#include <iostream>
#include <string>
#include <list>
using namespace std;
int main() {
std::list<std::string> list ("the", "the", "friend", "hello", "the");
list.sort();
for( auto const& str : list )
{
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8bGlzdD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCkgewoJc3RkOjpsaXN0PHN0ZDo6c3RyaW5nPiBsaXN0ICgidGhlIiwgInRoZSIsICJmcmllbmQiLCAiaGVsbG8iLCAidGhlIik7CglsaXN0LnNvcnQoKTsKCWZvciggYXV0byBjb25zdCYgc3RyIDogbGlzdCApCgl7CgkJCgl9CglyZXR1cm4gMDsKfQ==
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