Boost logo

Boost Users :

From: Robert Dailey (rcdailey_at_[hidden])
Date: 2007-12-12 12:46:41


Well I read the standard, and it really more or less discusses what you
*can't* use to initialize default parameters. Amongst that list I didn't see
functions. And behold, it worked! I guess I don't need boost after all. All
these years I kept thinking that only compile-time constants could be used
to initialize default parameters. I never use default parameters anyway, so
I can understand. Just goes to show that you learn new things every day,
regardless of how obvious things are :)

Thanks guys.

On Dec 12, 2007 10:08 AM, Stjepan Rajko <stipe_at_[hidden]> wrote:

> 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 mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



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