SeqAn3
3.4.0
The Modern C++ library for sequence analysis.
Toggle main menu visibility
Loading...
Searching...
No Matches
add_enum_bitwise_operators.hpp
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
2
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
3
// SPDX-License-Identifier: BSD-3-Clause
4
9
10
#pragma once
11
12
#include <
type_traits
>
13
14
#include <
seqan3/core/platform.hpp
>
15
16
namespace
seqan3
17
{
74
76
88
template
<
typename
t>
89
inline
constexpr
bool
add_enum_bitwise_operators =
false
;
90
101
template
<
typename
t>
102
constexpr
t
operator&
(t lhs, t rhs)
noexcept
103
requires
std::is_enum_v<t>
&& add_enum_bitwise_operators<t>
104
{
105
return
static_cast<
t
>
(
static_cast<
std::underlying_type_t<t>
>
(lhs) &
static_cast<
std::underlying_type_t<t>
>
(rhs));
106
}
107
108
template
<
typename
t>
109
constexpr
t
operator|
(t lhs, t rhs)
noexcept
110
requires
std::is_enum_v<t>
&& add_enum_bitwise_operators<t>
111
{
112
return
static_cast<
t
>
(
static_cast<
std::underlying_type_t<t>
>
(lhs) |
static_cast<
std::underlying_type_t<t>
>
(rhs));
113
}
114
115
template
<
typename
t>
116
constexpr
t operator^(t lhs, t rhs)
noexcept
117
requires
std::is_enum_v<t>
&& add_enum_bitwise_operators<t>
118
{
119
return
static_cast<
t
>
(
static_cast<
std::underlying_type_t<t>
>
(lhs) ^
static_cast<
std::underlying_type_t<t>
>
(rhs));
120
}
121
122
template
<
typename
t>
123
constexpr
t operator~(t lhs)
noexcept
124
requires
std::is_enum_v<t>
&& add_enum_bitwise_operators<t>
125
{
126
return
static_cast<
t
>
(~static_cast<std::underlying_type_t<t>>(lhs));
127
}
128
129
template
<
typename
t>
130
constexpr
t & operator&=(t & lhs, t rhs)
noexcept
131
requires
std::is_enum_v<t>
&& add_enum_bitwise_operators<t>
132
{
133
lhs = lhs & rhs;
134
return
lhs;
135
}
136
137
template
<
typename
t>
138
constexpr
t & operator|=(t & lhs, t rhs)
noexcept
139
requires
std::is_enum_v<t>
&& add_enum_bitwise_operators<t>
140
{
141
lhs = lhs | rhs;
142
return
lhs;
143
}
144
145
template
<
typename
t>
146
constexpr
t & operator^=(t & lhs, t rhs)
noexcept
147
requires
std::is_enum_v<t>
&& add_enum_bitwise_operators<t>
148
{
149
lhs = lhs ^ rhs;
150
return
lhs;
151
}
154
155
}
// namespace seqan3
seqan3::operator|
auto operator|(validator1_type &&vali1, validator2_type &&vali2)
Enables the chaining of validators.
Definition
validators.hpp:1120
enum_bitwise_operators::operator&
operator&(t lhs, t rhs)
Returns the binary & operator of lhs and rhs.
std::is_enum_v
T is_enum_v
seqan3
The main SeqAn3 namespace.
Definition
aligned_sequence_concept.hpp:26
platform.hpp
Provides platform and dependency checks.
type_traits
std::underlying_type_t
Hide me
Version:
seqan3
core
add_enum_bitwise_operators.hpp
Generated on
for SeqAn3 by
1.17.0