BOOST_STATIC_ASSERT without boost

前端 未结 6 1208

Since boost is forbidden in a company I work for I need to implement its functionality in pure C++. I\'ve looked into boost sources but they seem to be too complex to unders

6条回答
  •  忘掉有多难
    2020-11-30 03:04

    template struct StaticAssert;
    template<> struct StaticAssert {};
    
    int main() {
       StaticAssert< (4>3) >(); //OK
       StaticAssert< (2+2==5) >(); //ERROR
    }
    

提交回复
热议问题