diff --git a/include/gp/variant.hpp b/include/gp/variant.hpp index afbfab4..8fe9986 100644 --- a/include/gp/variant.hpp +++ b/include/gp/variant.hpp @@ -18,7 +18,7 @@ namespace gp{ class fixed_variant{ std::size_t index = std::numeric_limits::max(); char buffer[max_size()]; - gp::function dtor = [](void*){}; + gp::function dtor = [](void*){}; static_assert(all_of_fixed_size::value, "not fixed"); public: template::value,int>::type> @@ -26,7 +26,7 @@ namespace gp{ : index{r_index_of::value} { new(buffer) U(value); - dtor = gp::function([](void* thing){((U*)thing)->~U();}); + dtor = gp::function([](void* thing){((U*)thing)->~U();}); } template::value,int>::type> @@ -34,10 +34,17 @@ namespace gp{ : index{r_index_of::value} { new(buffer) U(std::move(value)); - dtor = gp::function([](void* thing){((U*)thing)->~U();}); + dtor = gp::function([](void* thing){((U*)thing)->~U();}); } + template + constexpr size_t alt() const { + return r_index_of::value; + } + size_t type() const { + return index; + } template::value,int>::type> void operator=(U& value)