@specsoftdev live:.cid.8e17e9b93cabb607 specsoftdev@gmail.com
std::none_of
Актуально для C++23.

#include <algorithm>
Актуально на 2024-02-16.


Define overload #1
template<class InputIterator, class Predicate>
constexpr inline
bool none_of(InputIterator first, InputIterator last, Predicate pred);

Вернёт true, если для всех элементов из диапазона [first, last], предикат "pred" возвратит false.
Иначе, вернёт false.
Example, possible implementation
Define overload #2
template <class ExecutionPolicy, class ForwardIterator, class Predicate>
bool none_of(ExecutionPolicy&& exec, ForwardIterator first, ForwardIterator last, Predicate pred);

Example, possible implementation

Examples


Example 1:
#include <iostream>
#include <algorithm>

int main()
{
    auto list = {'D', 'i', 'R', 'f'};

    auto no_upper = std::none_of(std::begin(list), std::end(list), [](auto s) { return std::isupper(s); });
    auto no_lower = std::none_of(std::begin(list), std::end(list), [](auto s) { return std::islower(s); });
    auto no_digit = std::none_of(std::begin(list), std::end(list), [](auto s) { return std::isdigit(s); });

    std::cout << std::boolalpha;
    std::cout << no_upper << std::endl;
    std::cout << no_lower << std::endl;
    std::cout << no_digit << std::endl;
    return 0;
}

false
false
true



Changelog

C++26
TODO
C++23
TODO
C++20
TODO
C++17
TODO
C++14
TODO
C++11
TODO


See also

TODO

This page was last modified on 2024-02-16