Boost logo

Boost :

From: Maxim Shemanarev (mcseem_at_[hidden])
Date: 2002-08-22 19:29:40

> After testing, I found that anything like
> template <class T>
> struct X
> {
> static T& f();
> static const int value = sizeof(f());
> };
> will not compile, whether or not instantiated.

I believe it's because of the the new C++ innovation of having static const
int members initialized *inside* the class. Apparently Borland simply
doesn't support this IMO useless feature. Can anyone tell me what's the good
of it when one can perfetly use enums? Let alone it's clearly said that this
syntax is applicable for only integer types.
Historically there's the rule in C and C++ that the initialization can be
done only in the definition, but not in the declaration. This innovation
breakes this rule.
Although, it can seem that enums are also exceptions, but in fact, in enums
there's no definition and no intialization. There's only a declaration.

I would vote for changing these things to enums.


Boost list run by bdawes at, gregod at, cpdaniel at, john at