Skip to content

Commit

Permalink
fix bug : assign correct index (in reverse order of args) e.g first t…
Browse files Browse the repository at this point in the history
…ype is sizeof...(Types) - 1
  • Loading branch information
artemp committed Jun 17, 2014
1 parent 7296d18 commit 7eb748e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions variant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ struct select_type
};

template <std::size_t N, typename T, typename ... Types>
struct select_type<N,T,Types...>
struct select_type<N, T, Types...>
{
using type = typename select_type<N - 1, Types...>::type;
};
Expand Down Expand Up @@ -397,7 +397,7 @@ class variant
public:

VARIANT_INLINE variant()
: type_index(0)
: type_index(sizeof...(Types) - 1)
{
new (&data) typename detail::select_type<0,Types...>::type();
}
Expand Down

0 comments on commit 7eb748e

Please sign in to comment.