mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-30 12:37:29 +02:00
Merge pull request #201 from Kojoley/a-slightly-cleaner-n3031-workaround
A slightly cleaner N3031 workaround
This commit is contained in:
@ -24,12 +24,10 @@ namespace boost { namespace fusion
|
|||||||
struct value_at_key_impl<map_tag>
|
struct value_at_key_impl<map_tag>
|
||||||
{
|
{
|
||||||
template <typename Sequence, typename Key>
|
template <typename Sequence, typename Key>
|
||||||
struct apply
|
struct apply : BOOST_FUSION_DECLTYPE_N3031((
|
||||||
{
|
|
||||||
typedef typename BOOST_FUSION_IDENTIFIED_TYPE((
|
|
||||||
boost::declval<Sequence>().get_val(mpl::identity<Key>())
|
boost::declval<Sequence>().get_val(mpl::identity<Key>())
|
||||||
)) type;
|
))
|
||||||
};
|
{};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
@ -47,12 +47,10 @@ namespace boost { namespace fusion
|
|||||||
struct value_at_impl<vector_tag>
|
struct value_at_impl<vector_tag>
|
||||||
{
|
{
|
||||||
template <typename Sequence, typename N>
|
template <typename Sequence, typename N>
|
||||||
struct apply
|
struct apply : BOOST_FUSION_DECLTYPE_N3031((
|
||||||
{
|
|
||||||
typedef typename BOOST_FUSION_IDENTIFIED_TYPE((
|
|
||||||
vector_detail::value_at_impl<N::value>(boost::declval<Sequence*>())
|
vector_detail::value_at_impl<N::value>(boost::declval<Sequence*>())
|
||||||
)) type;
|
))
|
||||||
};
|
{};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
@ -97,17 +97,26 @@ namespace std
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Workaround for compiler which doesn't compile decltype(expr)::type.
|
// Workaround for compilers not implementing N3031 (DR743 and DR950).
|
||||||
// It expects decltype(expr) deduced as mpl::identity<T>.
|
|
||||||
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1913)) || \
|
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1913)) || \
|
||||||
BOOST_WORKAROUND(BOOST_GCC, < 40700) || \
|
BOOST_WORKAROUND(BOOST_GCC, < 40700) || \
|
||||||
defined(BOOST_CLANG) && (__clang_major__ == 3 && __clang_minor__ == 0)
|
defined(BOOST_CLANG) && (__clang_major__ == 3 && __clang_minor__ == 0)
|
||||||
|
# if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||||
|
namespace boost { namespace fusion { namespace detail
|
||||||
|
{
|
||||||
|
template <typename T>
|
||||||
|
using type_alias_t = T;
|
||||||
|
}}}
|
||||||
|
# define BOOST_FUSION_DECLTYPE_N3031(parenthesized_expr) \
|
||||||
|
boost::fusion::detail::type_alias_t<decltype parenthesized_expr>
|
||||||
|
# else
|
||||||
# include <boost/mpl/identity.hpp>
|
# include <boost/mpl/identity.hpp>
|
||||||
# define BOOST_FUSION_IDENTIFIED_TYPE(parenthesized_expr) \
|
# define BOOST_FUSION_DECLTYPE_N3031(parenthesized_expr) \
|
||||||
boost::mpl::identity<decltype parenthesized_expr>::type::type
|
boost::mpl::identity<decltype parenthesized_expr>::type
|
||||||
|
# endif
|
||||||
#else
|
#else
|
||||||
# define BOOST_FUSION_IDENTIFIED_TYPE(parenthesized_expr) \
|
# define BOOST_FUSION_DECLTYPE_N3031(parenthesized_expr) \
|
||||||
decltype parenthesized_expr ::type
|
decltype parenthesized_expr
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user