summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--compat/macros.hpp8
-rw-r--r--options/base-value.hpp1
-rw-r--r--options/tie.hpp4
-rw-r--r--options/value-traits.hpp5
4 files changed, 8 insertions, 10 deletions
diff --git a/compat/macros.hpp b/compat/macros.hpp
index 497933cf..b6eea12b 100644
--- a/compat/macros.hpp
+++ b/compat/macros.hpp
@@ -15,11 +15,3 @@ namespace cxx20_compat {
template<typename t>
using remove_cvref_t = typename cxx20_compat::remove_cvref<t>::type;
-
-template<typename t>
-using to_const_ref_t = std::add_lvalue_reference_t<std::add_const_t<remove_cvref_t<t>>>;
-
-template<typename t>
-using cv_qualified = std::conditional_t<std::is_fundamental_v<remove_cvref_t<t>>,
- remove_cvref_t<t>,
- to_const_ref_t<t>>;
diff --git a/options/base-value.hpp b/options/base-value.hpp
index d0fa42cf..eb8c89b7 100644
--- a/options/base-value.hpp
+++ b/options/base-value.hpp
@@ -26,6 +26,7 @@ class OTR_OPTIONS_EXPORT value_ : public QObject
{
Q_OBJECT
+ template<typename t> using cv_qualified = detail::cv_qualified<t>;
template<typename t>
using signal_sig = void(value_::*)(cv_qualified<t>) const;
diff --git a/options/tie.hpp b/options/tie.hpp
index 5cd8cbbc..46ade075 100644
--- a/options/tie.hpp
+++ b/options/tie.hpp
@@ -56,14 +56,14 @@ void tie_setting(value<t>& v, QComboBox* cb, From&& fn_to_index, To&& fn_to_valu
&v, [&v, cb, fn_to_value](int idx) { v = fn_to_value(idx, cb->currentData()); },
v.DIRECT_CONNTYPE);
value_::connect(&v, value_::value_changed<t>(),
- cb, [cb, fn_to_index](cv_qualified<t>& v) { cb->setCurrentIndex(fn_to_index(v)); },
+ cb, [cb, fn_to_index](detail::cv_qualified<t>& v) { cb->setCurrentIndex(fn_to_index(v)); },
v.DIRECT_CONNTYPE);
}
template<typename t, typename F>
void tie_setting(value<t>& v, QLabel* lb, F&& fun)
{
- auto closure = [lb, fun](cv_qualified<t> v) { lb->setText(fun(v)); };
+ auto closure = [lb, fun](detail::cv_qualified<t> v) { lb->setText(fun(v)); };
closure(v());
value_::connect(&v, value_::value_changed<t>(),
diff --git a/options/value-traits.hpp b/options/value-traits.hpp
index 308e110c..145cd924 100644
--- a/options/value-traits.hpp
+++ b/options/value-traits.hpp
@@ -9,6 +9,11 @@
#include <QString>
namespace options::detail {
+template<typename t>
+using cv_qualified =
+ std::conditional_t<std::is_fundamental_v<std::remove_cvref_t<t>>,
+ std::remove_cvref_t<t>,
+ std::add_lvalue_reference_t<std::add_const_t<std::remove_cvref_t<t>>>>;
template<typename t, typename u = t, typename Enable = void>
struct default_value_traits