Return the nested singleton match in Range, or a failure pair.

Synopsis

Declared in <llvm/ADT/STLExtras.h>

template<
    typename T,
    typename R,
    typename Predicate>
std::pair<T*, bool>
find_singleton_nested(
    R&& Range,
    Predicate P,
    bool AllowRepeats = false);

Description

P returns std::pair<T *, bool> where the pointer is the candidate and the bool reports that multiples were already found. Returns nullptr when no values or multiple values were found, with a bool indicating whether multiples caused the nullptr. When AllowRepeats is true, multiple equal values are allowed. It is expected that first is nullptr when second is true. This allows using find_singleton_nested within the predicate P.

Return Value

Pair of the singleton match and whether multiples caused failure.

Parameters

Name

Description

Range

Range to search.

P

Nested singleton predicate.

AllowRepeats

Whether equal repeats of the same value are allowed.

Created with MrDocs