Boost logo

Boost :

From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2006-04-11 14:04:17


Douglas Gregor wrote:
> On Apr 10, 2006, at 4:35 PM, Paul Mensonides wrote:

> To try to make this description a little more "real", I've appended
> the output of both GCC and ConceptGCC when trying to compile this
> simple program:
>
> list<int> l;
> sort(l.begin(), l.end());

> Sorting list iterators with ConceptGCC:
>
> sort_list.cpp: In function 'int main()':
> sort_list.cpp:8: error: no matching function for call to 'sort
> (std::_List_iterat
> or<int>, std::_List_iterator<int>)'
> /usr/local/conceptgcc/lib/gcc/powerpc-apple-
> darwin8.2.0/4.0.1/../../../../includ
> e/c++/4.0.1/bits/stl_algo.h:2843: note: candidates are: void std::sort
> (_Iter, _I
> ter) [with _Iter = std::_List_iterator<int>] <where clause>
> sort_list.cpp:8: note: unsatisfied model requirement
> 'std::MutableRandomAccess
> Iterator<std::_List_iterator<int> >'

Here's the message from Comeau 4.3.3:

$ como list.cpp --error_limit=1
Comeau C/C++ 4.3.3 (Jan 13 2004 11:29:09) for MS_WINDOWS_x86
Copyright 1988-2003 Comeau Computing. All rights reserved.
MODE:non-strict warnings microsoft C++

"E:\C++\visual7_1\include\algorithm", line 1795: error: no operator "-"
           matches these operands
             operand types are: std::list<int,
std::allocator<int>>::iterator -
                       std::list<int, std::allocator<int>>::iterator
         _Sort(_First, _Last, _Last - _First);
                                    ^
           detected during instantiation of "void std::sort(_RanIt, _RanIt)
                     [with _RanIt=std::list<int,
                     std::allocator<int>>::iterator]"

Now the problem here is that we can't see which line that caused the
error. I assume concept checks from boost would help.

-Thorsten


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk