MRPT  2.0.1
Macros
xassert.h File Reference
#include <stdexcept>
Include dependency graph for xassert.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MRPT_LIKELY(EXPR)   (!!(EXPR))
 MRPT_LIKELY(): disable the branch prediction and manually setting the preference for the positive case. More...
 
#define MRPT_X_ASSERT(CHECK)   (MRPT_LIKELY(CHECK) ? void(0) : [] { throw std::runtime_error(#CHECK); }())
 MRPT_X_ASSERT(): build error if condition is known not to work at compile time, throw an exception at runtime if the condition needs to be evaluated. More...
 

Macro Definition Documentation

◆ MRPT_LIKELY

#define MRPT_LIKELY (   EXPR)    (!!(EXPR))

MRPT_LIKELY(): disable the branch prediction and manually setting the preference for the positive case.

See: https://akrzemi1.wordpress.com/2017/05/18/asserts-in-constexpr-functions

Definition at line 21 of file xassert.h.

◆ MRPT_X_ASSERT

#define MRPT_X_ASSERT (   CHECK)    (MRPT_LIKELY(CHECK) ? void(0) : [] { throw std::runtime_error(#CHECK); }())

MRPT_X_ASSERT(): build error if condition is known not to work at compile time, throw an exception at runtime if the condition needs to be evaluated.

Definition at line 27 of file xassert.h.

Referenced by foo_i_below_10(), and mrpt::typemeta::string_literal< N >::operator[]().




Page generated by Doxygen 1.8.14 for MRPT 2.0.1 Git: 0fef1a6d7 Fri Apr 3 23:00:21 2020 +0200 at vie abr 3 23:20:28 CEST 2020