Macro definitions

Defines

#define axiom_assert(expr)
 Throws an axiom failure if expr is false.
#define ENABLE_IF(X...)   typename = typename std::enable_if< ::catsfoot::eval< X >::value>::type
 Enable function definition if concept is fulfilled.
#define ENABLE_IF_NOT(X...)   typename = typename std::enable_if<!::catsfoot::eval< X >::value>::type
 Enable function definition if concept has no model.
#define IF(X...)   ::catsfoot::eval< X >::value
 Tells whether a concept is fulfilled.
#define AXIOMS(X...)
 Defines a list of axiom in a concept.
#define DEF_MEMBER_WRAPPER(X...)
 Defines a wrapper for calling a member of a class.
#define DEF_STATIC_MEMBER_WRAPPER(X...)
 Defines a wrapper for calling a static member of a class.
#define DEF_FUNCTION_WRAPPER(X...)
 Defines a function wrapper for calling a function.

Define Documentation

#define axiom_assert (   expr)
Value:
_catsfoot__test_axiom("<unknown>", \
                                  "<unknown>", \
                                  0, \
                                  expr)

Throws an axiom failure if expr is false.

#define AXIOMS (   X...)
Value:
static auto get_axioms() ->                                     \
    decltype(::catsfoot::details::zip_vec_tuple                 \
             (::catsfoot::details::split_identifiers(#X),       \
              std::make_tuple(X))) {                            \
    return ::catsfoot::details::zip_vec_tuple                   \
      (::catsfoot::details::split_identifiers(#X),              \
       std::make_tuple(X));                                     \
  }

Defines a list of axiom in a concept.

#define DEF_FUNCTION_WRAPPER (   X...)
Value:
struct function_##X {                                           \
    template <typename... U,                                    \
              typename Ret =                                    \
              decltype(X(std::declval<U>()...))>                \
    Ret operator()(U&&... u...) const {                         \
      return X(std::forward<U>(u)...);                          \
    }                                                           \
  };

Defines a function wrapper for calling a function.

#define DEF_MEMBER_WRAPPER (   X...)
Value:
struct member_##X {                                           \
    template <typename T, typename... U,                      \
              typename Ret =                                  \
              decltype(std::declval<T>()                      \
                       .X(std::declval<U>()...))>             \
    Ret operator()(T&& t, U&&... u...) const {                \
      return std::forward<T>(t).X(std::forward<U>(u)...);     \
    }                                                         \
  };

Defines a wrapper for calling a member of a class.

It can be useful for such a case:

 DEF_MEMBER_WRAPPER(foo);
 template <typename T, ENABLE_IF(callable<member_foo(T, int)>)>
  [...]
    t.foo(20);
#define DEF_STATIC_MEMBER_WRAPPER (   X...)
Value:
template <typename T>                                   \
  struct static_member_##X {                            \
    template <typename... U,                            \
              typename Ret =                            \
              decltype(T::X(std::declval<U>()...))>     \
    Ret operator()(U&&... u...) const {                 \
      return T::X(std::forward<U>(u)...);               \
    }                                                   \
  };

Defines a wrapper for calling a static member of a class.

It can be useful for such a case:

 DEF_MEMBER_WRAPPER(foo);
 template <typename T, ENABLE_IF(callable<static_member_foo<T>(int)>)>
  [...]
    T::foo(20);
#define ENABLE_IF (   X...)    typename = typename std::enable_if< ::catsfoot::eval< X >::value>::type

Enable function definition if concept is fulfilled.

It should be used in the parameter list a function template.

#define ENABLE_IF_NOT (   X...)    typename = typename std::enable_if<!::catsfoot::eval< X >::value>::type

Enable function definition if concept has no model.

It should be used in the parameter list a function template.

#define IF (   X...)    ::catsfoot::eval< X >::value

Tells whether a concept is fulfilled.

It makes a constant expression of type bool.