template<typename ValueType, typename EnclosingType>
class observable::value< ValueType, EnclosingType >
Value specialization that can be used inside a class, as a member, to prevent external code from calling set(), but still allow anyone to subscribe.
- See also
- value<ValueType>
This specialization is exactly the same as the main value specialization, but its setters are only accessible from inside the EnclosingType.
- Template Parameters
-
ValueType | The value-type that will be stored inside the observable. |
EnclosingType | A type that will have access to the value's setters. |
|
| value ()=default |
|
| value ()=default |
| Create a default-constructed observable value. More...
|
|
| value (ValueType initial_value) noexcept(std::is_nothrow_move_constructible< ValueType >::value) |
| Create an initialized observable value. More...
|
|
template<typename EqualityComparator > |
| value (ValueType initial_value, EqualityComparator equal) noexcept(std::is_nothrow_move_constructible< ValueType >::value &&std::is_nothrow_move_constructible< EqualityComparator >::value) |
| Create an initialized observable value. More...
|
|
template<typename UpdaterType > |
| value (std::unique_ptr< UpdaterType > &&ud) |
| Create an initialized value that will be updated by the provided value_updater. More...
|
|
| operator ValueType const & () const noexcept |
| Convert the observable value to its stored value type. More...
|
|
auto | get () const noexcept -> ValueType const & |
| Retrieve the stored value. More...
|
|
template<typename Callable > |
auto | subscribe (Callable &&observer) const |
| Subscribe to changes to the observable value. More...
|
|
template<typename Callable > |
auto | subscribe_and_call (Callable &&observer) const |
| Subscribe to changes to the observable value and also call the observer callback immediately with the current value. More...
|
|
void | set (ValueType new_value) |
| Set a new value, possibly notifying any subscribed observers. More...
|
|
auto | operator= (ValueType new_value) -> value & |
| Set a new value. More...
|
|
| ~value () |
| Destructor. More...
|
|
| value (value< ValueType > const &)=delete |
| Observable values are not copy-constructible. More...
|
|
auto | operator= (value< ValueType > const &) -> value< ValueType > &=delete |
| Observable values are not copy-assignable. More...
|
|
template<typename = std::enable_if_t<std::is_move_constructible<ValueType>::value>> |
| value (value< ValueType > &&other) noexcept(std::is_nothrow_move_constructible< ValueType >::value) |
| Observable values are move-constructible. More...
|
|
template<typename = std::enable_if_t<std::is_move_assignable<ValueType>::value>> |
auto | operator= (value< ValueType > &&other) noexcept(std::is_nothrow_move_assignable< ValueType >::value) -> value< ValueType > & |
| Observable values are move-assignable. More...
|
|