summaryrefslogtreecommitdiffhomepage
path: root/options/slider.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'options/slider.hpp')
-rw-r--r--options/slider.hpp36
1 files changed, 14 insertions, 22 deletions
diff --git a/options/slider.hpp b/options/slider.hpp
index 360c85b8..1366e390 100644
--- a/options/slider.hpp
+++ b/options/slider.hpp
@@ -22,35 +22,27 @@ namespace options
{
double cur_, min_, max_;
- template<typename t>
- using arith_conversion_t = std::enable_if_t<std::is_arithmetic_v<std::decay_t<t>>, std::decay_t<t>>;
public:
- slider_value(double cur, double min, double max);
+ constexpr slider_value(double cur, double min, double max);
- template<typename t, typename u, typename v> slider_value(t cur, u min, v max) :
+ template<typename t, typename u, typename v>
+ constexpr slider_value(t cur, u min, v max) :
cur_(double(cur)),
min_(double(min)),
max_(double(max))
{}
- template<typename t>
- cc_noinline
- operator arith_conversion_t<t>() const
- {
- return t(cur_);
- }
-
- slider_value& operator=(const slider_value& v);
-
- slider_value(const slider_value& v);
- slider_value();
- bool operator==(const slider_value& v) const;
- bool operator!=(const slider_value& v) const;
- operator double() const { return cur_; }
- double cur() const { return cur_; }
- double min() const { return min_; }
- double max() const { return max_; }
- slider_value update_from_slider(int pos, int q_min, int q_max) const;
+ slider_value& operator=(const slider_value& v) = default;
+ constexpr slider_value(const slider_value& v) = default;
+ constexpr slider_value() : slider_value{0, 0, 0} {};
+
+ constexpr bool operator==(const slider_value& v) const;
+ constexpr bool operator!=(const slider_value& v) const;
+ constexpr operator double() const { return cur_; }
+ constexpr double cur() const { return cur_; }
+ constexpr double min() const { return min_; }
+ constexpr double max() const { return max_; }
+ constexpr slider_value update_from_slider(int pos, int q_min, int q_max) const;
int to_slider_pos(int q_min, int q_max) const;
};
}