Boost logo

Boost Users :

From: David Abrahams (dave_at_[hidden])
Date: 2004-12-04 14:40:27


Duane Murphy wrote:
> I am implementing an iterator via iterator facade. The container that the
> iterator is being used with can only return dereferenced values by value
> (not by reference).
>
> If I implement the dereference() function (for facade) by returning a
> value (instead of reference) then it appears that the iterator works properly.
>
> The most important operation that does _not_ work is that the iterator
> cannot be used with bind(). (bind cannot be used with non-const return types.)

Sorry, I can't imagine what you mean. Of course bind works with
non-const return types:

   int f(int x) { return x + 1; }

   int three = bind(f, 2)();

> If I change the iterator to return a reference type then the iterator
> functions still work and so does bind.

Please post your code.

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net