|
@ -30,6 +30,7 @@ namespace gp{ |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// tweak a way to store a size in there for trivial copy
|
|
|
enum state_t : uint8_t{ |
|
|
enum state_t : uint8_t{ |
|
|
INACTIVE = 0, |
|
|
INACTIVE = 0, |
|
|
ACTIVE = 1, |
|
|
ACTIVE = 1, |
|
@ -51,7 +52,7 @@ namespace gp{ |
|
|
{ |
|
|
{ |
|
|
if(state & SOO) |
|
|
if(state & SOO) |
|
|
{ |
|
|
{ |
|
|
((virtual_callable*)o">&self)->~virtual_callable(); |
|
|
|
|
|
|
|
|
((virtual_callable*)n">self.inplace)->~virtual_callable(); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -60,12 +61,12 @@ namespace gp{ |
|
|
} |
|
|
} |
|
|
if constexpr (sizeof(callable<T>) <= sizeof(self)) |
|
|
if constexpr (sizeof(callable<T>) <= sizeof(self)) |
|
|
{ |
|
|
{ |
|
|
new((void*)o">&self) callable(t); |
|
|
|
|
|
|
|
|
new((void*)n">self.inplace) callable(t); |
|
|
state = (state_t)(ACTIVE | SOO); |
|
|
state = (state_t)(ACTIVE | SOO); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
self = new callable(t); |
|
|
|
|
|
|
|
|
self.functor = new callable<T>(t); |
|
|
state = (state_t)(ACTIVE | NO_SOO); |
|
|
state = (state_t)(ACTIVE | NO_SOO); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -80,12 +81,12 @@ namespace gp{ |
|
|
{ |
|
|
{ |
|
|
if constexpr (sizeof(callable<T>) <= sizeof(self)) |
|
|
if constexpr (sizeof(callable<T>) <= sizeof(self)) |
|
|
{ |
|
|
{ |
|
|
new((void*)o">&self) callable<T>(t); |
|
|
|
|
|
|
|
|
new((void*)n">self.inplace) callable<T>(t); |
|
|
state = (state_t)(ACTIVE | SOO); |
|
|
state = (state_t)(ACTIVE | SOO); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
self = new callable<T>(t); |
|
|
|
|
|
|
|
|
self.functor = new callable<T>(t); |
|
|
state = (state_t)(ACTIVE | NO_SOO); |
|
|
state = (state_t)(ACTIVE | NO_SOO); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -119,7 +120,7 @@ namespace gp{ |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
return (*p">(self.functor))(arg_list...); |
|
|
|
|
|
|
|
|
return (*self.functor)(arg_list...); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|