Boost logo

Boost Users :

Subject: Re: [Boost-users] [Proto] Storing an Expression Template as a Data Member
From: Eric Niebler (eric_at_[hidden])
Date: 2011-01-08 15:32:32


On 1/8/2011 1:55 PM, Hossein Haeri wrote:
>>> So, what about the following?
>>>
>>> #define DEFINE_MY_CLASS(name, exp) \
>>>
>> MyClass<result_of::deep_copy<BOOST_TYPEOF(exp)>::type>
>> name(deep_copy(exp))
>>
>> Sure. Or you could move the deep-copy action an implementation detail of
>> MyClass and keep the macro simple. Whichever.
>
> Right. Either way, how should I deal with copy construction? Is the deeply copied thing automatic for copy construction? Or, should I make another deep copy each time?

A Proto expression that has been passed through proto::deep_copy owns
all its sub-objects. The default copy constructor should just do the
right thing.

>> No, I'm not saying that. I'm saying you can use >> and Proto to build an
>> expression tree, and use a transform to compose that tree
>> into a function object.
> <snip>
>
> I see. Hmmm... I guess the same technique wouldn't be working uniformly for my entire syntax. Thanks for the suggestion though. :)

Not sure I see what the problem is.

-- 
Eric Niebler
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