assertion

#include <compatibility/hpx/util/assert.hpp>

#include <hpx/assertion.hpp>

Defines

HPX_ASSERT(expr)

This macro asserts that expr evaluates to true.

If

expr evaluates to false, The source location and msg is being printed along with the expression and additional. Afterwards the program is being aborted. The assertion handler can be costumized by calling hpx::assertion::set_assertion_handler().
Parameters
  • expr: The expression to assert on. This can either be an expression that’s convertible to bool or a callable which returns bool
  • msg: The optional message that is used to give further information if the assert fails. This should be convertible to a std::string

Asserts are enabled if HPX_DEBUG is set. This is the default for CMAKE_BUILD_TYPE=Debug

HPX_ASSERT_MSG(expr, msg)

See
HPX_ASSERT

namespace hpx
namespace assertion

Typedefs

using hpx::assertion::assertion_handler = typedef void (*)( source_location const& loc, const char* expr, std::string const& msg)

The signature for an assertion handler.

Functions

void set_assertion_handler(assertion_handler handler)

Set the assertion handler to be used within a program. If the handler has been set already once, the call to this function will be ignored.

Note
This function is not thread safe

#include <hpx/assertion/evaluate_assert.hpp>

#include <hpx/assertion/current_function.hpp>

Defines

HPX_ASSERT_CURRENT_FUNCTION

#include <hpx/assertion/force_linking.hpp>

namespace hpx
namespace assertion

Functions

force_linking_helper &force_linking()
struct force_linking_helper

Public Members

void (*handle_assert)(source_location const&, const char *, std::string const&)

#include <hpx/assertion/source_location.hpp>

namespace hpx
namespace assertion

Functions

std::ostream &operator<<(std::ostream &os, source_location const &loc)
struct source_location
#include <source_location.hpp>

This contains the location information where HPX_ASSERT has been called

Public Members

const char *file_name
unsigned line_number
const char *function_name