I have a few lines that compile well on my system but don't compile on a colleagues system. That's why I would like to ask what the go-to solution for the problem would look like. I have to deal with a enum
that implicitly defines how much space I have to provide for an std::array
. Other parts of the code also make use of FooSize
being static. (Optimization)
My current implementation looks like this
enum class FooType
{
ShortFoo,
LongFoo
};
// defined in a different file
template <FooType FType>
class FooContainer
{
public:
static const unsigned int FooSize {(FType == FooType::ShortFoo) ? 32 : 64 };
std::array<float, FooSize> fooArray;
};
The code seems to create issues on older llvm / clang compilers. 32
and 64
are actually provided via pre processor defines. I could just skip the FooType
and use the size as an template argument but I would like to know what the most reliable method of initializing FooSize
would be.
Aucun commentaire:
Enregistrer un commentaire