summaryrefslogtreecommitdiffstats
path: root/searchcommon/src/vespa/searchcommon/attribute/multivalue.h
diff options
context:
space:
mode:
Diffstat (limited to 'searchcommon/src/vespa/searchcommon/attribute/multivalue.h')
-rw-r--r--searchcommon/src/vespa/searchcommon/attribute/multivalue.h31
1 files changed, 7 insertions, 24 deletions
diff --git a/searchcommon/src/vespa/searchcommon/attribute/multivalue.h b/searchcommon/src/vespa/searchcommon/attribute/multivalue.h
index 091bf78a4dd..7cb411fd840 100644
--- a/searchcommon/src/vespa/searchcommon/attribute/multivalue.h
+++ b/searchcommon/src/vespa/searchcommon/attribute/multivalue.h
@@ -7,21 +7,7 @@
namespace search::multivalue {
template <typename T>
-class Value {
-public:
- Value() noexcept : _v() {}
- Value(T v) noexcept : _v(v) { }
- T value() const noexcept { return _v; }
- const T& value_ref() const noexcept { return _v; }
- T& value_ref() noexcept { return _v; }
- operator T () const noexcept { return _v; }
- operator T & () noexcept { return _v; }
- bool operator ==(const Value<T> & rhs) const { return _v == rhs._v; }
- bool operator <(const Value<T> & rhs) const { return _v < rhs._v; }
- bool operator >(const Value<T> & rhs) const { return _v > rhs._v; }
-private:
- T _v;
-};
+using Value = T;
template <typename T>
class WeightedValue {
@@ -44,36 +30,33 @@ private:
};
template <typename T>
-inline int32_t get_weight(const Value<T>&) noexcept { return 1; }
+inline int32_t get_weight(const T&) noexcept { return 1; }
template <typename T>
inline int32_t get_weight(const WeightedValue<T>& value) noexcept { return value.weight(); }
template <typename T>
-inline T get_value(const Value<T> &value) noexcept { return value.value(); }
+inline T get_value(const T& value) noexcept { return value; }
template <typename T>
inline T get_value(const WeightedValue<T>& value) noexcept { return value.value(); }
template <typename T>
-inline const T& get_value_ref(const Value<T> &value) noexcept { return value.value_ref(); }
+inline const T& get_value_ref(const T& value) noexcept { return value; }
template <typename T>
inline const T& get_value_ref(const WeightedValue<T>& value) noexcept { return value.value_ref(); }
template <typename T>
-inline T& get_value_ref(Value<T> &value) noexcept { return value.value_ref(); }
+inline T& get_value_ref(T& value) noexcept { return value; }
template <typename T>
inline T& get_value_ref(WeightedValue<T>& value) noexcept { return value.value_ref(); }
template <typename M>
-struct ValueBuilder;
-
-template <typename T>
-struct ValueBuilder<Value<T>>
+struct ValueBuilder
{
- static Value<T> build(T value, int32_t) noexcept { return Value<T>(value); }
+ static M build(M value, int32_t) noexcept { return value; }
};
template <typename T>