D
Drew McCormack
I am getting an error in g++ 4.0.0 that I did not get in g++ 3.4. I
have a header with the following const variables with namespace scope:
namespace Periphery {
extern const double ProtonMassInAtomicUnits = 1836.152755656068;
}
I try to use these in another header to initialize static const member
variables, like so:
namespace Periphery {
class RMatrixH2Pt3DSolver {
static const double hMass = ProtonMassInAtomicUnits;
I get this error:
/Volumes/BigDisk/Develop/periphery/src/RMatrixH2Pt3DSolver.h:40: error:
'Periphery:
rotonMassInAtomicUnits' cannot appear in a
constant-expression
I assume that g++ 4 is doing the right thing, adhering more closely to
the standard than 3.4. But my question is: how can I define a constant
namespace variable like ProtonMassInAtomicUnits, and use that to
initialize static constants like hMass? Do I have to use the
preprocessor and define a macro?
I prefer not to do that because then I can't put the constant in the
Periphery namespace.
Drew McCormack
have a header with the following const variables with namespace scope:
namespace Periphery {
extern const double ProtonMassInAtomicUnits = 1836.152755656068;
}
I try to use these in another header to initialize static const member
variables, like so:
namespace Periphery {
class RMatrixH2Pt3DSolver {
static const double hMass = ProtonMassInAtomicUnits;
I get this error:
/Volumes/BigDisk/Develop/periphery/src/RMatrixH2Pt3DSolver.h:40: error:
'Periphery:
constant-expression
I assume that g++ 4 is doing the right thing, adhering more closely to
the standard than 3.4. But my question is: how can I define a constant
namespace variable like ProtonMassInAtomicUnits, and use that to
initialize static constants like hMass? Do I have to use the
preprocessor and define a macro?
I prefer not to do that because then I can't put the constant in the
Periphery namespace.
Drew McCormack