17 Callback(
void* self,
void (*callback)(
void* self, Args... args)) : self(self), callback(callback) {}
19 explicit Callback(
void* (*callback)(Args... args)) : self(
nullptr), callback((
void (*)(
void*, Args...))callback) {}
21 operator bool()
const {
return callback !=
nullptr; }
22 void operator()(Args... args)
const {
if (callback) callback(self, args...); }
23 void clear() { callback =
nullptr; self =
nullptr; }
24 bool operator==(
const Callback& other)
const {
return self == other.self && callback == other.callback; }
25 bool operator!=(
const Callback& other)
const {
return !(*
this == other); }
26 Callback& operator=(
const Callback& other) { self = other.self; callback = other.callback;
return *
this; }
27 Callback& operator=(
void* (*other)(Args... args)) { self =
nullptr; callback = (void (*)(
void*, Args...))other;
return *
this; }
28 Callback& operator=(
void (*other)(
void* self, Args... args)) { self =
nullptr; callback = other;
return *
this; }
30 bool operator<(
const Callback& other)
const {
return self < other.self || (self == other.self && callback < other.callback); }
33 void (*callback)(
void* self, Args... args) =
nullptr;