On Sep 14, 12:37 pm, mathieu <[EMAIL PROTECTED]> wrote:

> Now second try with concept checking:
>
> $ g++-4.2 -D_GLIBCXX_CONCEPT_CHECKS l.cxx
> /usr/include/c++/4.2/bits/stl_algo.h: In function 'void
> std::sort(_RandomAccessIterator, _RandomAccessIterator) [with
> _RandomAccessIterator = std::_List_iterator<int>]':
> l.cxx:7:   instantiated from here
> /usr/include/c++/4.2/bits/stl_algo.h:2829: error: no match for
> 'operator-' in '__last - __first'
> /usr/include/c++/4.2/bits/stl_algo.h: In function 'void
> std::__final_insertion_sort(_RandomAccessIterator,
> _RandomAccessIterator) [with _RandomAccessIterator =
> std::_List_iterator<int>]':
> /usr/include/c++/4.2/bits/stl_algo.h:2831:   instantiated from 'void
> std::sort(_RandomAccessIterator, _RandomAccessIterator) [with
> _RandomAccessIterator = std::_List_iterator<int>]'
> l.cxx:7:   instantiated from here
> /usr/include/c++/4.2/bits/stl_algo.h:2436: error: no match for
> 'operator-' in '__last - __first'
> /usr/include/c++/4.2/bits/stl_algo.h:2438: error: no match for
> 'operator+' in '__first + 16'
> /usr/include/c++/4.2/bits/stl_algo.h:2439: error: no match for
> 'operator+' in '__first + 16'
> /usr/include/c++/4.2/bits/boost_concept_check.h: In member function
> 'void
> __gnu_cxx::_Mutable_RandomAccessIteratorConcept<_Tp>::__constraints()
> [with _Tp = std::_List_iterator<int>]':
> /usr/include/c++/4.2/bits/boost_concept_check.h:63:   instantiated
> from 'void __gnu_cxx::__function_requires() [with _Concept =
> __gnu_cxx::_Mutable_RandomAccessIteratorConcept<std::_List_iterator<int>>]'

This is the block that "concept checking" is producing to help you.

Before, there was no message explicitly stating the problem: the
algorithm you're calling requires a Mutable RandomAccessIterator.
The point is to exhibit the actual cause of the problem, a requirement
violation, as early as possible.

Without the compiler support planned for C++09, there isn't much more
the implementation can do.

--
 Pedro Lamarão

_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to