|
Boost : |
Subject: Re: [boost] Move notes
From: David Abrahams (dave_at_[hidden])
Date: 2009-09-07 17:50:50
on Mon Sep 07 2009, Ion Gaztañaga <igaztanaga-AT-gmail.com> wrote:
> David Abrahams escribió:
>> Hi Ion,
>>
>> A few things I noticed looking through move.hpp in the sandbox
>>
>> 1. you static_cast in one direction but reinterpret_cast in the other.
>> Why?
>
> A bug was reported for SunPro with static_cast producing an infinite loop:
>
> http://lists.boost.org/Archives/boost/2009/02/149069.php
I don't think that's a good enough reason to have them be different.
Yeah, we're over the line in forming these invalid references but at
least I'd like to be able to point to the pointer round-tripping rules
and say we got that part right. In this case we might even be better
off with C-style casts.
>> 3. I think its operator[] can be wrong for some iterators. See
>> http://www.boost.org/doc/libs/1_40_0/libs/iterator/doc/iterator_facade.html#operator
>
> Ok, I'm quite lost to find a proper solution, what do you suggest?
You could always use iterator_adaptor to build this puppy :-) It solves
this problem as well as possible. Otherwise, just return value_type
instead of reference.
-- 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