aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchcommon/attribute/multi_value_traits.h
blob: f03b031f991728c8e3ebcefdfcfee99567a09690 (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
// 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;

}