Boost logo

Boost :

Subject: Re: [boost] disable_if conundrum
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2011-12-05 16:40:25


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).

- Jeff


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