Christof Meerwald@freec++.prog | |||||
Static AssertionsSee Proposal to Add Static Assertions to the Core (Revision 3) template<class T> struct A { static const int val = sizeof(T); static_assert(val != 0, "message"); }; static_assert(true, "message"); namespace ns { static_assert(1 + 1 == 2, "message"); } struct B { static_assert(true, "message"); }; int main() { static_assert(A<char>::val == sizeof(char), "message"); return 0; } | |||||
This Web page is licensed under the Creative Commons Attribution - NonCommercial - Share Alike License. Any use is subject to the Privacy Policy.
Revision: 1.2, cmeerw.org/prog/freecpp/static_assertions.html Last modified: Mon Sep 03 18:20:50 2018 |
Christof Meerwald <cmeerw@cmeerw.org> XMPP: cmeerw@cmeerw.org |