Boost logo

Boost :

Subject: Re: [boost] disable_if conundrum
From: Marshall Clow (mclow.lists_at_[hidden])
Date: 2011-12-05 17:22:23


On Dec 5, 2011, at 1:40 PM, Jeffrey Lee Hellrung, Jr. wrote:
> On Mon, Dec 5, 2011 at 1:11 PM, Marshall Clow <mclow.lists_at_[hidden]> wrote:
>
>> On Dec 5, 2011, at 12:53 PM, Marshall Clow wrote:
>>
>>> But if I add the following code:
>>>
>>> bool comp ( int x ) { return x > 10; }
>>> and res = Foo ( v, comp );
>>>
>>> I get a bunch of compilation errors.
>>
>> My bad.
>> Since the range-based versions of Foo take the range by const &, they
>> return pairs of const_iterators.
>> res is a pair of non-const iterators; you can't assign one to the other.
>>
>
> ...which suggests (to me) that you *may* want to provide a
> reference-to-non-const overload of Foo *even if* Foo does not modify its
> argument, since this will make it easier to mutate based on the result of
> Foo (if, e.g., the result is an iterator or pair of iterators).

Yes. I had come to that conclusion already.

I would like
        Foo ( v.begin (), v.end ());
and Foo ( v );

to return the same results (or, at least, compatible results).

-- Marshall

Marshall Clow Idio Software <mailto:mclow.lists_at_[hidden]>

A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).
        -- Yu Suzuki


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