Here's a little tidbit from my new book (Modern C++ design,
forward) that made me laugh out loud. Not a "ha ha" funny laugh, but more so a "You're not supposed to use templates like that! This author must be insane!" laugh.
Template<bool> struct CTAssert;
Template<> struct CTAssert<true>{};
// ex. usage
foo() {
// COMPILE time assertion!
CTAssert<sizeof(int) == 4> foo;
}
No comments:
Post a Comment