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

◆ bit_and() [2/2]

template<product_type T, typename Value >
constexpr auto kumi::bit_and ( T &&  t,
Value  init 
)
inlineconstexpr

Computes the bitwise AND of all elements.

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_and;
template<product_type T, typename Value>
using bit_and_t = typename bit_and<T,Value>::type;
}

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

Example

#include <kumi/kumi.hpp>
#include <iostream>
int main()
{
auto t = kumi::tuple{14,short{7}, 255ULL};
std::cout << kumi::bit_and(t, 65535) << "\n";
std::cout << kumi::bit_and(t) << "\n";
}
constexpr auto bit_and(T &&t, Value init)
Computes the bitwise AND of all elements.
Definition reduce.hpp:353
Fixed-size collection of heterogeneous values.
Definition tuple.hpp:37