diff --git a/src/lib/variant.hpp b/src/lib/variant.hpp index ad34f0f22..05426b25e 100644 --- a/src/lib/variant.hpp +++ b/src/lib/variant.hpp @@ -118,33 +118,34 @@ namespace lib { template struct CanBuildFrom> + : std::true_type { using Type = X; }; template struct CanBuildFrom> + : std::true_type { using Type = X; }; template struct CanBuildFrom> ///< esp. allow to build string from char literal + : std::true_type { using Type = string; }; template struct CanBuildFrom> - { - using Type = typename CanBuildFrom::Type; - }; + : CanBuildFrom + { }; template struct CanBuildFrom - { - static_assert (0 > sizeof(X), "No type in Typelist can be built from the given argument"); - }; + : std::false_type + { }; @@ -398,6 +399,8 @@ namespace lib { template Variant(X&& x) { + static_assert (variant::CanBuildFrom(), "No type in Typelist can be built from the given argument"); + using StorageType = typename variant::CanBuildFrom::Type; new(storage_) Buff (forward(x));