Back to home page

EIC code displayed by LXR

 
 

    


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

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_FILL_H
0010 #define _LIBCPP___CXX03___ALGORITHM_FILL_H
0011 
0012 #include <__cxx03/__algorithm/fill_n.h>
0013 #include <__cxx03/__config>
0014 #include <__cxx03/__iterator/iterator_traits.h>
0015 
0016 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0017 #  pragma GCC system_header
0018 #endif
0019 
0020 _LIBCPP_BEGIN_NAMESPACE_STD
0021 
0022 // fill isn't specialized for std::memset, because the compiler already optimizes the loop to a call to std::memset.
0023 
0024 template <class _ForwardIterator, class _Tp>
0025 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
0026 __fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, forward_iterator_tag) {
0027   for (; __first != __last; ++__first)
0028     *__first = __value;
0029 }
0030 
0031 template <class _RandomAccessIterator, class _Tp>
0032 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
0033 __fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& __value, random_access_iterator_tag) {
0034   std::fill_n(__first, __last - __first, __value);
0035 }
0036 
0037 template <class _ForwardIterator, class _Tp>
0038 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
0039 fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
0040   std::__fill(__first, __last, __value, typename iterator_traits<_ForwardIterator>::iterator_category());
0041 }
0042 
0043 _LIBCPP_END_NAMESPACE_STD
0044 
0045 #endif // _LIBCPP___CXX03___ALGORITHM_FILL_H