diff options
Diffstat (limited to 'options')
| -rw-r--r-- | options/metatype.cpp | 2 | ||||
| -rw-r--r-- | options/metatype.hpp | 9 | ||||
| -rw-r--r-- | options/value.hpp | 21 | 
3 files changed, 17 insertions, 15 deletions
| diff --git a/options/metatype.cpp b/options/metatype.cpp index e54970c0..1d13cbdd 100644 --- a/options/metatype.cpp +++ b/options/metatype.cpp @@ -20,7 +20,7 @@ int declare_metatype_for_type(const char* str)      OPENTRACK_DEFINE_METATYPE4(t, init_metatype_ ## ctr)  #define OPENTRACK_DEFINE_METATYPE4(t, sym)                                                          \ -    static class sym {                                                                              \ +    class sym {                                                                                     \          static const int dribble;                                                                   \      } sym ## _singleton;                                                                            \      const int sym :: dribble = ::options::detail::declare_metatype_for_type<t>(#t) diff --git a/options/metatype.hpp b/options/metatype.hpp index 27e37c80..3f92e09f 100644 --- a/options/metatype.hpp +++ b/options/metatype.hpp @@ -1,21 +1,21 @@  #pragma once +#include "slider.hpp" +#include "defs.hpp" +  #include <QList>  #include <QString>  #include <QPointF>  #include <QDebug> -#include "slider.hpp" -#include "defs.hpp"  #include <QMetaType> -#if !defined OPENTRACK_METATYPE_ || defined Q_CREATOR_RUN +#if !defined OPENTRACK_METATYPE_ || defined Q_CREATOR_RUN || defined __clang_analyzer__  #   define OPENTRACK_METATYPE(x) Q_DECLARE_METATYPE(x)  #else  #   define OPENTRACK_METATYPE(x) Q_DECLARE_METATYPE(x) OPENTRACK_METATYPE_(x)  #endif -#if !defined __clang_analyzer__  OPENTRACK_METATYPE(QList<double>);  OPENTRACK_METATYPE(QList<float>);  OPENTRACK_METATYPE(QList<int>); @@ -23,4 +23,3 @@ OPENTRACK_METATYPE(QList<bool>);  OPENTRACK_METATYPE(QList<QString>);  OPENTRACK_METATYPE(QList<QPointF>);  OPENTRACK_METATYPE(::options::slider_value); -#endif diff --git a/options/value.hpp b/options/value.hpp index af3cfd57..7c0a8d56 100644 --- a/options/value.hpp +++ b/options/value.hpp @@ -21,6 +21,17 @@  #include <QMetaType> +namespace options::detail { +    template<typename t> +    struct dereference_wrapper final +    { +        cc_forceinline constexpr t const* operator->() const { return &x; } +        cc_forceinline constexpr t* operator->() { return &x; } +        t x; +        constexpr explicit cc_forceinline dereference_wrapper(t&& x) : x(x) {} +    }; +} // ns options::detail +  namespace options {  template<typename t> @@ -116,15 +127,7 @@ public:      auto operator->() const      { -        struct dereference_wrapper final -        { -            cc_forceinline t const* operator->() const { return &x; } -            cc_forceinline t* operator->() { return &x; } -            t x; -            explicit cc_forceinline dereference_wrapper(t&& x) : x(x) {} -        }; - -        return dereference_wrapper { get() }; +        return detail::dereference_wrapper<t>{get()};      }      cc_noinline | 
