CellModules
introspect.hpp File Reference
#include <cxxabi.h>
#include <functional>
#include <iostream>
#include <string>
#include <typeinfo>
#include <utility>

Go to the source code of this file.

Classes

struct  MecaCell::make_void< Ts >
 
struct  debug_type< T >
 

Namespaces

namespace  MecaCell
 this file contains various miscellanious utility functions & helpers *
 

Macros

#define DEBUG_TYPE(x)
 
#define CREATE_METHOD_CHECKS(method)
 

Typedefs

template<typename... Ts>
using MecaCell::void_t = typename make_void< Ts... >::type
 

Macro Definition Documentation

◆ CREATE_METHOD_CHECKS

#define CREATE_METHOD_CHECKS (   method)
Value:
/* checks if Class C has a method callable using the given signature */ \
template <typename C, typename F> struct is_##method##_callable {}; \
template <typename C, typename Ret, typename... Args> \
struct is_##method##_callable<C, Ret(Args...)> { \
template <typename T> static constexpr bool is(...) { return false; } \
template <typename T> \
static constexpr bool is( \
typename std::is_same< \
Ret, decltype(std::declval<T>().method(std::declval<Args...>()))>::type *) { \
return true; \
} \
static constexpr bool value = is<C>(nullptr); \
}; \
/* checks if Class C has a method with the exact given signature */ \
template <typename C, typename F> struct has_##method##_signature {}; \
template <typename C, typename Ret, typename... Args> \
struct has_##method##_signature<C, Ret(Args...)> { \
using SIG = Ret (C::*)(Args...); \
template <typename T, T> struct same; \
template <typename T> \
static constexpr auto has(same<SIG, &T::method> *) -> typename std::true_type::type; \
template <typename T> \
static constexpr auto has(...) -> typename std::false_type::type; \
static constexpr bool value = decltype(has<C>(0))::value; \
}

Definition at line 38 of file introspect.hpp.

◆ DEBUG_TYPE

#define DEBUG_TYPE (   x)
Value:
do { \
typedef void(*T) x; \
debug_type<T>(T(), #x); \
} while (0)

Definition at line 16 of file introspect.hpp.