Boost logo

Boost Users :

Subject: Re: [Boost-users] [Proto] Evaluating non-trivial expression
From: Joel Falcou (joel.falcou_at_[hidden])
Date: 2008-09-30 17:20:12


Eric Niebler a écrit :
> Aside from the usual advice against doing stuff in destructors that
> can fail ... how do you ensure that only the top-level (outermost)
> object's destructor causes an evaluation?
>
I actually have a flag in the expression that is set when the expression
is used as a rhs in operator=.
Side effect of doing this is that I can optimize a =b =c+d into a single
nest loop instead of one nest loop + memcpying the data.
In which cases a destructor can fail ?
> Might it be cleaner to be more explicit about evaluation, e.g., like:
>
> eval(( a = b+c, u = x + y, z = 3*e ));
It may but it'll break existing code and looks far less intuitive.

___________________________________________
Joel Falcou - Assistant Professor
PARALL Team - LRI - Universite Paris Sud XI
Tel : (+33)1 69 15 66 35


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