Boost logo

Boost Users :

Subject: Re: [Boost-users] boost.iterators - iterator_facade issue with aligned types.
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-01-19 13:12:19


At Wed, 19 Jan 2011 14:36:24 +0100,
Christoph Heindl wrote:
>
> It seems to me that boost::iterator_facade cannot cope with aligned types
> when the 'Reference = use_default' template argument is not a reference,
> which can happen if transform_iterator is used to return the result of a
> temporay calculation (by value of course).
>
> Inside iterator_facade.hpp
>
> struct operator_arrow_result {
> //...
> static type make(Reference x)
> {
> return implicit_cast<type>(&x);
> }
> };
>
> Reference here is passed by value. Since Reference has alignment the compiler
> reports an error.
>
> The issue was resolved once i changed that code to
>
> struct operator_arrow_result {
> //...
> typedef typename mpl::if_<
> is_reference<Reference>
> , Reference
> , typename add_reference<Reference>::type
> >::type input_type;
>
> static type make(input_type x)
> {
> return implicit_cast<type>(&x);
> }
> };
>
> I wonder about any side effects this would cause? My lousy research is based
> boost 1.43. That part of the code seems to be unchanged for the current trunk.

I *think* that change is safe to make. Care to submit it as a patch
at http://svn.boost.org/ ?

Thanks!

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.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