在类里面使用enum作为常量,可以使得节省由static const int占用的内存资源.
而且不会因此因此污染名字空间.
下面是该文章的源代码的部分截取:


template< typename T, bool native >
endian
{
public:
enum CODE
{
NATIVE = native,
#if defined __POWERPC__ || defined

ENDIAN = false,
#endif
#if defined __INTEL__ || defined __WIN32 ||

ENDIAN = true,
#endif
BIG = !ENDIAN
};
}