help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: _GLIBCXX_CONCEPT_CHECKS usage


From: Pedro Lamarão
Subject: Re: _GLIBCXX_CONCEPT_CHECKS usage
Date: Mon, 17 Sep 2007 15:42:27 -0000
User-agent: G2/1.0

On Sep 14, 12:37 pm, mathieu <mathieu.malate...@gmail.com> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]