Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:38:02

0001 /*!
0002 @file
0003 Defines `boost::hana::drop_front`.
0004 
0005 Copyright Louis Dionne 2013-2022
0006 Distributed under the Boost Software License, Version 1.0.
0007 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
0008  */
0009 
0010 #ifndef BOOST_HANA_DROP_FRONT_HPP
0011 #define BOOST_HANA_DROP_FRONT_HPP
0012 
0013 #include <boost/hana/fwd/drop_front.hpp>
0014 
0015 #include <boost/hana/concept/integral_constant.hpp>
0016 #include <boost/hana/concept/iterable.hpp>
0017 #include <boost/hana/config.hpp>
0018 #include <boost/hana/core/dispatch.hpp>
0019 #include <boost/hana/core/tag_of.hpp>
0020 #include <boost/hana/integral_constant.hpp>
0021 
0022 
0023 namespace boost { namespace hana {
0024     //! @cond
0025     template <typename Xs, typename N>
0026     constexpr auto drop_front_t::operator()(Xs&& xs, N const& n) const {
0027         using It = typename hana::tag_of<Xs>::type;
0028         using DropFront = BOOST_HANA_DISPATCH_IF(drop_front_impl<It>,
0029             hana::Iterable<It>::value &&
0030             hana::IntegralConstant<N>::value
0031         );
0032 
0033     #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS
0034         static_assert(hana::Iterable<It>::value,
0035         "hana::drop_front(xs, n) requires 'xs' to be an Iterable");
0036 
0037         static_assert(hana::IntegralConstant<N>::value,
0038         "hana::drop_front(xs, n) requires 'n' to be an IntegralConstant");
0039     #endif
0040 
0041         return DropFront::apply(static_cast<Xs&&>(xs), n);
0042     }
0043 
0044     template <typename Xs>
0045     constexpr auto drop_front_t::operator()(Xs&& xs) const {
0046         return (*this)(static_cast<Xs&&>(xs), hana::size_t<1>{});
0047     }
0048     //! @endcond
0049 
0050     template <typename It, bool condition>
0051     struct drop_front_impl<It, when<condition>> : default_ {
0052         template <typename Xs, typename N>
0053         static constexpr auto apply(Xs&&, N const&) = delete;
0054     };
0055 }} // end namespace boost::hana
0056 
0057 #endif // !BOOST_HANA_DROP_FRONT_HPP