Boost logo

Boost Users :

From: Stjepan Rajko (stipe_at_[hidden])
Date: 2007-12-12 11:08:58


On Dec 12, 2007 8:07 AM, Robert Dailey <rcdailey_at_[hidden]> wrote:
> Are function calls allowed to default initialize a construction parameter?
> Does the compiler turn the function into a constant? How does that work? I
> wasn't aware you could do this...
>

I was asking the same questions, which is what prompted me to try to
find the answers in the standard. If you can get your hands on it
(I'm looking at ISO/IEC 14882:2003), section 8.3.6. talks about what
can and can't be used for default argument values. Anyway, the
compiler will evaluate the expression when the function is called, but
not all expressions are valid (the ones I put in the example should
be). If this doesn't work for you, you can always have two
constructors - one taking 4 arguments and one taking 3, initializing
the alpha value to just about anything.

I would suggest a C++ list or channel to get more info, we've strayed
a bit from Boost :-) But I found it helpful too.

Cheers,

Stjepan


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