Boost logo

Boost Users :

Subject: Re: [Boost-users] [Proto] Storing an Expression Template as a Data Member
From: Hossein Haeri (powerprogman_at_[hidden])
Date: 2011-01-10 06:16:00


Hi Eric,

> > auto ex1 = lit(1) + 3;
>
> Don't EVER do this.

Oops! Out of habit; I currently don't use C++0x and therefore do that using BOOST_PROTO_AUTO -- not used to using deep_copy thus...

> auto ex1 = proto::deep_copy( lit(1) + 3 );
>
> > {
> >   auto ex2 = ex1;
> > }
> >
> > ex2 will copy everything in ex1, right? (OK, except
> for function references.)
>
> Right.

Cool. Then, I suggest that you do make this (more) clear in the Proto docs. Maybe you'd even like to add a subsection on how to store Proto expressions as data members and then also include a note on the sufficiency of default copy constructors.

Thanks,
--Hossein


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