Skip to content

Fix compilation when forcing later C++.#24194

Merged
opencv-alalek merged 3 commits intoopencv:4.xfrom
vrabaud:compilation_fix
Aug 27, 2023
Merged

Fix compilation when forcing later C++.#24194
opencv-alalek merged 3 commits intoopencv:4.xfrom
vrabaud:compilation_fix

Conversation

@vrabaud
Copy link
Copy Markdown
Contributor

@vrabaud vrabaud commented Aug 24, 2023

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch

@vrabaud
Copy link
Copy Markdown
Contributor Author

vrabaud commented Aug 24, 2023

The CI on OSX failed because of this: https://github.com/opencv/opencv/actions/runs/5964752904/job/16180691776?pr=24193

const float border_width = 2.0;

void randomShuffle(std::string& info) {
#if defined CV_CXX11
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I thought we are going to remove CV_CXX11 completely, see #23736
cc @asmorkalov , @opencv-alalek , @vpisarev

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Indeed. Plus, OpenCV 4.x is C++11 so we can just use std::shuffle by default.

Copy link
Copy Markdown
Contributor

@mshabunin mshabunin left a comment

Choose a reason for hiding this comment

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

Reproduced with libstdc++ (warning) and libc++ (error) and clang 17 (CMAKE_CXX_STANDARD=17):

/opencv/modules/objdetect/test/test_qrcode_encode.cpp:267:22: warning: 'random_shuffle<__gnu_cxx::__normal_iterator<char *, std::basic_string<char>>>' is deprecated: use 'std::shuffle' instead [-Wdeprecated-declarations]
  267 |                 std::random_shuffle(input_info.begin(),input_info.end());
      |                      ^


/opencv/modules/objdetect/test/test_qrcode_encode.cpp:267:22: error: no member named 'random_shuffle' in namespace 'std'
  267 |                 std::random_shuffle(input_info.begin(),input_info.end());
      |                 ~~~~~^

No issues after fix.

@opencv-alalek opencv-alalek added this to the 4.9.0 milestone Aug 27, 2023
@opencv-alalek opencv-alalek merged commit 8a1b998 into opencv:4.x Aug 27, 2023
@vrabaud vrabaud deleted the compilation_fix branch August 28, 2023 08:12
thewoz pushed a commit to thewoz/opencv that referenced this pull request Jan 4, 2024
* Fix compilation when forcing later C++.

* Remove random_shuffle.

* Remove random_shuffle.
thewoz pushed a commit to thewoz/opencv that referenced this pull request May 29, 2024
* Fix compilation when forcing later C++.

* Remove random_shuffle.

* Remove random_shuffle.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants