class EE::ObservableVector::SharedHandle

Overview

Shared read and observation access for adapters that may outlive this wrapper. More…

#include <observablevector.hpp>

class SharedHandle {
public:
    // methods

    const std::vector<T>& get() const;
    const T& operator[](std::size_t index) const;
    std::size_t size() const;
    operator bool() const;
    Connection observe(Callback callback) const;
};

Detailed Documentation

Shared read and observation access for adapters that may outlive this wrapper.

Retaining this handle keeps the collection storage alive. Mutations remain available only through ObservableVector, so the handle becomes a stable read-only snapshot once its owning wrapper is destroyed.

Methods

const std::vector<T>& get() const

Returns:

Read-only access to the retained collection.

const T& operator[](std::size_t index) const

Returns:

The retained value at index. No bounds checking is performed.

std::size_t size() const

Returns:

The number of retained values.

operator bool() const

Returns:

Whether this handle retains collection storage.

Connection observe(Callback callback) const

Returns:

A scoped connection observing later mutations of the owning ObservableVector.