|
@ -54,7 +54,7 @@ namespace gp{ |
|
|
|
|
|
|
|
|
template<typename U, std::enable_if_t<list_contains_class<gp::remove_cvref_t<U>,T...>::value,int> = 0> |
|
|
template<typename U, std::enable_if_t<list_contains_class<gp::remove_cvref_t<U>,T...>::value,int> = 0> |
|
|
fixed_variant(U&& value) |
|
|
fixed_variant(U&& value) |
|
|
: index{r_index_of<U, T...>::value} |
|
|
|
|
|
|
|
|
: index{r_index_of<gp::remove_cvref_t<U>, T...>::value} |
|
|
{ |
|
|
{ |
|
|
using actual = gp::remove_cvref_t<U>; |
|
|
using actual = gp::remove_cvref_t<U>; |
|
|
dtor = gp::function<void(void*)>([](void* thing){ |
|
|
dtor = gp::function<void(void*)>([](void* thing){ |
|
@ -140,7 +140,7 @@ namespace gp{ |
|
|
{ |
|
|
{ |
|
|
dtor((void*)buffer); |
|
|
dtor((void*)buffer); |
|
|
} |
|
|
} |
|
|
index = r_index_of<U, T...>::value; |
|
|
|
|
|
|
|
|
index = r_index_of<gp::remove_cvref_t<U>, T...>::value; |
|
|
new(buffer) U(value); |
|
|
new(buffer) U(value); |
|
|
dtor = gp::function([](void* thing){((U*)thing)->~U();}, nullopt); |
|
|
dtor = gp::function([](void* thing){((U*)thing)->~U();}, nullopt); |
|
|
cpytor = gp::function<void(void*, void*)>([](void* src, void* dest){new(dest) U(*(U*)src);}, nullopt); |
|
|
cpytor = gp::function<void(void*, void*)>([](void* src, void* dest){new(dest) U(*(U*)src);}, nullopt); |
|
@ -155,7 +155,7 @@ namespace gp{ |
|
|
dtor((void*)buffer); |
|
|
dtor((void*)buffer); |
|
|
} |
|
|
} |
|
|
new(buffer) U(gp::move(value)); |
|
|
new(buffer) U(gp::move(value)); |
|
|
index = r_index_of<U, T...>::value; |
|
|
|
|
|
|
|
|
index = r_index_of<gp::remove_cvref_t<U>, T...>::value; |
|
|
dtor = gp::function([](void* thing){((U*)thing)->~U();}, nullopt); |
|
|
dtor = gp::function([](void* thing){((U*)thing)->~U();}, nullopt); |
|
|
cpytor = gp::function<void(void*, void*)>([](void* src, void* dest){new(dest) U(*(U*)src);}, nullopt); |
|
|
cpytor = gp::function<void(void*, void*)>([](void* src, void* dest){new(dest) U(*(U*)src);}, nullopt); |
|
|
mvtor = gp::function<void(void*, void*)>([](void* src, void* dest){new(dest) U(gp::move(*(U*)src));}, nullopt); |
|
|
mvtor = gp::function<void(void*, void*)>([](void* src, void* dest){new(dest) U(gp::move(*(U*)src));}, nullopt); |
|
@ -175,7 +175,7 @@ namespace gp{ |
|
|
{ |
|
|
{ |
|
|
if constexpr (gp_config::has_exceptions) |
|
|
if constexpr (gp_config::has_exceptions) |
|
|
{ |
|
|
{ |
|
|
if(r_index_of<U, T...>::value != index) |
|
|
|
|
|
|
|
|
if(r_index_of<gp::remove_cvref_t<U>, T...>::value != index) |
|
|
{ |
|
|
{ |
|
|
throw bad_variant_access<U>{}; |
|
|
throw bad_variant_access<U>{}; |
|
|
} |
|
|
} |
|
@ -186,7 +186,7 @@ namespace gp{ |
|
|
template<typename U> |
|
|
template<typename U> |
|
|
constexpr bool is_a() |
|
|
constexpr bool is_a() |
|
|
{ |
|
|
{ |
|
|
if(r_index_of<U, T...>::value == index) |
|
|
|
|
|
|
|
|
if(r_index_of<gp::remove_cvref_t<U>, T...>::value == index) |
|
|
{ |
|
|
{ |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|