From 7a541ba10d2eb9a9da0f11bb27319cd125d43a3d Mon Sep 17 00:00:00 2001 From: Shaul Fridman Date: Wed, 26 Apr 2017 16:17:59 +0300 Subject: [PATCH] recursive_wrapper fail to compile when used with 2 classes which are base and derived #146 --- include/mapbox/variant.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/mapbox/variant.hpp b/include/mapbox/variant.hpp index d7db91a..335a4be 100644 --- a/include/mapbox/variant.hpp +++ b/include/mapbox/variant.hpp @@ -170,9 +170,12 @@ template struct value_traits { using value_type = typename std::remove_const::type>::type; + using value_type_wrapper = recursive_wrapper; static constexpr type_index_t direct_index = direct_type::index; static constexpr bool is_direct = direct_index != invalid_value; - static constexpr type_index_t index = is_direct ? direct_index : convertible_type::index; + static constexpr type_index_t index_direct_or_wrapper = is_direct ? direct_index : direct_type::index; + static constexpr bool is_direct_or_wrapper = index_direct_or_wrapper != invalid_value; + static constexpr type_index_t index = is_direct_or_wrapper ? index_direct_or_wrapper : convertible_type::index; static constexpr bool is_valid = index != invalid_value; static constexpr type_index_t tindex = is_valid ? sizeof...(Types)-index : 0; using target_type = typename std::tuple_element>::type;