/*! @file Adapts `boost::fusion::list` for use with Hana. @copyright Louis Dionne 2013-2016 Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_HANA_EXT_BOOST_FUSION_LIST_HPP #define BOOST_HANA_EXT_BOOST_FUSION_LIST_HPP #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef BOOST_HANA_DOXYGEN_INVOKED namespace boost { namespace fusion { //! @ingroup group-ext-fusion //! Adapter for Boost.Fusion lists. //! //! //! Modeled concepts //! ---------------- //! A Fusion list is a model of the `Sequence` concept, and all the //! concepts it refines. That makes it essentially the same as a Hana //! tuple, although the complexity of some operations might differ from //! that of a tuple. //! //! @include example/ext/boost/fusion/list.cpp template struct list { }; }} #endif BOOST_HANA_NAMESPACE_BEGIN namespace ext { namespace boost { namespace fusion { struct list_tag; }}} template struct tag_of::type, ::boost::fusion::traits::tag_of< ::boost::fusion::list<> >::type >::value >> { using type = ext::boost::fusion::list_tag; }; namespace detail { template <> struct is_fusion_sequence { static constexpr bool value = true; }; } ////////////////////////////////////////////////////////////////////////// // Iterable (the rest is in detail/common.hpp) ////////////////////////////////////////////////////////////////////////// template <> struct drop_front_impl { template static constexpr auto drop_front_helper(Xs&& xs, std::index_sequence) { return hana::make( hana::at_c(static_cast(xs))... ); } template static constexpr auto apply(Xs&& xs, N const&) { constexpr std::size_t n = N::value; constexpr std::size_t len = decltype(hana::length(xs))::value; return drop_front_helper(static_cast(xs), std::make_index_sequence<(n < len ? len - n : 0)>{}); } }; ////////////////////////////////////////////////////////////////////////// // Sequence ////////////////////////////////////////////////////////////////////////// template <> struct make_impl { template static constexpr auto apply(Xs&& ...xs) { return ::boost::fusion::make_list(static_cast(xs)...); } }; BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_EXT_BOOST_FUSION_LIST_HPP