diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-07-13 16:20:30 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-07-13 16:20:30 +0200 |
commit | 68f5f213bf0cbd0bd60a6849bf4379113ea06282 (patch) | |
tree | 7906520ed59fe4ef7c03de91d55f4f74b87e4072 /options/value.hpp | |
parent | db47f9fc711f9b0abeb8461042c40c70d5a71021 (diff) |
appease analyzer
Diffstat (limited to 'options/value.hpp')
-rw-r--r-- | options/value.hpp | 21 |
1 files changed, 12 insertions, 9 deletions
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 |