15 lines
334 B
C++
15 lines
334 B
C++
|
#pragma once
|
||
|
|
||
|
template <typename> struct CCallback_;
|
||
|
template <typename F, typename R, typename... Ts>
|
||
|
struct CCallback_<R (F::*) (Ts...) const>
|
||
|
{
|
||
|
static R invoke(Ts... args, void* u)
|
||
|
{
|
||
|
return (*reinterpret_cast<F*>(u))(args...);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
template <typename F>
|
||
|
using CCallback = CCallback_<decltype(&F::operator())>;
|