//?以下是书中的代码
template<bool>?struct?CompileTimeError;
template<>?struct?CompileTimeError<true>
{};
#define?STATIC_CHECK(expr)??\
????(CompileTimeError<?(expr)?!=?0>()?)
template<bool>?struct?CompileTimeChecker

{
????CompileTimeChecker(
);
};

template<>?struct?CompileTimeChecker<false>?
{};
#define?STATIC_CHECK_MSG(expr,?msg)?\
????
{\
????????class?ERROR_##msg?
{};\
????????(void)sizeof(CompileTimeChecker<(expr)>?(ERROR_##msg()));\
????}
//?以下是loki中的代码
namespace?Loki

{
????template<int>?struct?CompileTimeError;
????template<>?struct?CompileTimeError<true>?
{};
}
#define?STATIC_CHECK_LOKI(expr,?msg)?\

{?Loki::CompileTimeError<((expr)?!=?0)>?ERROR_##msg;?(void)ERROR_##msg;}?
int?main(int?argc,?char?*argv[])

{
????//?gcc不能编译,VC7编译通过
????STATIC_CHECK(1);
????//?gcc,VC7都不能编译
????//STATIC_CHECK_MSG(1,?Error_Msg);
????//?gcc,VC7都能编译
????STATIC_CHECK_LOKI(1,?Error_Msg);
????return?0;
}
