Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 09:53:05

0001 /*!
0002 @file
0003 Forward declares `boost::hana::remove_range` and `boost::hana::remove_range_c`.
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_FWD_REMOVE_RANGE_HPP
0011 #define BOOST_HANA_FWD_REMOVE_RANGE_HPP
0012 
0013 #include <boost/hana/config.hpp>
0014 #include <boost/hana/core/when.hpp>
0015 
0016 #include <cstddef>
0017 
0018 
0019 namespace boost { namespace hana {
0020     //! Remove the elements inside a given range of indices from a sequence.
0021     //! @ingroup group-Sequence
0022     //!
0023     //! `remove_range` returns a new sequence identical to the original,
0024     //! except that elements at indices in the provided range are removed.
0025     //! Specifically, `remove_range([x0, ..., xn], from, to)` is a new
0026     //! sequence equivalent to `[x0, ..., x_from-1, x_to, ..., xn]`.
0027     //!
0028     //!
0029     //! @note
0030     //! The behavior is undefined if the range contains any index out of the
0031     //! bounds of the sequence.
0032     //!
0033     //!
0034     //! @param xs
0035     //! A sequence from which elements are removed.
0036     //!
0037     //! @param [from, to)
0038     //! An half-open interval of `IntegralConstant`s representing the indices
0039     //! of the elements to be removed from the sequence. The `IntegralConstant`s
0040     //! in the half-open interval must be non-negative and in the bounds of
0041     //! the sequence. The half-open interval must also be valid, meaning that
0042     //! `from <= to`.
0043     //!
0044     //!
0045     //! Example
0046     //! -------
0047     //! @include example/remove_range.cpp
0048 #ifdef BOOST_HANA_DOXYGEN_INVOKED
0049     constexpr auto remove_range = [](auto&& xs, auto const& from, auto const& to) {
0050         return tag-dispatched;
0051     };
0052 #else
0053     template <typename S, typename = void>
0054     struct remove_range_impl : remove_range_impl<S, when<true>> { };
0055 
0056     struct remove_range_t {
0057         template <typename Xs, typename From, typename To>
0058         constexpr auto operator()(Xs&& xs, From const& from, To const& to) const;
0059     };
0060 
0061     BOOST_HANA_INLINE_VARIABLE constexpr remove_range_t remove_range{};
0062 #endif
0063 
0064     //! Equivalent to `remove_range`; provided for convenience.
0065     //! @ingroup group-Sequence
0066     //!
0067     //!
0068     //! Example
0069     //! -------
0070     //! @include example/remove_range_c.cpp
0071 #ifdef BOOST_HANA_DOXYGEN_INVOKED
0072     template <std::size_t from, std::size_t to>
0073     constexpr auto remove_range_c = [](auto&& xs) {
0074         return hana::remove_range(forwarded(xs), hana::size_c<from>, hana::size_c<to>);
0075     };
0076 #else
0077     template <std::size_t from, std::size_t to>
0078     struct remove_range_c_t;
0079 
0080     template <std::size_t from, std::size_t to>
0081     BOOST_HANA_INLINE_VARIABLE constexpr remove_range_c_t<from, to> remove_range_c{};
0082 #endif
0083 }} // end namespace boost::hana
0084 
0085 #endif // !BOOST_HANA_FWD_REMOVE_RANGE_HPP