[rtsan] Remove mkfifoat interceptor (#116997)
[llvm-project.git] / libcxx / include / __cxx03 / __algorithm / shift_left.h
blobb59a069826710896e1f46646a8819459a1ef3289
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef _LIBCPP___ALGORITHM_SHIFT_LEFT_H
10 #define _LIBCPP___ALGORITHM_SHIFT_LEFT_H
12 #include <__cxx03/__algorithm/move.h>
13 #include <__cxx03/__config>
14 #include <__cxx03/__iterator/iterator_traits.h>
16 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
17 # pragma GCC system_header
18 #endif
20 _LIBCPP_PUSH_MACROS
21 #include <__cxx03/__undef_macros>
23 _LIBCPP_BEGIN_NAMESPACE_STD
25 #if _LIBCPP_STD_VER >= 20
27 template <class _ForwardIterator>
28 inline _LIBCPP_HIDE_FROM_ABI constexpr _ForwardIterator
29 shift_left(_ForwardIterator __first,
30 _ForwardIterator __last,
31 typename iterator_traits<_ForwardIterator>::difference_type __n) {
32 if (__n == 0) {
33 return __last;
36 _ForwardIterator __m = __first;
37 if constexpr (__has_random_access_iterator_category<_ForwardIterator>::value) {
38 if (__n >= __last - __first) {
39 return __first;
41 __m += __n;
42 } else {
43 for (; __n > 0; --__n) {
44 if (__m == __last) {
45 return __first;
47 ++__m;
50 return std::move(__m, __last, __first);
53 #endif // _LIBCPP_STD_VER >= 20
55 _LIBCPP_END_NAMESPACE_STD
57 _LIBCPP_POP_MACROS
59 #endif // _LIBCPP___ALGORITHM_SHIFT_LEFT_H