-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathcontains.hpp
40 lines (31 loc) · 953 Bytes
/
contains.hpp
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
// Copyright (c) 2017-2020 Daniel Frey
// Please see LICENSE for license or visit https://github.com/taocpp/sequences/
#ifndef TAO_SEQ_CONTAINS_HPP
#define TAO_SEQ_CONTAINS_HPP
#include "integer_sequence.hpp"
#include "is_any.hpp"
#include "sequence_helper.hpp"
namespace tao
{
namespace sequence
{
namespace impl
{
template< typename T >
struct contains
{
template< T N, T... Ns >
using type = is_any< ( N == Ns )... >;
};
template< typename T, T... Ns >
struct contains< integer_sequence< T, Ns... > >
{
template< T N >
using type = is_any< ( N == Ns )... >;
};
} // namespace impl
template< typename T, typename impl::element_type< T >::type N, T... Ns >
using contains = typename impl::contains< T >::template type< N, Ns... >;
} // namespace sequence
} // namespace tao
#endif