Skip to content

Commit

Permalink
Put tag first when deducing alias_value
Browse files Browse the repository at this point in the history
  • Loading branch information
pfultz2 committed Aug 25, 2015
1 parent f4c4b96 commit 376156c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions fit/alias.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ struct alias
};

#define FIT_DETAIL_ALIAS_GET_VALUE(ref, move) \
template<class T, class Tag, class... Ts> \
template<class Tag, class T, class... Ts> \
constexpr auto alias_value(alias<T, Tag> ref a, Ts&&...) FIT_RETURNS(move(a.value))
FIT_UNARY_PERFECT_FOREACH(FIT_DETAIL_ALIAS_GET_VALUE)

Expand All @@ -118,7 +118,7 @@ struct alias_inherit
};

#define FIT_DETAIL_ALIAS_INHERIT_GET_VALUE(ref, move) \
template<class T, class Tag, class... Ts, class=typename std::enable_if<(std::is_class<T>::value)>::type> \
template<class Tag, class T, class... Ts, class=typename std::enable_if<(std::is_class<T>::value)>::type> \
constexpr T ref alias_value(alias_inherit<T, Tag> ref a, Ts&&...) \
{ \
return move(a); \
Expand Down Expand Up @@ -150,7 +150,7 @@ struct alias_static
{}
};

template<class T, class Tag, class... Ts>
template<class Tag, class T, class... Ts>
constexpr const T& alias_value(const alias_static<T, Tag>&, Ts&&...)
{
return detail::alias_static_storage<T, Tag>::value;
Expand Down
2 changes: 1 addition & 1 deletion fit/combine.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ struct combine_adaptor_base<seq<Ns...>, F, Gs...>
operator()(Ts&&... xs) const FIT_SFINAE_MANUAL_RETURNS
(
(FIT_MANGLE_CAST(const F&)(FIT_CONST_THIS->base_function(xs...)))
(alias_value<Gs, pack_tag<seq<Ns>, Gs...>>(*FIT_CONST_THIS, xs)(fit::forward<Ts>(xs))...)
(alias_value<pack_tag<seq<Ns>, Gs...>, Gs>(*FIT_CONST_THIS, xs)(fit::forward<Ts>(xs))...)
);
};

Expand Down
4 changes: 2 additions & 2 deletions fit/pack.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ template<class T, class Tag, class X, class... Ts>
constexpr T&& pack_get(X&& x, Ts&&... xs)
{
// C style cast(rather than static_cast) is needed for gcc
return (T&&)(alias_value<T, Tag>(x, xs...));
return (T&&)(alias_value<Tag, T>(x, xs...));
}

#if (defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7) || defined(_MSC_VER)
Expand Down Expand Up @@ -234,7 +234,7 @@ struct pack_base<seq<> >
#define FIT_DETAIL_UNPACK_PACK_BASE(ref, move) \
template<class F, int... Ns, class... Ts> \
constexpr auto unpack_pack_base(F&& f, pack_base<seq<Ns...>, Ts...> ref x) \
FIT_RETURNS(f(alias_value<Ts, pack_tag<seq<Ns>, Ts...>>(move(x), f)...))
FIT_RETURNS(f(alias_value<pack_tag<seq<Ns>, Ts...>, Ts>(move(x), f)...))
FIT_UNARY_PERFECT_FOREACH(FIT_DETAIL_UNPACK_PACK_BASE)

template<class P1, class P2>
Expand Down

0 comments on commit 376156c

Please sign in to comment.