31 lines
881 B
C++
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
|
|
|