Skip to content

Instantly share code, notes, and snippets.

@EricWF
Last active January 24, 2017 15:03
Show Gist options
  • Select an option

  • Save EricWF/07ec94adfeef563da74217a246df7990 to your computer and use it in GitHub Desktop.

Select an option

Save EricWF/07ec94adfeef563da74217a246df7990 to your computer and use it in GitHub Desktop.
// C++03
template <bool Cond> void foo() { int cxx03_assertion[Cond ? 1 : -1]; }
// C++11
template <bool Cond> int foo() { static_assert(Cond, ""); return 0; }
// C++14
constexpr void foo(bool cond) { assert(cond); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment