summaryrefslogtreecommitdiffhomepage
path: root/video/camera.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2019-03-22 04:28:00 +0100
committerStanislaw Halik <sthalik@misaki.pl>2019-03-28 08:58:40 +0100
commite3e8caf61bbc22c3b278ce8bd36501b73806d524 (patch)
treeac24885c76082486e1fbd12ef5f525ea5d566d24 /video/camera.hpp
parent01b80e4f56cc9f5120a9a34690e6f593006e5585 (diff)
actually expand __COUNTER__
Diffstat (limited to 'video/camera.hpp')
-rw-r--r--video/camera.hpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/video/camera.hpp b/video/camera.hpp
index 21f4f916..4ad8417c 100644
--- a/video/camera.hpp
+++ b/video/camera.hpp
@@ -67,17 +67,14 @@ void register_camera(std::unique_ptr<impl::camera_> metadata);
} // ns video::impl
-#define OTR_REGISTER_CAMERA2(type, ctr) \
- namespace { \
- struct init_##ctr \
- { \
- static char fuzz; \
- }; \
- char init_##ctr :: fuzz = \
- (::video::impl::register_camera(std::make_unique<type>()), 0); \
- } // anon ns
-
-#define OTR_REGISTER_CAMERA(type) \
+#define OTR_REGISTER_CAMERA3(type, ctr) \
+ static const char init_ ## ctr = \
+ (::video::impl::register_camera(std::make_unique<type>()), 0);
+
+#define OTR_REGISTER_CAMERA2(type, ctr) \
+ OTR_REGISTER_CAMERA3(type, ctr)
+
+#define OTR_REGISTER_CAMERA(type) \
OTR_REGISTER_CAMERA2(type, __COUNTER__)
namespace video