Warning: This file is not a C or C++ file. It does not have highlighting.

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//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___CXX03___LIBCXX_DEBUG_RANDOMIZE_RANGE_H
10#define _LIBCPP___CXX03___LIBCXX_DEBUG_RANDOMIZE_RANGE_H
11
12#include <__cxx03/__config>
13
14#ifdef _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY
15# include <__cxx03/__algorithm/shuffle.h>
16# include <__cxx03/__type_traits/is_constant_evaluated.h>
17#endif
18
19#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
20# pragma GCC system_header
21#endif
22
23_LIBCPP_BEGIN_NAMESPACE_STD
24
25template <class _AlgPolicy, class _Iterator, class _Sentinel>
26_LIBCPP_HIDE_FROM_ABI void __debug_randomize_range(_Iterator __first, _Sentinel __last) {
27#ifdef _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY
28# error Support for unspecified stability is only for C++11 and higher
29
30 if (!__libcpp_is_constant_evaluated())
31 std::__shuffle<_AlgPolicy>(__first, __last, __libcpp_debug_randomizer());
32#else
33 (void)__first;
34 (void)__last;
35#endif
36}
37
38_LIBCPP_END_NAMESPACE_STD
39
40#endif // _LIBCPP___CXX03___LIBCXX_DEBUG_RANDOMIZE_RANGE_H
41

Warning: This file is not a C or C++ file. It does not have highlighting.

source code of libcxx/include/__cxx03/__debug_utils/randomize_range.h