Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
all_are_same.hpp
Go to the documentation of this file.
1
// Copyright 2024, Toyota Motor Corporation
2
//
3
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5
#
ifndef
INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_TRAITS_ALL_ARE_SAME_HPP_
6
#
define
INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_TRAITS_ALL_ARE_SAME_HPP_
7
8
// IWYU pragma: private, include "arene/base/type_traits.hpp"
9
// IWYU pragma: friend "(arene/base(?!/tests)|stdlib/include/stdlib_detail)/.*"
10
11
#
include
"arene/base/stdlib_choice/is_same.hpp"
12
#
include
"arene/base/type_traits/all_of.hpp"
13
14
namespace
arene
{
15
namespace
base
{
16
17
/// A bool variable template that is true if all parameters are the same type,
18
/// otherwise false.
19
///
20
/// @note Not an ODR violation to ODR use a variable template definition from
21
/// multiple translation units.
22
template
<
class
...
T
>
23
extern
constexpr
bool
all_are_same_v
=
sizeof
...(
T
) < 2;
24
25
/// All the types are the same if more than one type and they are all the same
26
/// as the first.
27
template
<
class
T
,
class
...
Rest
>
28
extern
constexpr
bool
all_are_same_v
<
T
,
Rest
...> =
all_of_v
<
std
::
is_same
<
T
,
Rest
>::
value
...>;
29
30
}
// namespace base
31
}
// namespace arene
32
33
#
endif
// INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_TRAITS_ALL_ARE_SAME_HPP_
arene::base
Definition
array_exceptions_disabled.cpp:11
arene::base::all_are_same_v< T, Rest... >
constexpr bool all_are_same_v< T, Rest... >
arene::base::all_are_same_v
constexpr bool all_are_same_v
arene
Copyright 2026, Toyota Motor Corporation.
Definition
array_exceptions_disabled.cpp:10
arene
base
type_traits
all_are_same.hpp
Generated by
1.13.2