Skip to content

Replace deprecated std::random_shuffle() with std::shuffle() - #339

Merged
artivis merged 1 commit into
artivis:feat/wsfrom
ethanmusser:ethanmusser/remove-deprecated-std-random-shuffle
Jul 15, 2026
Merged

artivis merged 1 commit into
artivis:feat/wsfrom
ethanmusser:ethanmusser/remove-deprecated-std-random-shuffle

Conversation

@ethanmusser

@ethanmusser ethanmusser commented Jan 8, 2026

Copy link
Copy Markdown

Replace a usage of the deprecated std::random_shuffle() method with the std::shuffle() method.

Issue

This fixes the following build warning when building the tests/examples with g++-14 (and other major compilers I would imagine).

[ 44%] Linking CXX executable gtest_so2_tangent
In file included from /home/emusser/src/dev/manif/test/so3/gtest_so3.cpp:5:
/home/emusser/src/dev/manif/test/so3/../common_tester.h: In instantiation of ‘void manif::CommonTester<_LieGroup>::evalAvgBiInvariant() [with _LieGroup = manif::SO3<double>]’:
/home/emusser/src/dev/manif/test/so3/gtest_so3.cpp:640:1:   required from here
   85 |   { evalAvgBiInvariant(); }                                               \
      |     ~~~~~~~~~~~~~~~~~~^~
/home/emusser/src/dev/manif/test/so3/../common_tester.h:510:26: warning: ‘void std::random_shuffle(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<manif::SO3<double>*, vector<manif::SO3<double>, Eigen::aligned_allocator<manif::SO3<double> > > >]’ is deprecated: use 'std::shuffle' instead [-Wdeprecated-declarations]
  510 |       std::random_shuffle( mans.begin(), mans.end() );
      |       ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/eigen3/Eigen/Core:95,
                 from /home/emusser/src/dev/manif/include/manif/impl/eigen.h:6,
                 from /home/emusser/src/dev/manif/include/manif/impl/lie_group_base.h:6,
                 from /home/emusser/src/dev/manif/include/manif/SO3.h:5,
                 from /home/emusser/src/dev/manif/test/so3/gtest_so3.cpp:3:
/usr/include/c++/14/bits/stl_algo.h:4491:5: note: declared here
 4491 |     random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~~~~~~~~~~~

Tags

@ethanmusser

ethanmusser commented Jan 8, 2026

Copy link
Copy Markdown
Author

Seems like the CI failures for macos-14 and windows-2022 might be related to the switch to Eigen3>=5.0.0. Might have to do with what @traversaro is working on in #335.

@traversaro

Copy link
Copy Markdown
Contributor

Might have to do with what @traversaro is working on in #335.

Just to clarify, that PR is ready for review/merge.

@ethanmusser

Copy link
Copy Markdown
Author

@artivis Monthly ping to keep this from going stale.

@artivis
artivis changed the base branch from devel to feat/ws July 15, 2026 12:35
@artivis
artivis merged commit acb129c into artivis:feat/ws Jul 15, 2026
22 of 25 checks passed
@artivis

artivis commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Hi @ethanmusser 👋 ,
Sorry this took so long. I'm doing a bit of summer cleaning and merged your PR to #341 . It is intended to land in devel asap.
Thanks for the contribution 👍 .

@ethanmusser

Copy link
Copy Markdown
Author

Hi @ethanmusser 👋 ,

Sorry this took so long. I'm doing a bit of summer cleaning and merged your PR to #341 . It is intended to land in devel asap.

Thanks for the contribution 👍 .

Glad to get it landed, thanks for the followup!

@ethanmusser
ethanmusser deleted the ethanmusser/remove-deprecated-std-random-shuffle branch July 16, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants