File indexing completed on 2026-05-03 08:13:36
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef _LIBCPP___CXX03___NUMERIC_EXCLUSIVE_SCAN_H
0011 #define _LIBCPP___CXX03___NUMERIC_EXCLUSIVE_SCAN_H
0012
0013 #include <__cxx03/__config>
0014 #include <__cxx03/__functional/operations.h>
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 #if _LIBCPP_STD_VER >= 17
0027
0028 template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp>
0029 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
0030 exclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Tp __init, _BinaryOp __b) {
0031 if (__first != __last) {
0032 _Tp __tmp(__b(__init, *__first));
0033 while (true) {
0034 *__result = std::move(__init);
0035 ++__result;
0036 ++__first;
0037 if (__first == __last)
0038 break;
0039 __init = std::move(__tmp);
0040 __tmp = __b(__init, *__first);
0041 }
0042 }
0043 return __result;
0044 }
0045
0046 template <class _InputIterator, class _OutputIterator, class _Tp>
0047 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator
0048 exclusive_scan(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Tp __init) {
0049 return std::exclusive_scan(__first, __last, __result, __init, std::plus<>());
0050 }
0051
0052 #endif
0053
0054 _LIBCPP_END_NAMESPACE_STD
0055
0056 _LIBCPP_POP_MACROS
0057
0058 #endif