C
christopher diggins
I just wanted to share a static_assert meta-function, and see if anyone had
any comments. I was looking for a simpler alternative to the big old BOOST
one which is overkill for my purposes (see :
http://www.ootl.org/boost/static_assert.hpp.htm )
template<bool b>
struct static_assert {
};
template<>
struct static_assert<false> {
private:
static_assert();
};
int main() {
static_assert<true>();
static_assert<2 + 2 == 4>();
static_assert<2 + 2 == 3>();
return 0;
}
Any comments?
any comments. I was looking for a simpler alternative to the big old BOOST
one which is overkill for my purposes (see :
http://www.ootl.org/boost/static_assert.hpp.htm )
template<bool b>
struct static_assert {
};
template<>
struct static_assert<false> {
private:
static_assert();
};
int main() {
static_assert<true>();
static_assert<2 + 2 == 4>();
static_assert<2 + 2 == 3>();
return 0;
}
Any comments?