Function empty

Summary

#include <src/uvw/emitter.h>

(1) template <typename E>
    bool empty() const noexcept

(2) bool empty() const noexcept

Function overload

Synopsis

#include <src/uvw/emitter.h>

template <typename E>
bool empty() const noexcept

Description

Checks if there are listeners registered for the specific event.

Returns
True if there are no listeners registered for the specific event, false otherwise.

Source

Lines 293-300 in src/uvw/emitter.h.

template<typename E>
bool empty() const noexcept {
    std::size_t type = event_type<E>();
    return (!(type < handlers.size()) ||
            !handlers[type] ||
            static_cast<Handler<E>&>(*handlers[type]).empty());
}

Synopsis

#include <src/uvw/emitter.h>

bool empty() const noexcept

Description

Checks if there are listeners registered with the event emitter.

Returns
True if there are no listeners registered with the event emitter, false otherwise.

Source

Lines 307-310 in src/uvw/emitter.h.

bool empty() const noexcept {
    return std::all_of(handlers.cbegin(), handlers.cend(),
                       [](auto &&hdlr){ return !hdlr || hdlr->empty(); });
}





Add Discussion as Guest

Log in