From 08db55fb6235d5d343dc801272a86b9ce4c70ca0 Mon Sep 17 00:00:00 2001 From: Vladislav Sovrasov Date: Wed, 28 Jun 2017 16:07:07 +0300 Subject: [PATCH] core: add CV_CXX_11 flag to cvdef.h --- modules/core/include/opencv2/core/cvdef.h | 14 ++++++++++++++ modules/core/include/opencv2/core/utility.hpp | 4 ++-- .../how_to_use_OpenCV_parallel_for_.cpp | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/modules/core/include/opencv2/core/cvdef.h b/modules/core/include/opencv2/core/cvdef.h index 47b2c12637..46001d48e3 100644 --- a/modules/core/include/opencv2/core/cvdef.h +++ b/modules/core/include/opencv2/core/cvdef.h @@ -358,6 +358,20 @@ Cv64suf; #endif +/****************************************************************************************\ +* C++ 11 * +\****************************************************************************************/ +#ifndef CV_CXX_11 +# if __cplusplus >= 201103L || defined(_MSC_VER) && _MSC_VER >= 1600 +# define CV_CXX_11 1 +# endif +#else +# if CV_CXX_11 == 0 +# undef CV_CXX_11 +# endif +#endif + + /****************************************************************************************\ * C++ Move semantics * \****************************************************************************************/ diff --git a/modules/core/include/opencv2/core/utility.hpp b/modules/core/include/opencv2/core/utility.hpp index 411fc013dc..3590f9be34 100644 --- a/modules/core/include/opencv2/core/utility.hpp +++ b/modules/core/include/opencv2/core/utility.hpp @@ -56,7 +56,7 @@ #include "opencv2/core.hpp" #include -#if __cplusplus >= 201103L +#ifdef CV_CXX_11 #include #endif @@ -482,7 +482,7 @@ public: */ CV_EXPORTS void parallel_for_(const Range& range, const ParallelLoopBody& body, double nstripes=-1.); -#if __cplusplus >= 201103L +#ifdef CV_CXX_11 class ParallelLoopBodyLambdaWrapper : public ParallelLoopBody { private: diff --git a/samples/cpp/tutorial_code/core/how_to_use_OpenCV_parallel_for_/how_to_use_OpenCV_parallel_for_.cpp b/samples/cpp/tutorial_code/core/how_to_use_OpenCV_parallel_for_/how_to_use_OpenCV_parallel_for_.cpp index 59dcb69954..5f7013a470 100644 --- a/samples/cpp/tutorial_code/core/how_to_use_OpenCV_parallel_for_/how_to_use_OpenCV_parallel_for_.cpp +++ b/samples/cpp/tutorial_code/core/how_to_use_OpenCV_parallel_for_/how_to_use_OpenCV_parallel_for_.cpp @@ -102,7 +102,7 @@ int main() double t1 = (double) getTickCount(); - #if __cplusplus >= 201103L + #ifdef CV_CXX_11 //! [mandelbrot-parallel-call-cxx11] parallel_for_(Range(0, mandelbrotImg.rows*mandelbrotImg.cols), [&](const Range& range){