From 24f8f904f3975832b77e18957dc41d2372deebc5 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 11 Feb 2019 18:40:27 +0100 Subject: less header namespace pollution --- compat/simple-mat.hpp | 18 +++++++++--------- options/value.cpp | 3 +-- options/value.hpp | 37 ++++++++++++++++++------------------- 3 files changed, 28 insertions(+), 30 deletions(-) diff --git a/compat/simple-mat.hpp b/compat/simple-mat.hpp index 87e1ae83..d42a2fe8 100644 --- a/compat/simple-mat.hpp +++ b/compat/simple-mat.hpp @@ -79,33 +79,32 @@ public: template std::enable_if_t::value, num&> constexpr inline operator()(unsigned i) & { return data[0][i]; } -#define OPENTRACK_ASSERT_SWIZZLE static_assert(P == h_ && Q == w_) +#define OTR_MAT_ASSERT_SWIZZLE static_assert(P == h_ && Q == w_) // const variants template std::enable_if_t::value, num> - constexpr inline x() const& { OPENTRACK_ASSERT_SWIZZLE; return operator()(0); } + constexpr inline x() const& { OTR_MAT_ASSERT_SWIZZLE; return operator()(0); } template std::enable_if_t::value, num> - constexpr inline y() const& { OPENTRACK_ASSERT_SWIZZLE; return operator()(1); } + constexpr inline y() const& { OTR_MAT_ASSERT_SWIZZLE; return operator()(1); } template std::enable_if_t::value, num> - constexpr inline z() const& { OPENTRACK_ASSERT_SWIZZLE; return operator()(2); } + constexpr inline z() const& { OTR_MAT_ASSERT_SWIZZLE; return operator()(2); } template std::enable_if_t::value, num> - constexpr inline w() const& { OPENTRACK_ASSERT_SWIZZLE; return operator()(3); } + constexpr inline w() const& { OTR_MAT_ASSERT_SWIZZLE; return operator()(3); } // mutable variants template std::enable_if_t::value, num&> - constexpr inline x() & { OPENTRACK_ASSERT_SWIZZLE; return operator()(0); } + constexpr inline x() & { OTR_MAT_ASSERT_SWIZZLE; return operator()(0); } template std::enable_if_t::value, num&> - constexpr inline y() & { OPENTRACK_ASSERT_SWIZZLE; return operator()(1); } + constexpr inline y() & { OTR_MAT_ASSERT_SWIZZLE; return operator()(1); } template std::enable_if_t::value, num&> - constexpr inline z() & { OPENTRACK_ASSERT_SWIZZLE; return operator()(2); } + constexpr inline z() & { OTR_MAT_ASSERT_SWIZZLE; return operator()(2); } template std::enable_if_t::value, num&> - constexpr inline w() & { OPENTRACK_ASSERT_SWIZZLE; return operator()(3); } template constexpr Mat slice() const @@ -119,6 +118,7 @@ public: template std::enable_if_t::value && equals::value, Mat> slice() const { return ((double const*)*this) + off; } + constexpr inline w() & { OTR_MAT_ASSERT_SWIZZLE; return operator()(3); } template std::enable_if_t::value, num> diff --git a/options/value.cpp b/options/value.cpp index e0be69ae..81a094e6 100644 --- a/options/value.cpp +++ b/options/value.cpp @@ -1,6 +1,5 @@ // instantiate the "template class" value symbols -#include "compat/linkage-macros.hpp" -#define OTR_INST_VALUE(x) OTR_TEMPLATE_EXPORT(x) +#define OTR_OPTIONS_INST_VALUE OTR_TEMPLATE_EXPORT #include "value.hpp" diff --git a/options/value.hpp b/options/value.hpp index 18a5ae9b..940e2a15 100644 --- a/options/value.hpp +++ b/options/value.hpp @@ -153,26 +153,25 @@ public: } }; -// some linker problems -#if !defined OTR_INST_VALUE -# define OTR_INST_VALUE OTR_TEMPLATE_IMPORT +#if !defined OTR_OPTIONS_INST_VALUE +# define OTR_OPTIONS_INST_VALUE OTR_TEMPLATE_IMPORT #endif -OTR_INST_VALUE(value) -OTR_INST_VALUE(value) -OTR_INST_VALUE(value) -OTR_INST_VALUE(value) -OTR_INST_VALUE(value) -OTR_INST_VALUE(value) -OTR_INST_VALUE(value) -OTR_INST_VALUE(value) -OTR_INST_VALUE(value>) -OTR_INST_VALUE(value>) -OTR_INST_VALUE(value>) -OTR_INST_VALUE(value>) -OTR_INST_VALUE(value>) -OTR_INST_VALUE(value>) -OTR_INST_VALUE(value>) -OTR_INST_VALUE(value>) +OTR_OPTIONS_INST_VALUE(value) +OTR_OPTIONS_INST_VALUE(value) +OTR_OPTIONS_INST_VALUE(value) +OTR_OPTIONS_INST_VALUE(value) +OTR_OPTIONS_INST_VALUE(value) +OTR_OPTIONS_INST_VALUE(value) +OTR_OPTIONS_INST_VALUE(value) +OTR_OPTIONS_INST_VALUE(value) +OTR_OPTIONS_INST_VALUE(value>) +OTR_OPTIONS_INST_VALUE(value>) +OTR_OPTIONS_INST_VALUE(value>) +OTR_OPTIONS_INST_VALUE(value>) +OTR_OPTIONS_INST_VALUE(value>) +OTR_OPTIONS_INST_VALUE(value>) +OTR_OPTIONS_INST_VALUE(value>) +OTR_OPTIONS_INST_VALUE(value>) } // ns options -- cgit v1.2.3