Files
TL/include/tl/algorithm/count.h
T
jeanlemotan 8297b0b45f First
2024-07-02 18:06:33 +02:00

31 lines
881 B
C++

#pragma once
#include "tl/detail/prologue.h"
#include "tl/iterator.h"
#include <algorithm>
namespace tl
{
//////////////////////////////////////////////////////////////////////////
// count()
//
// Container-based version of the <algorithm> `std::count()` function to
// count values that match within a container
template <typename C, typename T>
auto count(const C& c, T&& value) noexcept -> typename std::iterator_traits<typename C::iterator>::difference_type;
// count_if()
//
// Container-based version of the <algorithm> `std::count()` function to
// count values that match within a container
template <typename C, typename UnaryPredicate>
auto count_if(const C& c, UnaryPredicate&& p) noexcept -> typename std::iterator_traits<typename C::iterator>::difference_type;
//////////////////////////////////////////////////////////////////////////
} // end namespace tl