Back to home page

EIC code displayed by LXR

 
 

    


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

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___LIBCXX_DEBUG_RANDOMIZE_RANGE_H
0010 #define _LIBCPP___CXX03___LIBCXX_DEBUG_RANDOMIZE_RANGE_H
0011 
0012 #include <__cxx03/__config>
0013 
0014 #ifdef _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY
0015 #  include <__cxx03/__algorithm/shuffle.h>
0016 #  include <__cxx03/__type_traits/is_constant_evaluated.h>
0017 #endif
0018 
0019 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0020 #  pragma GCC system_header
0021 #endif
0022 
0023 _LIBCPP_BEGIN_NAMESPACE_STD
0024 
0025 template <class _AlgPolicy, class _Iterator, class _Sentinel>
0026 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __debug_randomize_range(_Iterator __first, _Sentinel __last) {
0027 #ifdef _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY
0028 #  ifdef _LIBCPP_CXX03_LANG
0029 #    error Support for unspecified stability is only for C++11 and higher
0030 #  endif
0031 
0032   if (!__libcpp_is_constant_evaluated())
0033     std::__shuffle<_AlgPolicy>(__first, __last, __libcpp_debug_randomizer());
0034 #else
0035   (void)__first;
0036   (void)__last;
0037 #endif
0038 }
0039 
0040 _LIBCPP_END_NAMESPACE_STD
0041 
0042 #endif // _LIBCPP___CXX03___LIBCXX_DEBUG_RANDOMIZE_RANGE_H