3 Forward declares `boost::hana::remove_range` and `boost::hana::remove_range_c`.
5 @copyright Louis Dionne 2013-2016
6 Distributed under the Boost Software License, Version 1.0.
7 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
10 #ifndef BOOST_HANA_FWD_REMOVE_RANGE_HPP
11 #define BOOST_HANA_FWD_REMOVE_RANGE_HPP
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
19 BOOST_HANA_NAMESPACE_BEGIN
20 //! Remove the elements inside a given range of indices from a sequence.
21 //! @ingroup group-Sequence
23 //! `remove_range` returns a new sequence identical to the original,
24 //! except that elements at indices in the provided range are removed.
25 //! Specifically, `remove_range([x0, ..., xn], from, to)` is a new
26 //! sequence equivalent to `[x0, ..., x_from-1, x_to, ..., xn]`.
30 //! The behavior is undefined if the range contains any index out of the
31 //! bounds of the sequence.
35 //! A sequence from which elements are removed.
38 //! An half-open interval of `IntegralConstant`s representing the indices
39 //! of the elements to be removed from the sequence. The `IntegralConstant`s
40 //! in the half-open interval must be non-negative and in the bounds of
41 //! the sequence. The half-open interval must also be valid, meaning that
47 //! @include example/remove_range.cpp
48 #ifdef BOOST_HANA_DOXYGEN_INVOKED
49 constexpr auto remove_range = [](auto&& xs, auto const& from, auto const& to) {
50 return tag-dispatched;
53 template <typename S, typename = void>
54 struct remove_range_impl : remove_range_impl<S, when<true>> { };
56 struct remove_range_t {
57 template <typename Xs, typename From, typename To>
58 constexpr auto operator()(Xs&& xs, From const& from, To const& to) const;
61 constexpr remove_range_t remove_range{};
64 //! Equivalent to `remove_range`; provided for convenience.
65 //! @ingroup group-Sequence
70 //! @include example/remove_range_c.cpp
71 #ifdef BOOST_HANA_DOXYGEN_INVOKED
72 template <std::size_t from, std::size_t to>
73 constexpr auto remove_range_c = [](auto&& xs) {
74 return hana::remove_range(forwarded(xs), hana::size_c<from>, hana::size_c<to>);
77 template <std::size_t from, std::size_t to>
78 struct remove_range_c_t;
80 template <std::size_t from, std::size_t to>
81 constexpr remove_range_c_t<from, to> remove_range_c{};
83 BOOST_HANA_NAMESPACE_END
85 #endif // !BOOST_HANA_FWD_REMOVE_RANGE_HPP