TRIQS/TRIQS 4.0.0
Researching Interacting Quantum Systems
Loading...
Searching...
No Matches
Macros and exceptions

Detailed Description

Foundational macros, exception types and compiler/platform glue.

Classes

class  triqs::exception
 Base class for exceptions thrown in TRIQS. More...
class  triqs::keyboard_interrupt
 Exception raised when the user interrupts the program with Ctrl-C. More...
class  triqs::runtime_error
 Generic runtime error thrown in TRIQS. More...

Macros

#define TRIQS_CONCAT(X1, X2)
 Concatenate two tokens, expanding them first if they are macros.
#define TRIQS_FORTRAN_MANGLING(id)
 Translate the C++ identifier id to the corresponding Fortran symbol name.
#define TRIQS_CONCEPT_TAG_NAME(MyBeautifulConcept)
 Helper macro that produces the name of the tag for TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT.
#define TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT(MyBeautifulConcept)
 Define a tag-based pseudo-concept.
#define TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT_R_AUX(r, data, i, elem)
 Helper used by TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT_R.
#define TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT_R(MyBeautifulConcept, Rs)
 Define a tag-based pseudo-concept with refinements.
#define TRIQS_ERROR(CLASS, NAME)
 Throw an exception of type CLASS whose message starts with Triqs <NAME> and the current source location.
#define TRIQS_RUNTIME_ERROR   TRIQS_ERROR(triqs::runtime_error, "runtime error")
 Throw a triqs::runtime_error with the current source location.
#define TRIQS_KEYBOARD_INTERRUPT   TRIQS_ERROR(triqs::keyboard_interrupt, "Ctrl-C")
 Throw a triqs::keyboard_interrupt with the current source location.
#define TRIQS_ASSERT(X)
 Throw a triqs::runtime_error if the boolean expression X evaluates to false.
#define TRIQS_ASSERT2(X, ...)
 Like TRIQS_ASSERT but lets the caller add a custom message.
#define DECL_AND_RETURN(...)
 Trailing-return-type convenience: expands to -> decltype(...) { return ...; }.
#define TRIQS_CATCH_AND_ABORT
 Macro to catch exceptions, print the error message and return 1.
#define TRIQS_DEPRECATED(Message)
 Mark a function or type as deprecated with a custom message.
#define TRIQS_PRINT(X)
 Macro that prints the name and value of a variable together with the source location.
#define FORCEINLINE   __inline__ __attribute__((always_inline))
 Force-inline attribute portable across GCC and Clang.
#define TERMINATE(X)
 Macro that prints a message together with the source location and calls std::terminate().

Macro Definition Documentation

◆ TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT

#define TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT ( MyBeautifulConcept)

#include <triqs/utility/concept_tools.hpp>

Value:
struct TRIQS_CONCEPT_TAG_NAME(MyBeautifulConcept) {}; \
template <typename T> struct MyBeautifulConcept : std::is_base_of<TRIQS_CONCEPT_TAG_NAME(MyBeautifulConcept), T> {}; \
template <typename T> struct MyBeautifulConcept<const T> : MyBeautifulConcept<T> {}; \
template <typename T> struct MyBeautifulConcept<T &> : MyBeautifulConcept<T> {}; \
template <typename T> struct MyBeautifulConcept<T &&> : MyBeautifulConcept<T> {}; \
template <typename T> \
constexpr bool MyBeautifulConcept##_v = std::is_base_of<TRIQS_CONCEPT_TAG_NAME(MyBeautifulConcept), typename std::decay<T>::type>::value;
#define TRIQS_CONCEPT_TAG_NAME(MyBeautifulConcept)
Helper macro that produces the name of the tag for TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT.

Define a tag-based pseudo-concept.

It does the following:

  • Defines an empty tag struct using TRIQS_CONCEPT_TAG_NAME.
  • Defines a class template MyBeautifulConcept<T> derived from std::is_base_of<tag, T> and partial specializations that strip cv- and reference-qualifiers.
  • Defines a variable template MyBeautifulConcept_v<T> that evaluates to true if T inherits from the tag.

Definition at line 50 of file concept_tools.hpp.

◆ TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT_R

#define TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT_R ( MyBeautifulConcept,
Rs )

#include <triqs/utility/concept_tools.hpp>

Value:
struct TRIQS_CONCEPT_TAG_NAME(MyBeautifulConcept) : BOOST_PP_SEQ_FOR_EACH_I(TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT_R_AUX, nil, Rs) {}; \
template <typename T> struct MyBeautifulConcept : std::is_base_of<TRIQS_CONCEPT_TAG_NAME(MyBeautifulConcept), T> {}; \
template <typename T> struct MyBeautifulConcept<const T> : MyBeautifulConcept<T> {}; \
template <typename T> struct MyBeautifulConcept<T &> : MyBeautifulConcept<T> {}; \
template <typename T> struct MyBeautifulConcept<T &&> : MyBeautifulConcept<T> {}; \
template <typename T> \
constexpr bool MyBeautifulConcept##_v = std::is_base_of<TRIQS_CONCEPT_TAG_NAME(MyBeautifulConcept), typename std::decay<T>::type>::value;

Define a tag-based pseudo-concept with refinements.

Warning
This is unused. It might be removed in the future.

Definition at line 66 of file concept_tools.hpp.

◆ TRIQS_FORTRAN_MANGLING

#define TRIQS_FORTRAN_MANGLING ( id)

#include <triqs/utility/fortran_mangling.hpp>

Value:
id##_

Translate the C++ identifier id to the corresponding Fortran symbol name.

Warning
This is unused. It might be removed in the future.

Definition at line 33 of file fortran_mangling.hpp.