kumi
v3.1.0
Exquisite Epidote
Loading...
Searching...
No Matches
◆
bit_xor()
[2/2]
template<concepts::product_type T, typename Value>
auto kumi::bit_xor
(
T &&
t
,
Value
init
)
inline
nodiscard
constexpr
Computes the bitwise XOR of all elements.
Parameters
t
Product type to operate on
init
Optional initial value of the reduction
Returns
The value of
get
<0>(t) ^ ... ^
get
<N-1>(t) ^ init
Helper type
namespace
kumi::result
{
template
<product_type T,
typename
Value>
struct
bit_xor
;
template
<product_type T,
typename
Value>
using
bit_xor_t =
typename
bit_xor<T,Value>::type
;
}
kumi::bit_xor
constexpr auto bit_xor(T &&t, Value init)
Computes the bitwise XOR of all elements.
Definition
reduce.hpp:472
Computes the return type of a call to
kumi::bit_xor
Examples:
#include <kumi/kumi.hpp>
#include <iostream>
int
main()
{
auto
t =
kumi::tuple
{1,
short
{8},
' '
, 4ULL};
std::cout <<
kumi::bit_xor
(t, 0) <<
"\n"
;
std::cout <<
kumi::bit_xor
(t) <<
"\n"
;
}
kumi::tuple
Fixed-size collection of heterogeneous values.
Definition
tuple.hpp:29
#include <kumi/kumi.hpp>
#include <iostream>
int
main()
{
using namespace
kumi::literals;
auto
t =
kumi::record
{
"a"
_id = 1,
"b"
_id =
short
{8},
"c"
_id =
' '
,
"d"
_id = 4ULL};
std::cout <<
kumi::bit_xor
(t, 0) <<
"\n"
;
std::cout <<
kumi::bit_xor
(t) <<
"\n"
;
}
kumi::record
Fixed-size collection of heterogeneous fields necessarily named, names are unique.
Definition
record.hpp:29
kumi