From a3ab6d147d0ef4e883fafb5a7effdd6eac033f42 Mon Sep 17 00:00:00 2001 From: Andrey Kamaev Date: Mon, 8 Oct 2012 21:30:40 +0400 Subject: [PATCH] Fix CV_ENUM macro instability --- modules/ts/include/opencv2/ts/ts_perf.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/ts/include/opencv2/ts/ts_perf.hpp b/modules/ts/include/opencv2/ts/ts_perf.hpp index 0b5f0b7430..44d98bc652 100644 --- a/modules/ts/include/opencv2/ts/ts_perf.hpp +++ b/modules/ts/include/opencv2/ts/ts_perf.hpp @@ -90,7 +90,7 @@ private: \*****************************************************************************************/ #define CV_ENUM(class_name, ...) \ -class CV_EXPORTS class_name {\ +namespace { class CV_EXPORTS class_name {\ public:\ class_name(int val = 0) : _val(val) {}\ operator int() const {return _val;}\ @@ -116,12 +116,12 @@ public:\ private: class_name *_begin, *_end;\ };\ static Container all(){\ - static class_name vals[] = {__VA_ARGS__};\ - return Container(vals, sizeof(vals)/sizeof(vals[0]));\ + static int vals[] = {__VA_ARGS__};\ + return Container((class_name*)vals, sizeof(vals)/sizeof(vals[0]));\ }\ private: int _val;\ };\ -inline void PrintTo(const class_name& t, std::ostream* os) { t.PrintTo(os); } +inline void PrintTo(const class_name& t, std::ostream* os) { t.PrintTo(os); } } #define CV_FLAGS(class_name, ...) \ class CV_EXPORTS class_name {\