diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-08-05 17:04:34 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-08-07 21:03:42 +0200 |
commit | 6571b78ffd9f74f9e863ff4c78b8ddebb53d52c5 (patch) | |
tree | 5d3d2b30344b3817b2282eb075cb6e230b93824f /opentrack-compat/options.hpp | |
parent | 9c34be2427a483d3bf5f115eac28dec2716461f2 (diff) |
compat/options: simplify getter
No need to write the static_cast long form at caller site.
Diffstat (limited to 'opentrack-compat/options.hpp')
-rw-r--r-- | opentrack-compat/options.hpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/opentrack-compat/options.hpp b/opentrack-compat/options.hpp index 53249746..fd4a82a5 100644 --- a/opentrack-compat/options.hpp +++ b/opentrack-compat/options.hpp @@ -234,7 +234,7 @@ namespace options { public: using underlying_t = typename get_t<t_>::t; - t operator=(const t datum) + t operator=(const t& datum) { store(static_cast<underlying_t>(datum)); return datum; @@ -256,7 +256,7 @@ namespace options { { } - operator t() const + t get() const { t val = b->contains(self_name) ? static_cast<t>(b->get<underlying_t>(self_name)) @@ -264,10 +264,13 @@ namespace options { return detail::value_get_traits<t>::get(val, def); } + operator t() const { return get(); } + void reload() override { *this = static_cast<t>(*this); } + private: t def; }; |