llvm::hasNItems

hasNItems overloads

Synopses

Declared in <llvm/ADT/STLExtras.h>

Return true if container C has exactly N items.

template<typename ContainerTy>
bool
hasNItems(
    ContainerTy&& C,
    unsigned int N);
» more...

Return true if []Begin, End) contains exactly N counted items.

template<
    typename IterTy,
    typename Pred = bool(*)( constdecltype(*std::declval<IterTy>())&)>
bool
hasNItems(
    IterTy&& Begin,
    IterTy&& End,
    unsigned int N,
    Pred&& ShouldBeCounted = [](const decltype(*std::declval<IterTy>()) &) { return true; })
requires !std::is_base_of<std::random_access_iterator_tag,
                         typename std::iterator_traits<std::remove_reference_t<
                             decltype(Begin)>>::iterator_category>::value;
» more...

Return true if []Begin, End) contains exactly N counted items.

template<
    typename IterTy,
    typename Pred = bool(*)( constdecltype(*std::declval<IterTy>())&)>
bool
hasNItems(
    IterTy&& Begin,
    IterTy&& End,
    unsigned int N,
    Pred&& ShouldBeCounted = [](const decltype(*std::declval<IterTy>()) &) { return true; })
requires !std::is_base_of<std::random_access_iterator_tag,
                         typename std::iterator_traits<std::remove_reference_t<
                             decltype(Begin)>>::iterator_category>::value;
» more...

Return Value

  • True if C has exactly N items.
  • True if the range contains exactly N counted items.

Parameters

NameDescription
CContainer to inspect.
NExact number of items required.
BeginIterator to the first element.
EndIterator past the last element.
ShouldBeCountedPredicate selecting which items count toward N.