mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-24 17:47:15 +02:00
Merge pull request #198 from Kojoley/vector-simplify-at_impl
vector: Simplify at_impl
This commit is contained in:
@ -168,9 +168,15 @@ namespace boost { namespace fusion
|
|||||||
: elem(std::forward<U>(rhs))
|
: elem(std::forward<U>(rhs))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
using elem_type = T;
|
||||||
T elem;
|
T elem;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// placed outside of vector_data due to GCC < 6 bug
|
||||||
|
template <std::size_t J, typename U>
|
||||||
|
static inline BOOST_FUSION_GPU_ENABLED
|
||||||
|
store<J, U> store_at_impl(store<J, U>*);
|
||||||
|
|
||||||
template <typename I, typename ...T>
|
template <typename I, typename ...T>
|
||||||
struct vector_data;
|
struct vector_data;
|
||||||
|
|
||||||
@ -231,32 +237,23 @@ namespace boost { namespace fusion
|
|||||||
assign(std::forward<Sequence>(seq), detail::index_sequence<M...>());
|
assign(std::forward<Sequence>(seq), detail::index_sequence<M...>());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <std::size_t N, typename U>
|
private:
|
||||||
static BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
template <std::size_t J>
|
||||||
U& at_detail(store<N, U>* this_)
|
using store_at = decltype(store_at_impl<J>(static_cast<vector_data*>(nullptr)));
|
||||||
{
|
|
||||||
return this_->elem;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <std::size_t N, typename U>
|
|
||||||
static BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
|
||||||
U const& at_detail(store<N, U> const* this_)
|
|
||||||
{
|
|
||||||
return this_->elem;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public:
|
||||||
template <typename J>
|
template <typename J>
|
||||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||||
auto at_impl(J) -> decltype(at_detail<J::value>(&std::declval<vector_data&>()))
|
typename store_at<J::value>::elem_type& at_impl(J)
|
||||||
{
|
{
|
||||||
return at_detail<J::value>(this);
|
return store_at<J::value>::elem;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename J>
|
template <typename J>
|
||||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||||
auto at_impl(J) const -> decltype(at_detail<J::value>(&std::declval<vector_data const&>()))
|
typename store_at<J::value>::elem_type const& at_impl(J) const
|
||||||
{
|
{
|
||||||
return at_detail<J::value>(this);
|
return store_at<J::value>::elem;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} // namespace boost::fusion::vector_detail
|
} // namespace boost::fusion::vector_detail
|
||||||
|
Reference in New Issue
Block a user