KUMI v3.1.0
Exquisite Epidote
Loading...
Searching...
No Matches

◆ bit_or() [2/2]

template<concepts::product_type T, typename Value>
auto kumi::bit_or ( T && t,
Value init )
inlinenodiscardconstexpr

Computes the bitwise OR of all elements.

On record types, this function operates on the underlying values, not on the fields themselves.

Parameters
tProduct type to operate on
initOptional 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_or;
template<product_type T, typename Value>
using bit_or_t = typename bit_or<T,Value>::type;
}
constexpr auto bit_or(T &&t, Value init)
Computes the bitwise OR of all elements.
Definition reduce.hpp:481

Computes the return type of a call to kumi::bit_or

Examples:

Tuple:

#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
auto t = kumi::tuple{1,short{8},' ', 4ULL};
std::cout << kumi::bit_or(t, 0) << "\n";
std::cout << kumi::bit_or(t) << "\n";
}
Fixed-size collection of heterogeneous values.
Definition tuple.hpp:33

Record:

#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_or(t, 0) << "\n";
std::cout << kumi::bit_or(t) << "\n";
}
Fixed-size collection of heterogeneous tagged fields, tags are unique.
Definition record.hpp:36