Aria 2.0.0
C++23 MVVM framework (C++20 minimum) — reactive, coroutine-first, ABI-layered
Loading...
Searching...
No Matches
aria::Observable Concept Reference

A read-only observable: has .get() and exposes its value_type. More...

#include <concepts.hpp>

Concept definition

template<typename T>
concept Observable = requires(T t) {
typename T::value_type;
{ t.get() } -> std::convertible_to<typename T::value_type>;
}
A read-only observable: has .get() and exposes its value_type.
Definition concepts.hpp:50

Detailed Description

A read-only observable: has .get() and exposes its value_type.

The on_changed surface is intentionally not part of the concept here because Property<T> and Computed<T> deliver it via type-erased Subscription on_changed(std::function<void(const T&)>) which is hard to express as a concept without inducing the very SFINAE noise we are trying to remove. Adapter code that genuinely needs both surfaces should constrain on Observable here AND check requires(t) { t.on_changed(...); } locally.