From 24fae0f5420c237aff3f9d7e3557d607b92c2a88 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Mon, 18 Feb 2019 20:40:17 +0200 Subject: [PATCH] Fix SFINAE conditions on emplace --- include/boost/variant2/variant.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/boost/variant2/variant.hpp b/include/boost/variant2/variant.hpp index e296d54..ad92069 100644 --- a/include/boost/variant2/variant.hpp +++ b/include/boost/variant2/variant.hpp @@ -1171,16 +1171,20 @@ public: // modifiers - template, U>, class E = typename std::enable_if::value>::type> + template, U>::value == 1 && std::is_constructible::value >::type> BOOST_CXX14_CONSTEXPR U& emplace( A&&... a ) { + using I = mp_find, U>; variant_base::template emplace( std::forward(a)... ); return _get_impl( I() ); } - template, U>, class E = typename std::enable_if&, A...>::value>::type> + template, U>::value == 1 && std::is_constructible&, A...>::value >::type> BOOST_CXX14_CONSTEXPR U& emplace( std::initializer_list il, A&&... a ) { + using I = mp_find, U>; variant_base::template emplace( il, std::forward(a)... ); return _get_impl( I() ); }