J
jsnX
Say I would like my namespace to have some constants associated with
it, like this:
==========
=====
namespace broadpen
{
struct defaults
{
static const double w = 10.0;
static const double r = 0.6435011087932843868;
static const double a = 0.2;
virtual void dummy() = 0;
};
}
=====
==========
however, this example fails with the following errors:
==========
=====
error: ISO C++ forbids initialization of member constant `w' of
non-integral type `const double'
error: ISO C++ forbids initialization of member constant `r' of
non-integral type `const double'
error: ISO C++ forbids initialization of member constant `a' of
non-integral type `const double'
=====
==========
this really seems like it should work - is it a fact that I can not
initialize non-integer constants? yikes!!
it, like this:
==========
=====
namespace broadpen
{
struct defaults
{
static const double w = 10.0;
static const double r = 0.6435011087932843868;
static const double a = 0.2;
virtual void dummy() = 0;
};
}
=====
==========
however, this example fails with the following errors:
==========
=====
error: ISO C++ forbids initialization of member constant `w' of
non-integral type `const double'
error: ISO C++ forbids initialization of member constant `r' of
non-integral type `const double'
error: ISO C++ forbids initialization of member constant `a' of
non-integral type `const double'
=====
==========
this really seems like it should work - is it a fact that I can not
initialize non-integer constants? yikes!!