mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-01-23 20:46:37 +00:00
fix tuple constrution: SFINAE bug (for GCC4.7.0)
This commit is contained in:
parent
3f434dd7e1
commit
d7561c95dd
2 changed files with 102 additions and 26 deletions
|
@ -13,38 +13,70 @@ namespace sprout {
|
|||
// tuple
|
||||
//
|
||||
// tuple construction
|
||||
// template<typename... Types>
|
||||
// template<
|
||||
// typename... UTypes,
|
||||
// typename
|
||||
// >
|
||||
// inline SPROUT_CONSTEXPR sprout::tuples::tuple<Types...>::tuple(sprout::pair<UTypes...> const& t)
|
||||
// : impl_type(t.first, t.second)
|
||||
// {}
|
||||
// template<typename... Types>
|
||||
// template<
|
||||
// typename... UTypes,
|
||||
// typename
|
||||
// >
|
||||
// inline SPROUT_CONSTEXPR sprout::tuples::tuple<Types...>::tuple(sprout::pair<UTypes...>&& t)
|
||||
// : impl_type(sprout::forward<typename sprout::pair<UTypes...>::first_type>(t.first), sprout::forward<typename sprout::pair<UTypes...>::second_type>(t.second))
|
||||
// {}
|
||||
template<typename... Types>
|
||||
template<
|
||||
typename... UTypes,
|
||||
typename UType1, typename UType2,
|
||||
typename
|
||||
>
|
||||
inline SPROUT_CONSTEXPR sprout::tuples::tuple<Types...>::tuple(sprout::pair<UTypes...> const& t)
|
||||
inline SPROUT_CONSTEXPR sprout::tuples::tuple<Types...>::tuple(sprout::pair<UType1, UType2> const& t)
|
||||
: impl_type(t.first, t.second)
|
||||
{}
|
||||
template<typename... Types>
|
||||
template<
|
||||
typename... UTypes,
|
||||
typename UType1, typename UType2,
|
||||
typename
|
||||
>
|
||||
inline SPROUT_CONSTEXPR sprout::tuples::tuple<Types...>::tuple(sprout::pair<UTypes...>&& t)
|
||||
: impl_type(sprout::forward<typename sprout::pair<UTypes...>::first_type>(t.first), sprout::forward<typename sprout::pair<UTypes...>::second_type>(t.second))
|
||||
inline SPROUT_CONSTEXPR sprout::tuples::tuple<Types...>::tuple(sprout::pair<UType1, UType2>&& t)
|
||||
: impl_type(sprout::forward<typename sprout::pair<UType1, UType2>::first_type>(t.first), sprout::forward<typename sprout::pair<UType1, UType2>::second_type>(t.second))
|
||||
{}
|
||||
|
||||
// template<typename... Types>
|
||||
// template<
|
||||
// typename... UTypes,
|
||||
// typename
|
||||
// >
|
||||
// inline SPROUT_CONSTEXPR sprout::tuples::tuple<Types...>::tuple(sprout::tuples::flexibly_construct_t, sprout::pair<UTypes...> const& t)
|
||||
// : impl_type(t.first, t.second)
|
||||
// {}
|
||||
// template<typename... Types>
|
||||
// template<
|
||||
// typename... UTypes,
|
||||
// typename
|
||||
// >
|
||||
// inline SPROUT_CONSTEXPR sprout::tuples::tuple<Types...>::tuple(sprout::tuples::flexibly_construct_t, sprout::pair<UTypes...>&& t)
|
||||
// : impl_type(sprout::forward<typename sprout::pair<UTypes...>::first_type>(t.first), sprout::forward<typename sprout::pair<UTypes...>::second_type>(t.second))
|
||||
// {}
|
||||
template<typename... Types>
|
||||
template<
|
||||
typename... UTypes,
|
||||
typename UType1, typename UType2,
|
||||
typename
|
||||
>
|
||||
inline SPROUT_CONSTEXPR sprout::tuples::tuple<Types...>::tuple(sprout::tuples::flexibly_construct_t, sprout::pair<UTypes...> const& t)
|
||||
inline SPROUT_CONSTEXPR sprout::tuples::tuple<Types...>::tuple(sprout::tuples::flexibly_construct_t, sprout::pair<UType1, UType2> const& t)
|
||||
: impl_type(t.first, t.second)
|
||||
{}
|
||||
template<typename... Types>
|
||||
template<
|
||||
typename... UTypes,
|
||||
typename UType1, typename UType2,
|
||||
typename
|
||||
>
|
||||
inline SPROUT_CONSTEXPR sprout::tuples::tuple<Types...>::tuple(sprout::tuples::flexibly_construct_t, sprout::pair<UTypes...>&& t)
|
||||
: impl_type(sprout::forward<typename sprout::pair<UTypes...>::first_type>(t.first), sprout::forward<typename sprout::pair<UTypes...>::second_type>(t.second))
|
||||
inline SPROUT_CONSTEXPR sprout::tuples::tuple<Types...>::tuple(sprout::tuples::flexibly_construct_t, sprout::pair<UType1, UType2>&& t)
|
||||
: impl_type(sprout::forward<typename sprout::pair<UType1, UType2>::first_type>(t.first), sprout::forward<typename sprout::pair<UType1, UType2>::second_type>(t.second))
|
||||
{}
|
||||
} // namespace tuples
|
||||
} // namespace sprout
|
||||
|
|
|
@ -271,6 +271,22 @@ namespace sprout {
|
|||
struct is_clvref_flexibly_convert_constructible
|
||||
: public is_flexibly_convert_constructible<UTypes const&...>
|
||||
{};
|
||||
|
||||
template<typename... UTypes>
|
||||
struct is_fixedly_convert_constructible
|
||||
: public std::integral_constant<
|
||||
bool,
|
||||
(sizeof...(UTypes) == sizeof...(Types) && is_flexibly_convert_constructible<UTypes...>::value)
|
||||
>
|
||||
{};
|
||||
template<typename... UTypes>
|
||||
struct is_rvref_fixedly_convert_constructible
|
||||
: public is_fixedly_convert_constructible<UTypes&&...>
|
||||
{};
|
||||
template<typename... UTypes>
|
||||
struct is_clvref_fixedly_convert_constructible
|
||||
: public is_fixedly_convert_constructible<UTypes const&...>
|
||||
{};
|
||||
public:
|
||||
// tuple construction
|
||||
SPROUT_CONSTEXPR tuple()
|
||||
|
@ -308,20 +324,34 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR tuple(sprout::tuples::tuple<UTypes...>&& t)
|
||||
: impl_type(static_cast<sprout::tuples::detail::tuple_impl<0, UTypes...>&&>(t))
|
||||
{}
|
||||
// template<
|
||||
// typename... UTypes,
|
||||
// typename = typename std::enable_if<
|
||||
// sizeof...(Types) == 2 && sprout::tpp::all_of<sprout::is_convert_constructible<Types, UTypes const&>...>::value
|
||||
// >::type
|
||||
// >
|
||||
// SPROUT_CONSTEXPR tuple(sprout::pair<UTypes...> const& t);
|
||||
// template<
|
||||
// typename... UTypes,
|
||||
// typename = typename std::enable_if<
|
||||
// sizeof...(Types) == 2 && sprout::tpp::all_of<sprout::is_convert_constructible<Types, UTypes&&>...>::value
|
||||
// >::type
|
||||
// >
|
||||
// SPROUT_CONSTEXPR tuple(sprout::pair<UTypes...>&& t);
|
||||
template<
|
||||
typename... UTypes,
|
||||
typename UType1, typename UType2,
|
||||
typename = typename std::enable_if<
|
||||
sizeof...(Types) == 2 && sprout::tpp::all_of<sprout::is_convert_constructible<Types, UTypes&&>...>::value
|
||||
is_clvref_fixedly_convert_constructible<UType1, UType2>::value
|
||||
>::type
|
||||
>
|
||||
SPROUT_CONSTEXPR tuple(sprout::pair<UTypes...> const& t);
|
||||
SPROUT_CONSTEXPR tuple(sprout::pair<UType1, UType2> const& t);
|
||||
template<
|
||||
typename... UTypes,
|
||||
typename UType1, typename UType2,
|
||||
typename = typename std::enable_if<
|
||||
sizeof...(Types) == 2 && sprout::tpp::all_of<sprout::is_convert_constructible<Types, UTypes&&>...>::value
|
||||
is_rvref_fixedly_convert_constructible<UType1, UType2>::value
|
||||
>::type
|
||||
>
|
||||
SPROUT_CONSTEXPR tuple(sprout::pair<UTypes...>&& t);
|
||||
SPROUT_CONSTEXPR tuple(sprout::pair<UType1, UType2>&& t);
|
||||
|
||||
template<
|
||||
typename... UTypes,
|
||||
|
@ -350,20 +380,34 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, sprout::tuples::tuple<UTypes...>&& t)
|
||||
: impl_type(static_cast<sprout::tuples::detail::tuple_impl<0, UTypes...>&&>(t))
|
||||
{}
|
||||
// template<
|
||||
// typename... UTypes,
|
||||
// typename = typename std::enable_if<
|
||||
// is_clvref_flexibly_convert_constructible<UTypes...>::value
|
||||
// >::type
|
||||
// >
|
||||
// SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, sprout::pair<UTypes...> const& t);
|
||||
// template<
|
||||
// typename... UTypes,
|
||||
// typename = typename std::enable_if<
|
||||
// is_rvref_flexibly_convert_constructible<UTypes...>::value
|
||||
// >::type
|
||||
// >
|
||||
// SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, sprout::pair<UTypes...>&& t);
|
||||
template<
|
||||
typename... UTypes,
|
||||
typename UType1, typename UType2,
|
||||
typename = typename std::enable_if<
|
||||
is_clvref_flexibly_convert_constructible<UTypes...>::value
|
||||
is_clvref_flexibly_convert_constructible<UType1, UType2>::value
|
||||
>::type
|
||||
>
|
||||
SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, sprout::pair<UTypes...> const& t);
|
||||
SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, sprout::pair<UType1, UType2> const& t);
|
||||
template<
|
||||
typename... UTypes,
|
||||
typename UType1, typename UType2,
|
||||
typename = typename std::enable_if<
|
||||
is_rvref_flexibly_convert_constructible<UTypes...>::value
|
||||
is_rvref_flexibly_convert_constructible<UType1, UType2>::value
|
||||
>::type
|
||||
>
|
||||
SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, sprout::pair<UTypes...>&& t);
|
||||
SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, sprout::pair<UType1, UType2>&& t);
|
||||
// tuple assignment
|
||||
tuple& operator=(tuple const& rhs) {
|
||||
static_cast<impl_type&>(*this) = rhs;
|
||||
|
@ -415,10 +459,10 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, sprout::tuples::tuple<UTypes...> const& t) {}
|
||||
template<typename... UTypes>
|
||||
SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, sprout::tuples::tuple<UTypes...>&& t) {}
|
||||
template<typename... UTypes>
|
||||
SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, sprout::pair<UTypes...> const& t) {}
|
||||
template<typename... UTypes>
|
||||
SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, sprout::pair<UTypes...>&& t) {}
|
||||
template<typename UType1, typename UType2>
|
||||
SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, sprout::pair<UType1, UType2> const& t) {}
|
||||
template<typename UType1, typename UType2>
|
||||
SPROUT_CONSTEXPR tuple(sprout::tuples::flexibly_construct_t, sprout::pair<UType1, UType2>&& t) {}
|
||||
// tuple swap
|
||||
void swap(tuple&) SPROUT_NOEXCEPT {}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue