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 );
};

I'm not 100% sure if the above is legal C++. I haven't gotten to the point to where I could test it. I suppose I could try it with integrals, but I just haven't gotten around to it.

On Dec 10, 2007 12:21 PM, Richard Hadsell <hadsell@blueskystudios.com> wrote:
Robert Dailey wrote:
Is there a way I can define constant floats within class scope like you can with integral values? I was hoping boost could help in this area. For example:

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

The above is not legal, of course. Anyone? Thanks.
In .h header:
struct default_alpha
{
    static const float value;
};
In .cc source file:
const float default_alpha::value = 1.0f;
Is this answer too simple?
-- 
Dick Hadsell			914-259-6320  Fax: 914-259-6499
Reply-to:			hadsell@blueskystudios.com
Blue Sky Studios                http://www.blueskystudios.com
44 South Broadway, White Plains, NY 10601

_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users