Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:09:41

0001 /// \file
0002 // Range v3 library
0003 //
0004 //  Copyright Eric Niebler 2013-present
0005 //
0006 //  Use, modification and distribution is subject to the
0007 //  Boost Software License, Version 1.0. (See accompanying
0008 //  file LICENSE_1_0.txt or copy at
0009 //  http://www.boost.org/LICENSE_1_0.txt)
0010 //
0011 // Project home: https://github.com/ericniebler/range-v3
0012 //
0013 
0014 #ifndef RANGES_V3_ACTION_ERASE_HPP
0015 #define RANGES_V3_ACTION_ERASE_HPP
0016 
0017 #include <utility>
0018 
0019 #include <range/v3/range_fwd.hpp>
0020 
0021 #include <range/v3/action/insert.hpp>
0022 #include <range/v3/utility/static_const.hpp>
0023 
0024 #include <range/v3/detail/prologue.hpp>
0025 
0026 namespace ranges
0027 {
0028     /// \cond
0029     namespace adl_erase_detail
0030     {
0031         template(typename Cont, typename I, typename S)(
0032             requires lvalue_container_like<Cont> AND forward_iterator<I> AND
0033                 sentinel_for<S, I>)
0034         auto erase(Cont && cont, I first, S last)                            //
0035             -> decltype(unwrap_reference(cont).erase(first, last))
0036         {
0037             return unwrap_reference(cont).erase(first, last);
0038         }
0039 
0040         struct erase_fn
0041         {
0042             template(typename Rng, typename I, typename S)(
0043                 requires range<Rng> AND forward_iterator<I> AND sentinel_for<S, I>)
0044             auto operator()(Rng && rng, I first, S last) const
0045                 -> decltype(erase((Rng &&) rng, first, last))
0046             {
0047                 return erase(static_cast<Rng &&>(rng), first, last);
0048             }
0049         };
0050     } // namespace adl_erase_detail
0051     /// \endcond
0052 
0053     /// \ingroup group-actions
0054     RANGES_INLINE_VARIABLE(adl_erase_detail::erase_fn, erase)
0055 
0056     namespace actions
0057     {
0058         using ranges::erase;
0059     }
0060 
0061     /// \addtogroup group-range
0062     /// @{
0063     // clang-format off
0064     /// \concept erasable_range_
0065     /// \brief The \c erasable_range_ concept
0066     template<typename Rng, typename I, typename S>
0067     CPP_requires(erasable_range_,
0068         requires(Rng && rng, I first, S last)
0069         (
0070             ranges::erase((Rng &&) rng, first, last)
0071         )
0072     );
0073     /// \concept erasable_range
0074     /// \brief The \c erasable_range concept
0075     template<typename Rng, typename I, typename S>
0076     CPP_concept erasable_range =
0077         range<Rng> && CPP_requires_ref(ranges::erasable_range_, Rng, I, S);
0078     // clang-format on
0079     /// @}
0080 } // namespace ranges
0081 
0082 #include <range/v3/detail/epilogue.hpp>
0083 
0084 #endif