Function disconnect

Summary

#include <src/entt/signal/sigh.hpp>

(1) template <auto Candidate>
    void disconnect()

(2) template <auto Candidate, typename Type>
    void disconnect(Type &&value_or_instance)

(3) template <typename Type>
    void disconnect(Type &value_or_instance)

(4) template <typename Type>
    void disconnect(Type *value_or_instance)

(5) void disconnect()

Function overload

Synopsis

#include <src/entt/signal/sigh.hpp>

template <auto Candidate>
void disconnect()

Description

Disconnects a free function or an unbound member from a signal.

Template Parameters

Candidate - Function or member to disconnect from the signal.

Source

Lines 442-448 in src/entt/signal/sigh.hpp.

template<auto Candidate>
void disconnect() {
    auto &calls = signal->calls;
    delegate<Ret(Args...)> call{};
    call.template connect<Candidate>();
    calls.erase(std::remove(calls.begin(), calls.end(), std::move(call)), calls.end());
}

Synopsis

#include <src/entt/signal/sigh.hpp>

template <auto Candidate, typename Type>
void disconnect(Type &&value_or_instance)

Description

Disconnects a free function with payload or a bound member from a signal.

Template Parameters

Candidate - Function or member to disconnect from the signal.

Type - Type of class or type of payload.

Parameters

value_or_instance - A valid object that fits the purpose.

Source

Lines 457-463 in src/entt/signal/sigh.hpp.

template<auto Candidate, typename Type>
void disconnect(Type &&value_or_instance) {
    auto &calls = signal->calls;
    delegate<Ret(Args...)> call{};
    call.template connect<Candidate>(value_or_instance);
    calls.erase(std::remove(calls.begin(), calls.end(), std::move(call)), calls.end());
}

Synopsis

#include <src/entt/signal/sigh.hpp>

template <typename Type>
void disconnect(Type &value_or_instance)

Description

Disconnects free functions with payload or bound members from a signal.

Template Parameters

Type - Type of class or type of payload.

Parameters

value_or_instance - A valid object that fits the purpose.

Source

Lines 471-474 in src/entt/signal/sigh.hpp.

template<typename Type>
void disconnect(Type &value_or_instance) {
    disconnect(&value_or_instance);
}

Synopsis

#include <src/entt/signal/sigh.hpp>

template <typename Type>
void disconnect(Type *value_or_instance)

Description

Disconnects free functions with payload or bound members from a signal.

Template Parameters

Type - Type of class or type of payload.

Parameters

value_or_instance - A valid object that fits the purpose.

Source

Lines 482-490 in src/entt/signal/sigh.hpp.

template<typename Type>
void disconnect(Type *value_or_instance) {
    if(value_or_instance) {
        auto &calls = signal->calls;
        calls.erase(std::remove_if(calls.begin(), calls.end(), [value_or_instance](const auto &delegate) {
            return delegate.instance() == value_or_instance;
        }), calls.end());
    }
}

Synopsis

#include <src/entt/signal/sigh.hpp>

void disconnect()

Description

Disconnects all the listeners from a signal.

Source

Lines 493-495 in src/entt/signal/sigh.hpp.

void disconnect() {
    signal->calls.clear();
}





Add Discussion

Log in to comment