//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // template // void // random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // // template // void // random_shuffle(RandomAccessIterator first, RandomAccessIterator last, // RandomNumberGenerator& rand); // // In C++17, random_shuffle has been removed. // However, for backwards compatibility, if _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE // is defined before including , then random_shuffle will be restored. // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS #include #include #include #include "test_macros.h" struct gen { std::ptrdiff_t operator()(std::ptrdiff_t n) { return n-1; } }; int main(int, char**) { std::vector v; std::random_shuffle(v.begin(), v.end()); gen r; std::random_shuffle(v.begin(), v.end(), r); return 0; }