]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/include/boost/hana/fwd/remove_at.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / hana / include / boost / hana / fwd / remove_at.hpp
1 /*!
2 @file
3 Forward declares `boost::hana::remove_at` and `boost::hana::remove_at_c`.
4
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)
8 */
9
10 #ifndef BOOST_HANA_FWD_REMOVE_AT_HPP
11 #define BOOST_HANA_FWD_REMOVE_AT_HPP
12
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
15
16 #include <cstddef>
17
18
19 BOOST_HANA_NAMESPACE_BEGIN
20 //! Remove the element at a given index from a sequence.
21 //! @ingroup group-Sequence
22 //!
23 //! `remove_at` returns a new sequence identical to the original, except
24 //! that the element at the given index is removed. Specifically,
25 //! `remove_at([x0, ..., xn-1, xn, xn+1, ..., xm], n)` is a new
26 //! sequence equivalent to `[x0, ..., xn-1, xn+1, ..., xm]`.
27 //!
28 //! @note
29 //! The behavior is undefined if the index is out of the bounds of the
30 //! sequence.
31 //!
32 //!
33 //! @param xs
34 //! A sequence from which an element is to be removed.
35 //!
36 //! @param n
37 //! An non-negative `IntegralConstant` representing the index of the
38 //! element to be removed from the sequence. The behavior is undefined
39 //! if that index is not in the bounds of the sequence.
40 //!
41 //!
42 //! Example
43 //! -------
44 //! @include example/remove_at.cpp
45 #ifdef BOOST_HANA_DOXYGEN_INVOKED
46 constexpr auto remove_at = [](auto&& xs, auto const& n) {
47 return tag-dispatched;
48 };
49 #else
50 template <typename S, typename = void>
51 struct remove_at_impl : remove_at_impl<S, when<true>> { };
52
53 struct remove_at_t {
54 template <typename Xs, typename N>
55 constexpr auto operator()(Xs&& xs, N const& n) const;
56 };
57
58 constexpr remove_at_t remove_at{};
59 #endif
60
61 //! Equivalent to `remove_at`; provided for convenience.
62 //! @ingroup group-Sequence
63 //!
64 //!
65 //! Example
66 //! -------
67 //! @include example/remove_at_c.cpp
68 #ifdef BOOST_HANA_DOXYGEN_INVOKED
69 template <std::size_t n>
70 constexpr auto remove_at_c = [](auto&& xs) {
71 return hana::remove_at(forwarded(xs), hana::size_c<n>);
72 };
73 #else
74 template <std::size_t n>
75 struct remove_at_c_t;
76
77 template <std::size_t n>
78 constexpr remove_at_c_t<n> remove_at_c{};
79 #endif
80 BOOST_HANA_NAMESPACE_END
81
82 #endif // !BOOST_HANA_FWD_REMOVE_AT_HPP