|
Boost : |
Subject: Re: [boost] [iterator] [iterator_facade] operator-> question
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-06-30 18:50:18
At Wed, 29 Jun 2011 13:09:04 -0700,
Jeffrey Lee Hellrung, Jr. wrote:
>
> Now, iterator_facade< /*...*/ >::operator->'s return type is
> operator_arrow_result< /*...*/ >::type, which, for proxy references,
> according to the logic above in operator_arrow_result, is
> operator_arrow_proxy<T>, where T, in this case, is pair< Index, Value >.
> The error occurs when operator_arrow_proxy<T> is constructed from &x within
> operator_arrow_result< /*...*/ >::make, as it tries to convert a pair<
> Index, Value& >* to a pair< Index, Value >*, which is a no-go.
>
> It seems to me that a more correct implementation of operator_arrow_result
> would use operator_arrow_proxy< Reference > rather than
> operator_arrow_proxy< ValueType >.
That won't get us what we need: an actual T lvalue as noted in the comment.
> I would further rename and change operator_arrow_proxy's member
> variable to be stored as const T m_ref, rather than mutable T
> m_value.
Is that related to this problem?
> What are others' opinions on this? Am I doing something wrong?
I doubt you're doing anything wrong. I'm fully prepared to believe
the library should be doing something smarter. What that smarter
thing is, I am not sure of, but you might find the answer in one of
the many outstanding tickets.
-- Dave Abrahams BoostPro Computing http://www.boostpro.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk