Message
| Another impressive thing about STL is the error messages it can generate. For example, if you take the above working example, and compile it under gcc, after changing a single character, you get the following error message:
test.cpp: In instantiation of `std::unary_negate<ci_less>':
test.cpp:77: instantiated from here
test.cpp:77: no type named `argument_type' in `struct ci_less'
/usr/include/c++/3.2.2/bits/stl_function.h:278: no type named `argument_type'
in `struct ci_less'
/usr/include/c++/3.2.2/bits/stl_algo.h: In function `void
std::partial_sort(_RandomAccessIter, _RandomAccessIter, _RandomAccessIter,
_Compare) [with _RandomAccessIter =
__gnu_cxx::__normal_iterator<std::string*, std::vector<std::string,
std::allocator<std::string> > >, _Compare = std::unary_negate<ci_less>]':
/usr/include/c++/3.2.2/bits/stl_algo.h:2138: instantiated from `void std::__introsort_loop(_RandomAccessIter, _RandomAccessIter, _Size, _Compare) [with _RandomAccessIter = __gnu_cxx::__normal_iterator<std::string*, std::vector<std::string, std::allocator<std::string> > >, _Size = int, _Compare = std::unary_negate<ci_less>]'
/usr/include/c++/3.2.2/bits/stl_algo.h:2209: instantiated from `void std::sort(_RandomAccessIter, _RandomAccessIter, _Compare) [with _RandomAccessIter = __gnu_cxx::__normal_iterator<std::string*, std::vector<std::string, std::allocator<std::string> > >, _Compare = std::unary_negate<ci_less>]'
test.cpp:77: instantiated from here
/usr/include/c++/3.2.2/bits/stl_algo.h:2557: no match for call to `(
std::unary_negate<ci_less>) (std::basic_string<char, std::char_traits<char>,
std::allocator<char> >&, std::basic_string<char, std::char_traits<char>,
std::allocator<char> >&)'
/usr/include/c++/3.2.2/bits/stl_algo.h: In function `const _Tp&
std::__median(const _Tp&, const _Tp&, const _Tp&, _Compare) [with _Tp =
std::basic_string<char, std::char_traits<char>, std::allocator<char> >,
_Compare = std::unary_negate<ci_less>]':
/usr/include/c++/3.2.2/bits/stl_algo.h:2147: instantiated from `void std::__introsort_loop(_RandomAccessIter, _RandomAccessIter, _Size, _Compare) [with _RandomAccessIter = __gnu_cxx::__normal_iterator<std::string*, std::vector<std::string, std::allocator<std::string> > >, _Size = int, _Compare = std::unary_negate<ci_less>]'
/usr/include/c++/3.2.2/bits/stl_algo.h:2209: instantiated from `void std::sort(_RandomAccessIter, _RandomAccessIter, _Compare) [with _RandomAccessIter = __gnu_cxx::__normal_iterator<std::string*, std::vector<std::string, std::allocator<std::string> > >, _Compare = std::unary_negate<ci_less>]'
test.cpp:77: instantiated from here
/usr/include/c++/3.2.2/bits/stl_algo.h:124: no match for call to `(
std::unary_negate<ci_less>) (const std::basic_string<char,
std::char_traits<char>, std::allocator<char> >&, const
std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'
/usr/include/c++/3.2.2/bits/stl_algo.h:125: no match for call to `(
std::unary_negate<ci_less>) (const std::basic_string<char,
std::char_traits<char>, std::allocator<char> >&, const
std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'
/usr/include/c++/3.2.2/bits/stl_algo.h:127: no match for call to `(
std::unary_negate<ci_less>) (const std::basic_string<char,
std::char_traits<char>, std::allocator<char> >&, const
std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'
/usr/include/c++/3.2.2/bits/stl_algo.h:131: no match for call to `(
std::unary_negate<ci_less>) (const std::basic_string<char,
std::char_traits<char>, std::allocator<char> >&, const
std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'
/usr/include/c++/3.2.2/bits/stl_algo.h:133: no match for call to `(
std::unary_negate<ci_less>) (const std::basic_string<char,
std::char_traits<char>, std::allocator<char> >&, const
std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'
/usr/include/c++/3.2.2/bits/stl_algo.h: In function `_RandomAccessIter
std::__unguarded_partition(_RandomAccessIter, _RandomAccessIter, _Tp,
_Compare) [with _RandomAccessIter =
__gnu_cxx::__normal_iterator<std::string*, std::vector<std::string,
std::allocator<std::string> > >, _Tp = std::basic_string<char,
std::char_traits<char>, std::allocator<char> >, _Compare =
std::unary_negate<ci_less>]':
/usr/include/c++/3.2.2/bits/stl_algo.h:2147: instantiated from `void std::__introsort_loop(_RandomAccessIter, _RandomAccessIter, _Size, _Compare) [with _RandomAccessIter = __gnu_cxx::__normal_iterator<std::string*, std::vector<std::string, std::allocator<std::string> > >, _Size = int, _Compare = std::unary_negate<ci_less>]'
/usr/include/c++/3.2.2/bits/stl_algo.h:2209: instantiated from `void std::sort(_RandomAccessIter, _RandomAccessIter, _Compare) [with _RandomAccessIter = __gnu_cxx::__normal_iterator<std::string*, std::vector<std::string, std::allocator<std::string> > >, _Compare = std::unary_negate<ci_less>]'
test.cpp:77: instantiated from here
/usr/include/c++/3.2.2/bits/stl_algo.h:1910: no match for call to `(
std::unary_negate<ci_less>) (std::basic_string<char, std::char_traits<char>,
std::allocator<char> >&, std::basic_string<char, std::char_traits<char>,
std::allocator<char> >&)'
/usr/include/c++/3.2.2/bits/stl_algo.h:2147: instantiated from `void std::__introsort_loop(_RandomAccessIter, _RandomAccessIter, _Size, _Compare) [with _RandomAccessIter = __gnu_cxx::__normal_iterator<std::string*, std::vector<std::string, std::allocator<std::string> > >, _Size = int, _Compare = std::unary_negate<ci_less>]'
/usr/include/c++/3.2.2/bits/stl_algo.h:2209: instantiated from `void std::sort(_RandomAccessIter, _RandomAccessIter, _Compare) [with _RandomAccessIter = __gnu_cxx::__normal_iterator<std::string*, std::vector<std::string, std::allocator<std::string> > >, _Compare = std::unary_negate<ci_less>]'
test.cpp:77: instantiated from here
/usr/include/c++/3.2.2/bits/stl_algo.h:1913: no match for call to `(
std::unary_negate<ci_less>) (std::basic_string<char, std::char_traits<char>,
std::allocator<char> >&, std::basic_string<char, std::char_traits<char>,
std::allocator<char> >&)'
/usr/include/c++/3.2.2/bits/stl_algo.h: In function `void
std::__insertion_sort(_RandomAccessIter, _RandomAccessIter, _Compare) [with
_RandomAccessIter = __gnu_cxx::__normal_iterator<std::string*,
std::vector<std::string, std::allocator<std::string> > >, _Compare =
std::unary_negate<ci_less>]':
/usr/include/c++/3.2.2/bits/stl_algo.h:2075: instantiated from `void std::__final_insertion_sort(_RandomAccessIter, _RandomAccessIter, _Compare) [with _RandomAccessIter = __gnu_cxx::__normal_iterator<std::string*, std::vector<std::string, std::allocator<std::string> > >, _Compare = std::unary_negate<ci_less>]'
/usr/include/c++/3.2.2/bits/stl_algo.h:2210: instantiated from `void std::sort(_RandomAccessIter, _RandomAccessIter, _Compare) [with _RandomAccessIter = __gnu_cxx::__normal_iterator<std::string*, std::vector<std::string, std::allocator<std::string> > >, _Compare = std::unary_negate<ci_less>]'
test.cpp:77: instantiated from here
/usr/include/c++/3.2.2/bits/stl_algo.h:2007: no match for call to `(
std::unary_negate<ci_less>) (std::string&, std::basic_string<char,
std::char_traits<char>, std::allocator<char> >&)'
/usr/include/c++/3.2.2/bits/stl_algo.h: In function `void
std::__unguarded_linear_insert(_RandomAccessIter, _Tp, _Compare) [with
_RandomAccessIter = __gnu_cxx::__normal_iterator<std::string*,
std::vector<std::string, std::allocator<std::string> > >, _Tp =
std::basic_string<char, std::char_traits<char>, std::allocator<char> >,
_Compare = std::unary_negate<ci_less>]':
/usr/include/c++/3.2.2/bits/stl_algo.h:2012: instantiated from `void std::__insertion_sort(_RandomAccessIter, _RandomAccessIter, _Compare) [with _RandomAccessIter = __gnu_cxx::__normal_iterator<std::string*, std::vector<std::string, std::allocator<std::string> > >, _Compare = std::unary_negate<ci_less>]'
/usr/include/c++/3.2.2/bits/stl_algo.h:2075: instantiated from `void std::__final_insertion_sort(_RandomAccessIter, _RandomAccessIter, _Compare) [with _RandomAccessIter = __gnu_cxx::__normal_iterator<std::string*, std::vector<std::string, std::allocator<std::string> > >, _Compare = std::unary_negate<ci_less>]'
/usr/include/c++/3.2.2/bits/stl_algo.h:2210: instantiated from `void std::sort(_RandomAccessIter, _RandomAccessIter, _Compare) [with _RandomAccessIter = __gnu_cxx::__normal_iterator<std::string*, std::vector<std::string, std::allocator<std::string> > >, _Compare = std::unary_negate<ci_less>]'
test.cpp:77: instantiated from here
/usr/include/c++/3.2.2/bits/stl_algo.h:1961: no match for call to `(
std::unary_negate<ci_less>) (std::basic_string<char, std::char_traits<char>,
std::allocator<char> >&, std::basic_string<char, std::char_traits<char>,
std::allocator<char> >&)'
/usr/include/c++/3.2.2/bits/stl_heap.h: In function `void
std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp,
_Compare) [with _RandomAccessIterator =
__gnu_cxx::__normal_iterator<std::string*, std::vector<std::string,
std::allocator<std::string> > >, _Distance = int, _Tp =
std::basic_string<char, std::char_traits<char>, std::allocator<char> >,
_Compare = std::unary_negate<ci_less>]':
/usr/include/c++/3.2.2/bits/stl_heap.h:268: instantiated from `void std::make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<std::string*, std::vector<std::string, std::allocator<std::string> > >, _Compare = std::unary_negate<ci_less>]'
/usr/include/c++/3.2.2/bits/stl_algo.h:2555: instantiated from `void std::partial_sort(_RandomAccessIter, _RandomAccessIter, _RandomAccessIter, _Compare) [with _RandomAccessIter = __gnu_cxx::__normal_iterator<std::string*, std::vector<std::string, std::allocator<std::string> > >, _Compare = std::unary_negate<ci_less>]'
/usr/include/c++/3.2.2/bits/stl_algo.h:2138: instantiated from `void std::__introsort_loop(_RandomAccessIter, _RandomAccessIter, _Size, _Compare) [with _RandomAccessIter = __gnu_cxx::__normal_iterator<std::string*, std::vector<std::string, std::allocator<std::string> > >, _Size = int, _Compare = std::unary_negate<ci_less>]'
/usr/include/c++/3.2.2/bits/stl_algo.h:2209: instantiated from `void std::sort(_RandomAccessIter, _RandomAccessIter, _Compare) [with _RandomAccessIter = __gnu_cxx::__normal_iterator<std::string*, std::vector<std::string, std::allocator<std::string> > >, _Compare = std::unary_negate<ci_less>]'
test.cpp:77: instantiated from here
/usr/include/c++/3.2.2/bits/stl_heap.h:187: no match for call to `(
std::unary_negate<ci_less>) (std::basic_string<char, std::char_traits<char>,
std::allocator<char> >&, std::basic_string<char, std::char_traits<char>,
std::allocator<char> >&)'
/usr/include/c++/3.2.2/bits/stl_heap.h: In function `void
std::__push_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare)
[with _RandomAccessIterator = __gnu_cxx::__normal_iterator<std::string*,
std::vector<std::string, std::allocator<std::string> > >, _Distance = int,
_Tp = std::basic_string<char, std::char_traits<char>, std::allocator<char>
>, _Compare = std::unary_negate<ci_less>]':
/usr/include/c++/3.2.2/bits/stl_heap.h:197: instantiated from `void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<std::string*, std::vector<std::string, std::allocator<std::string> > >, _Distance = int, _Tp = std::basic_string<char, std::char_traits<char>, std::allocator<char> >, _Compare = std::unary_negate<ci_less>]'
/usr/include/c++/3.2.2/bits/stl_heap.h:268: instantiated from `void std::make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<std::string*, std::vector<std::string, std::allocator<std::string> > >, _Compare = std::unary_negate<ci_less>]'
/usr/include/c++/3.2.2/bits/stl_algo.h:2555: instantiated from `void std::partial_sort(_RandomAccessIter, _RandomAccessIter, _RandomAccessIter, _Compare) [with _RandomAccessIter = __gnu_cxx::__normal_iterator<std::string*, std::vector<std::string, std::allocator<std::string> > >, _Compare = std::unary_negate<ci_less>]'
/usr/include/c++/3.2.2/bits/stl_algo.h:2138: instantiated from `void std::__introsort_loop(_RandomAccessIter, _RandomAccessIter, _Size, _Compare) [with _RandomAccessIter = __gnu_cxx::__normal_iterator<std::string*, std::vector<std::string, std::allocator<std::string> > >, _Size = int, _Compare = std::unary_negate<ci_less>]'
/usr/include/c++/3.2.2/bits/stl_algo.h:2209: instantiated from `void std::sort(_RandomAccessIter, _RandomAccessIter, _Compare) [with _RandomAccessIter = __gnu_cxx::__normal_iterator<std::string*, std::vector<std::string, std::allocator<std::string> > >, _Compare = std::unary_negate<ci_less>]'
test.cpp:77: instantiated from here
/usr/include/c++/3.2.2/bits/stl_heap.h:107: no match for call to `(
std::unary_negate<ci_less>) (std::basic_string<char, std::char_traits<char>,
std::allocator<char> >&, std::basic_string<char, std::char_traits<char>,
std::allocator<char> >&)'
make: *** [test.o] Error 1
How's that? Not bad eh?
To generate that I changed the line:
sort (v.begin (), v.end (), not2 (ci_less ()));
to
sort (v.begin (), v.end (), not1 (ci_less ()));
Notice, the change of "not2" to "not1".
It shows, that even if you get a really lengthy error message, to stay calm - maybe there is only a minor coding bug. ;)
However the gratifying thing is that the line number reported in the error message (77) was in fact the line with the error on it.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|