From: Rob Stewart (stewart_at_[hidden])
Date: 2005-09-29 08:24:25
From: Simon Buchan <simon_at_[hidden]>
> Robert Kawulak wrote:
> > In bounded policies I use
> > passed_value_type initialize()
> > where passed_value_type is value_type for integral types and const
> > value_type & for other types. The second returns a reference to a static
> > object - that's the most efficient method I can think of, initialization
> > takes only one copy-construction (for details please look into the code).
> ref to static? It feels cludgy. Just trust the RVO even for user
> classes, IMHO, it's how the std lib works. Unfortunately the RVO can't
> get rid of the side-effects of c/d'tors, so you should make sure it's
> documented that values must have normal copy semantics if default
> initialisation is used.
I agree. Returning a reference to a function local static is
> >>What you are suggesting is equivalent to suggesting that
> >>std::vector should be named "vector_type" because it is a class
> > Uhh, maybe you're right ;-) I don't know why, but it just "byte my eyes"
> > when I see a type named "something_value"... Nevermind, if people here
> > really resist that it should be called constrained_value instead of
> > constrained_type, then OK - I'll change it.
> Why not just 'constrained'? ie. constrained<int>?
That works for me.
-- Rob Stewart stewart_at_[hidden] Software Engineer http://www.sig.com Susquehanna International Group, LLP using std::disclaimer;
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk