tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
contains.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2024 Tobias Hienzsch
3
4#ifndef TETL_MPL_CONTAINS_HPP
5#define TETL_MPL_CONTAINS_HPP
6
7#include <etl/_mpl/list.hpp>
8#include <etl/_type_traits/bool_constant.hpp>
9#include <etl/_type_traits/is_same.hpp>
10
11namespace etl::mpl {
12
13/// \ingroup mpl
14/// @{
15
16template <typename Needle, typename Haystack>
17struct contains;
18
19template <typename Needle, typename... Ts>
20struct contains<Needle, list<Ts...>> : etl::bool_constant<(etl::is_same_v<Needle, Ts> or ...)> { };
21
22template <typename Needle, typename Haystack>
23inline constexpr auto contains_v = contains<Needle, Haystack>::value;
24
25/// @}
26
27} // namespace etl::mpl
28
29#endif // TETL_MPL_CONTAINS_HPP
Definition at.hpp:10
constexpr auto contains_v
Definition contains.hpp:23
Definition adjacent_find.hpp:9
Definition list.hpp:11