This is what I've got:
struct Foo
{
static std::array<double, 4> acgt_default_background_frequencies() { return {0.281774, 0.222020, 0.228876, 0.267330}; }
};
But I'd prefer to not use a function and instead just have a variable, like this:
struct Foo
{
static constexpr std::array<double, 4> acgt_default_background_frequencies = {0.281774, 0.222020, 0.228876, 0.267330};
};
What I want compiles, but when I try to use Foo::acgt_default_background_frequencies
it gives the linker error "undefined reference to `Foo::acgt_default_background_frequencies'".
Is what I am trying to do possible? I think it is clearer to the reader of my header if I have the value inlined as a const than to hide it in the .cpp file and having a constant as opposed to a function also seems clearer. Isn't the point of constexpr to allow stuff like this? If it isn't possible, why not?