blob: fcb3f1bd33a0e9a57e13c53e7ae0b33efe392413 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
// 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 Value;
template <typename T> class WeightedValue;
/*
* Check for the presence of a weight.
*/
template <typename T>
struct is_WeightedValue;
template <typename T>
struct is_WeightedValue<Value<T>> : 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;
template <typename T>
struct ValueType<Value<T>> { using type = T; };
template <typename T>
struct ValueType<WeightedValue<T>> { using type = T; };
template <typename T>
using ValueType_t = typename ValueType<T>::type;
}
|