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_IF_H
0010 #define _LIBCPP___CXX03___ALGORITHM_REMOVE_IF_H
0011 
0012 #include <__cxx03/__algorithm/find_if.h>
0013 #include <__cxx03/__config>
0014 #include <__cxx03/__utility/move.h>
0015 
0016 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0017 #  pragma GCC system_header
0018 #endif
0019 
0020 _LIBCPP_PUSH_MACROS
0021 #include <__cxx03/__undef_macros>
0022 
0023 _LIBCPP_BEGIN_NAMESPACE_STD
0024 
0025 template <class _ForwardIterator, class _Predicate>
0026 _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator
0027 remove_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) {
0028   __first = std::find_if<_ForwardIterator, _Predicate&>(__first, __last, __pred);
0029   if (__first != __last) {
0030     _ForwardIterator __i = __first;
0031     while (++__i != __last) {
0032       if (!__pred(*__i)) {
0033         *__first = std::move(*__i);
0034         ++__first;
0035       }
0036     }
0037   }
0038   return __first;
0039 }
0040 
0041 _LIBCPP_END_NAMESPACE_STD
0042 
0043 _LIBCPP_POP_MACROS
0044 
0045 #endif // _LIBCPP___CXX03___ALGORITHM_REMOVE_IF_H