Use static_assert to check types passed to macro

前端 未结 5 1530
再見小時候
再見小時候 2020-12-09 08:30

I unfortunately have several macros left over from the original version of my library that employed some pretty crazy C. In particular, I have a series of macros that expect

5条回答
  •  北海茫月
    2020-12-09 09:05

    I found this to be the cleanest, using @UncleBens suggestion:

    #include 
    
    static_assert(std::is_same::value, "retval must be bool");
    

提交回复
热议问题