diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-05-20 13:17:27 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-05-20 13:18:51 +0000 |
commit | ec9ef7bba03fe9287fe37a8c88f9d025a4b2ef67 (patch) | |
tree | 8bc8417e895e509af4b9c333e3ea08525f475736 /searchlib/src/vespa/searchcommon/attribute/multi_value_traits.h | |
parent | f5f7b0cb60569fc05c100a8b83b9fd721ec37183 (diff) |
Fold searchcommon into searchlib
Diffstat (limited to 'searchlib/src/vespa/searchcommon/attribute/multi_value_traits.h')
-rw-r--r-- | searchlib/src/vespa/searchcommon/attribute/multi_value_traits.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/searchlib/src/vespa/searchcommon/attribute/multi_value_traits.h b/searchlib/src/vespa/searchcommon/attribute/multi_value_traits.h new file mode 100644 index 00000000000..f03b031f991 --- /dev/null +++ b/searchlib/src/vespa/searchcommon/attribute/multi_value_traits.h @@ -0,0 +1,35 @@ +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#pragma once + +#include <type_traits> + +namespace search::multivalue { + +template <typename T> class WeightedValue; + +/* + * Check for the presence of a weight. + */ +template <typename T> +struct is_WeightedValue : std::false_type {}; + +template <typename T> +struct is_WeightedValue<WeightedValue<T>> : std::true_type {}; + +template <typename T> +inline constexpr bool is_WeightedValue_v = is_WeightedValue<T>::value; + +/* + * Extract inner type. + */ +template <typename T> +struct ValueType { using type = T; }; + +template <typename T> +struct ValueType<WeightedValue<T>> { using type = T; }; + +template <typename T> +using ValueType_t = typename ValueType<T>::type; + +} |