Subversion Repositories Games.Descent

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * This file is part of the DXX-Rebirth project <https://www.dxx-rebirth.com/>.
  3.  * It is copyright by its individual contributors, as recorded in the
  4.  * project's Git history.  See COPYING.txt at the top level for license
  5.  * terms and a link to the Git history.
  6.  */
  7. #pragma once
  8.  
  9. #include <type_traits>
  10.  
  11. #define DEFINE_ASSERT_HELPER_CLASS(N,OP,STR)    \
  12.         template <typename T, T L, T R> \
  13.         class N : public std::integral_constant<bool, (L OP R)> \
  14.         {       \
  15.                 static_assert(L OP R, STR);     \
  16.         }
  17.  
  18. DEFINE_ASSERT_HELPER_CLASS(assert_equal, ==, "values must be equal");
  19. #define assert_equal(L,R,S) static_assert((assert_equal<decltype((L) + 0), (L) + 0, (R) + 0>::value), S)
  20.