- 論壇徽章:
- 0
|
先貼上一段關(guān)于這個(gè)問(wèn)題的 C++ 標(biāo)準(zhǔn)的原文,等有時(shí)間了再發(fā)表自己對(duì)此的看法。
If a 'static' data member is of 'const' integral or 'const' enumeral type,
its declaration in the class definition can specify a 'constant-initializer'
which shall be an integral constant expression (5.19). In that case, the
member can appear in integral constant expressions. The member shall still
be defined in a namespace scope if it is used in the program and the
namespace scope definition shall not contain an 'initializer'. |
|