Loading [MathJax]/extensions/tex2jax.js
kumi v3.1.0
Exquisite Epidote
 
All Classes Namespaces Functions Variables Friends Modules Pages Concepts
Loading...
Searching...
No Matches

◆ count_if()

template<typename Pred , typename T >
constexpr std::size_t kumi::count_if ( T const ts,
Pred  p 
)
constexprnoexcept

Counts the number of elements of t satisfying predicates p.

Parameters
tsValue to process
pUnary predicate. p must return a value convertible to bool for every element of t.
Returns
Number of elements satisfying the condition.

Example:

#include <kumi/tuple.hpp>
#include <iostream>
#include <type_traits>
int main()
{
auto t = kumi::tuple{1, 2., 3.f, 'z'};
std::cout << std::boolalpha
std::cout << std::boolalpha
}
constexpr std::size_t count_if(T const &ts, Pred p) noexcept
Counts the number of elements of t satisfying predicates p.
Definition predicates.hpp:133
constexpr auto from_tuple(tuple< Ts... > const &t)
Converts a kumi::tuple to an instance of an arbitrary type.
Definition convert.hpp:59
Fixed-size collection of heterogeneous values.
Definition tuple.hpp:35