Boost logo

Boost Users :

From: Roman Perepelitsa (roman.perepelitsa_at_[hidden])
Date: 2007-12-11 02:14:27


Robert Dailey <rcdailey <at> gmail.com> writes:
>
>
> I'm going to be using this float to default-initialize a construction
> parameter. For example:
> struct default_alpha
> {
> static const float value = 1.0f;
> };
> class foo
> {
>    foo( float r, float g, float b, float a = default_alpha::value );
> };
>

You can use constant in namespace scope:

namespace default_alpha
{
    static const float value = 1.0f;
}

HTH,
Roman Perepelitsa.


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