Skip to content

Commit

Permalink
recursive_wrapper fail to compile when used with 2 classes which are …
Browse files Browse the repository at this point in the history
…base and derived #146
  • Loading branch information
BlueSolei committed Apr 26, 2017
1 parent 291121f commit 7a541ba
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion include/mapbox/variant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,12 @@ template <typename T, typename... Types>
struct value_traits
{
using value_type = typename std::remove_const<typename std::remove_reference<T>::type>::type;
using value_type_wrapper = recursive_wrapper<value_type>;
static constexpr type_index_t direct_index = direct_type<value_type, Types...>::index;
static constexpr bool is_direct = direct_index != invalid_value;
static constexpr type_index_t index = is_direct ? direct_index : convertible_type<value_type, Types...>::index;
static constexpr type_index_t index_direct_or_wrapper = is_direct ? direct_index : direct_type<value_type_wrapper, Types...>::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<value_type, Types...>::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<tindex, std::tuple<void, Types...>>::type;
Expand Down

0 comments on commit 7a541ba

Please sign in to comment.