Andre Poenitz wrote:
>> Cached variables are a royal pain in the butt.
>> 
>> Writing explicit copy constructors simply so that we don't copy
>>         mutable int xo_;
>> is a real bore. I'm sure that the author of formulabase.[Ch] would
>> agree with me there ;-)
> So just copy it.
> 
>> Why don't we have a CachedVar class template.
> Because it is not needed.
> 
>> Shall I do it?
> I see no benefit.

There are several examples of places where we do not want these 
variables to be copied. Indeed, there are examples where the default 
copy constructor fails to compile. For example, any class holding a 
boost::signal. These derive from boost::noncopyable. Defining them as 
a CachedVar<signal<blah> > would work perfectly here and would be 
self-documenting code.

-- 
Angus

Reply via email to