-
-
Notifications
You must be signed in to change notification settings - Fork 55.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core: add an ability to use c++ 11 lambda expression as a parallel_for_ body #9017
Conversation
7341ea2
to
7b3d607
Compare
modules/core/src/parallel.cpp
Outdated
@@ -455,6 +455,29 @@ void cv::parallel_for_(const cv::Range& range, const cv::ParallelLoopBody& body, | |||
} | |||
} | |||
|
|||
#if __cplusplus >= 201103L | |||
class ParallelLoopBodyLambdaWrapper : public cv::ParallelLoopBody |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we can put this into header files (without requirement for new CV_EXPORTS functions)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But in this case user should use strange wrapper instead of directly pass lambda to parallel_for_
. Most users can write such a dummy wrapper by themselves, so we don't need this PR at all.
@vpisarev what do you think?
upd: I've understood the idea.
@@ -56,6 +56,10 @@ | |||
#include "opencv2/core.hpp" | |||
#include <ostream> | |||
|
|||
#if __cplusplus >= 201103L |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MSVC defines __cplusplus
to 199711
Probably we should target for MSVS 2013+ too.
Check this condition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be we should replace separate c++ 11 features detection with common CV_CXX11
in cvdef.h
7bbfe7b
to
6730831
Compare
@@ -56,6 +56,10 @@ | |||
#include "opencv2/core.hpp" | |||
#include <ostream> | |||
|
|||
#if CV_CXX_11 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#ifdef
should be used here with current macro implementation.
6730831
to
08db55f
Compare
looks cool! 👍 |
No description provided.