Boost logo

Boost :

From: Rob Stewart (stewart_at_[hidden])
Date: 2005-09-29 08:22:53

From: "Robert Kawulak" <kawulak_at_[hidden]>

Please don't snip attributions.

> > Use
> >
> > void initialize(value_type & value_o);
> >
> > rather than
> >
> > value_type initialize();
> >
> > Thus, when passed the data member to initialize, it can
> > initialize that object directly. Granted, (N)RVO can often avoid
> > the copy, but this change will ensure you get the efficiency.
> I don't think so, because your version of initialize couldn't be used to
> initialize a value in constructor's initialization list. So first the value
> would be default-constructed, and then assigned another value using
> initialize.

Ah. If you're using it in an initializer list, then your version
is better. (N)RVO is your friend in that case.

Rob Stewart                           stewart_at_[hidden]
Software Engineer           
Susquehanna International Group, LLP  using std::disclaimer;

Boost list run by bdawes at, gregod at, cpdaniel at, john at