Skip to content

Remove static initializers#20049

Merged
opencv-pushbot merged 1 commit intoopencv:3.4from
jstaahl:jstaahl-static-inits
May 11, 2021
Merged

Remove static initializers#20049
opencv-pushbot merged 1 commit intoopencv:3.4from
jstaahl:jstaahl-static-inits

Conversation

@jstaahl
Copy link
Copy Markdown

@jstaahl jstaahl commented May 7, 2021

There are a handful of static initializers in our binary which originate from the opencv library. All of them are attributed to the policy private static member of the templated SinglePolicy class:
opencv2/flann/any.h#L176.

These can be avoided by using the Meyer singleton pattern for the get_policy() function.

issue report: #20051

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 other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

@jstaahl jstaahl mentioned this pull request May 7, 2021
4 tasks
@jstaahl jstaahl changed the title Remove static initializers caused by static member. Remove static initializers May 8, 2021
Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

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

Looks good to me 👍

(hopefully Clang's RTTI can handle this properly)

@opencv-pushbot opencv-pushbot merged commit b335fe6 into opencv:3.4 May 11, 2021
@jstaahl jstaahl deleted the jstaahl-static-inits branch May 13, 2021 15:49
@alalek alalek mentioned this pull request May 18, 2021
@alalek alalek mentioned this pull request Jun 4, 2021
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.

Static initializers

4 participants