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`.
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_HPP
0011 #define BOOST_HANA_FWD_INSERT_HPP
0012 
0013 #include <boost/hana/config.hpp>
0014 #include <boost/hana/core/when.hpp>
0015 
0016 
0017 namespace boost { namespace hana {
0018     // Note: This function is documented per datatype/concept only.
0019     //! @cond
0020     template <typename T, typename = void>
0021     struct insert_impl : insert_impl<T, when<true>> { };
0022     //! @endcond
0023 
0024     struct insert_t {
0025         template <typename Set, typename ...Args>
0026         constexpr decltype(auto) operator()(Set&& set, Args&& ...args) const;
0027     };
0028 
0029     BOOST_HANA_INLINE_VARIABLE constexpr insert_t insert{};
0030 
0031 
0032     //! Insert a value at a given index in a sequence.
0033     //! @ingroup group-Sequence
0034     //!
0035     //! Given a sequence, an index and an element to insert, `insert` inserts
0036     //! the element at the given index.
0037     //!
0038     //! @param xs
0039     //! The sequence in which a value should be inserted.
0040     //!
0041     //! @param n
0042     //! The index at which an element should be inserted. This must be a
0043     //! non-negative `Constant` of an integral type, and it must also be
0044     //! true that `n < length(xs)` if `xs` is a finite sequence.
0045     //!
0046     //! @param element
0047     //! The element to insert in the sequence.
0048     //!
0049     //!
0050     //! Example
0051     //! -------
0052     //! @include example/insert.cpp
0053 #ifdef BOOST_HANA_DOXYGEN_INVOKED
0054     constexpr auto insert = [](auto&& xs, auto&& n, auto&& element) {
0055         return tag-dispatched;
0056     };
0057 #endif
0058 }} // end namespace boost::hana
0059 
0060 #endif // !BOOST_HANA_FWD_INSERT_HPP