/*! @file Defines `boost::hana::insert`. @copyright Louis Dionne 2013-2017 Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_HANA_INSERT_HPP #define BOOST_HANA_INSERT_HPP #include #include #include #include #include #include #include #include BOOST_HANA_NAMESPACE_BEGIN //! @cond template constexpr decltype(auto) insert_t::operator()(Set&& set, Args&& ...args) const { return insert_impl::type>::apply( static_cast(set), static_cast(args)... ); } //! @endcond template struct insert_impl> : default_ { template static constexpr auto apply(Args&& ...) = delete; }; template struct insert_impl::value>> { template static constexpr auto apply(Xs&& xs, N const& n, Element&& e) { return hana::concat(hana::append(hana::take_front(xs, n), static_cast(e)), hana::drop_front(xs, n)); } }; BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_INSERT_HPP