#include <boost/static_assert.hpp> template<int N> struct is_power_of_two { enum {val = (N >= 1) & !(N & (N - 1))}; BOOST_STATIC_ASSERT(val); }; int main() { is_power_of_two<5> p; }
Standard input is empty
prog.cpp: In instantiation of ‘is_power_of_two<5>’: prog.cpp:10: instantiated from here prog.cpp:6: error: invalid application of ‘sizeof’ to incomplete type ‘boost::STATIC_ASSERTION_FAILURE<false>’ prog.cpp: In function ‘int main()’: prog.cpp:10: warning: unused variable ‘p’
Standard output is empty