Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:13:21

0001 //===----------------------------------------------------------------------===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef _LIBCPP___CXX03___ALGORITHM_REMOVE_H
0010 #define _LIBCPP___CXX03___ALGORITHM_REMOVE_H
0011 
0012 #include <__cxx03/__algorithm/find.h>
0013 #include <__cxx03/__algorithm/find_if.h>
0014 #include <__cxx03/__config>
0015 #include <__cxx03/__utility/move.h>
0016 
0017 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0018 #  pragma GCC system_header
0019 #endif
0020 
0021 _LIBCPP_PUSH_MACROS
0022 #include <__cxx03/__undef_macros>
0023 
0024 _LIBCPP_BEGIN_NAMESPACE_STD
0025 
0026 template <class _ForwardIterator, class _Tp>
0027 _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
0028 remove(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
0029   __first = std::find(__first, __last, __value);
0030   if (__first != __last) {
0031     _ForwardIterator __i = __first;
0032     while (++__i != __last) {
0033       if (!(*__i == __value)) {
0034         *__first = std::move(*__i);
0035         ++__first;
0036       }
0037     }
0038   }
0039   return __first;
0040 }
0041 
0042 _LIBCPP_END_NAMESPACE_STD
0043 
0044 _LIBCPP_POP_MACROS
0045 
0046 #endif // _LIBCPP___CXX03___ALGORITHM_REMOVE_H