codex
Loading...
Searching...
No Matches
c_wrapper.hpp
Go to the documentation of this file.
1#ifndef CODEX_C_WRAPPER_H
2#define CODEX_C_WRAPPER_H
3
4#include <cassert>
5#include <utility>
6
7namespace codex {
8
12template<auto F> struct CWrapper;
13
17template<typename T, typename R, typename ...Args, R (T::*f)(Args...)>
18struct CWrapper<f> {
19 static R wrapper(void *p, Args ...args) {
20 assert(p);
21 return (static_cast<T*>(p)->*f)(std::forward<Args>(args)...);
22 }
23 (*operator R())(void*, Args...) { return &CWrapper::wrapper; }
24};
25
26}
27
28#endif
#define f(x)
Definition 5.c:2
#define T(f, T, C)
Definition bench.cpp:136
#define R(i, c, t0, t1, t2, t3, t4, t5, t6, t7)
Definition chess0.c:55
Definition rotate.hpp:6
codex::refl::field_tuple_t< E > T
Definition soa.cpp:9
#define p()
Definition std2.c:11
static R wrapper(void *p, Args ...args)
Definition c_wrapper.hpp:19
Wrapper for C-style void* + function pointer pair.
Definition c_wrapper.hpp:12