Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /*!
0002 @file
0003 Forward declares `boost::hana::insert_range`.
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_INSERT_RANGE_HPP
0011 #define BOOST_HANA_FWD_INSERT_RANGE_HPP
0012 
0013 #include <boost/hana/config.hpp>
0014 #include <boost/hana/core/when.hpp>
0015 
0016 
0017 namespace boost { namespace hana {
0018     //! Insert several values at a given index in a sequence.
0019     //! @ingroup group-Sequence
0020     //!
0021     //! Given a sequence, an index and any `Foldable` containing elements to
0022     //! insert, `insert_range` inserts the elements in the `Foldable` at the
0023     //! given index of the sequence.
0024     //!
0025     //! @param xs
0026     //! The sequence in which values should be inserted.
0027     //!
0028     //! @param n
0029     //! The index at which elements should be inserted. This must be a
0030     //! non-negative `Constant` of an integral type, and it must also be
0031     //! true that `n < length(xs)` if `xs` is a finite sequence.
0032     //!
0033     //! @param elements
0034     //! A `Foldable` containing elements to insert in the sequence.
0035     //!
0036     //!
0037     //! Example
0038     //! -------
0039     //! @include example/insert_range.cpp
0040 #ifdef BOOST_HANA_DOXYGEN_INVOKED
0041     constexpr auto insert_range = [](auto&& xs, auto&& n, auto&& elements) {
0042         return tag-dispatched;
0043     };
0044 #else
0045     template <typename S, typename = void>
0046     struct insert_range_impl : insert_range_impl<S, when<true>> { };
0047 
0048     struct insert_range_t {
0049         template <typename Xs, typename N, typename Elements>
0050         constexpr auto operator()(Xs&& xs, N&& n, Elements&& elements) const;
0051     };
0052 
0053     BOOST_HANA_INLINE_VARIABLE constexpr insert_range_t insert_range{};
0054 #endif
0055 }} // end namespace boost::hana
0056 
0057 #endif // !BOOST_HANA_FWD_INSERT_RANGE_HPP