Skip to content

Commit

Permalink
Merge branch '111-which-constexpr'
Browse files Browse the repository at this point in the history
  • Loading branch information
artemp committed Jun 1, 2016
2 parents 48d6044 + dca3d96 commit bb8c2d2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/mapbox/variant.hpp
Expand Up @@ -751,6 +751,13 @@ class variant
return static_cast<int>(sizeof...(Types)-type_index - 1);
}

template <typename T, typename std::enable_if<
(detail::direct_type<T, Types...>::index != detail::invalid_value)>::type* = nullptr>
VARIANT_INLINE static constexpr int which() noexcept
{
return static_cast<int>(sizeof...(Types)-detail::direct_type<T, Types...>::index - 1);
}

// visitor
// unary
template <typename F, typename V, typename R = typename detail::result_of_unary_visit<F, first_type>::type>
Expand Down

0 comments on commit bb8c2d2

Please sign in to comment.