Skip to content

Conversation

zibi2
Copy link
Contributor

@zibi2 zibi2 commented Aug 28, 2025

Before the change a declaration in question was like the following:

template <class _RandomAccessIterator, class _RandomNumberGenerator>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX14 void
random_shuffle(_RandomAccessIterator __first,
               _RandomAccessIterator __last,
#  ifndef _LIBCPP_CXX03_LANG
               _RandomNumberGenerator&& __rand)
#  else
               _RandomNumberGenerator& __rand)
#  endif

The frozen cxx03 header should use reference for the 3rd parameter of random_shuffle() template function.

@zibi2 zibi2 self-assigned this Aug 28, 2025
@zibi2 zibi2 requested a review from a team as a code owner August 28, 2025 20:19
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Aug 28, 2025
@llvmbot
Copy link
Member

llvmbot commented Aug 28, 2025

@llvm/pr-subscribers-libcxx

Author: Zibi Sarbinowski (zibi2)

Changes

Before the change a declaration in question was like the following:

template &lt;class _RandomAccessIterator, class _RandomNumberGenerator&gt;
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX14 void
random_shuffle(_RandomAccessIterator __first,
               _RandomAccessIterator __last,
#  ifndef _LIBCPP_CXX03_LANG
               _RandomNumberGenerator&amp;&amp; __rand)
#  else
               _RandomNumberGenerator&amp; __rand)
#  endif

The frozen cxx03 header should use reference for the 3rd parameter of random_shuffle() template function.


Full diff: https://github.com/llvm/llvm-project/pull/155915.diff

1 Files Affected:

  • (modified) libcxx/include/__cxx03/__algorithm/shuffle.h (+1-1)
diff --git a/libcxx/include/__cxx03/__algorithm/shuffle.h b/libcxx/include/__cxx03/__algorithm/shuffle.h
index fee7028ae22ac..24cd71c71378b 100644
--- a/libcxx/include/__cxx03/__algorithm/shuffle.h
+++ b/libcxx/include/__cxx03/__algorithm/shuffle.h
@@ -109,7 +109,7 @@ _LIBCPP_HIDE_FROM_ABI void random_shuffle(_RandomAccessIterator __first, _Random
 
 template <class _RandomAccessIterator, class _RandomNumberGenerator>
 _LIBCPP_HIDE_FROM_ABI void
-random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, _RandomNumberGenerator&& __rand) {
+random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, _RandomNumberGenerator& __rand) {
   typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
   difference_type __d = __last - __first;
   if (__d > 1) {

Copy link
Contributor

@philnik777 philnik777 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this matter?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants