Path: blob/main/contrib/llvm-project/libcxx/include/__debug_utils/randomize_range.h
35233 views
//===----------------------------------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef _LIBCPP___LIBCXX_DEBUG_RANDOMIZE_RANGE_H9#define _LIBCPP___LIBCXX_DEBUG_RANDOMIZE_RANGE_H1011#include <__config>1213#ifdef _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY14# include <__algorithm/shuffle.h>15# include <__type_traits/is_constant_evaluated.h>16#endif1718#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)19# pragma GCC system_header20#endif2122_LIBCPP_BEGIN_NAMESPACE_STD2324template <class _AlgPolicy, class _Iterator, class _Sentinel>25_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __debug_randomize_range(_Iterator __first, _Sentinel __last) {26#ifdef _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY27# ifdef _LIBCPP_CXX03_LANG28# error Support for unspecified stability is only for C++11 and higher29# endif3031if (!__libcpp_is_constant_evaluated())32std::__shuffle<_AlgPolicy>(__first, __last, __libcpp_debug_randomizer());33#else34(void)__first;35(void)__last;36#endif37}3839_LIBCPP_END_NAMESPACE_STD4041#endif // _LIBCPP___LIBCXX_DEBUG_RANDOMIZE_RANGE_H424344