"Johan Nilsson" <johan.nilsson@[...].se> wrote in message
news:c97cum$cn2$1@[...]..
> > "Jeff Flinn" <TriumphSprint2000@[...].com> wrote in message> news:c97afd$60h$1@[...]..> >> > "Johan Nilsson" <johan.nilsson@[...].se> wrote in message> > news:c96p5d$qlg$1@[...]..> > >> > [...]> > > matter> > > if this is a two-step procedure:> > > Allocate in constructors + Initialize in entry> > > or one-step:> > > Allocate and initialize in constructor.> >> > class astate : non_copyable> > {> > T& mRef;> >> > astate();> >> > public:> >> > astate( T& aRef ):mRef(aRef){ aRef.somefunction(); }> >> > void init( T& aRef ){ mRef = aRef; mRef.somefunction(); } // not the> > same> >> > };> > No, of course not. I meant:> > // one-step> class astate : non_copyable { ...> astate( T& aRef ):mRef(aRef){ aRef.somefunction(); }> ... };> > versus:> > // two-step> class astate : non_copyable { ...> astate( T& aRef ):mRef(aRef){}> void entry(){ mRef.somefunction(); }> ... };
This assumes that you have access to the same information at construction
time as at the call to astate::entry (you previously were discussing
init/deinit). I was pointing out that separating out init() does in fact
come with some cost to flexibility.
Jeff Flinn
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost