|
Clingo
|
An immutable value imlementation. More...
#include <immutable_value.hh>
Public Types | |
| using | element_type = T |
| The type of the stored pointer. | |
Public Member Functions | |
| constexpr | immutable_value () noexcept=default |
| Construct a null pointer. | |
| constexpr | immutable_value (std::nullptr_t) noexcept |
| Explicitly construct a null pointer. | |
|
template<class U > requires (!std::same_as<std::remove_cvref_t<U>, immutable_value>) | |
| immutable_value (U &&value) | |
| Construct a value. | |
| template<class... Args> | |
| immutable_value (std::in_place_t tag, Args &&...args) | |
| Construct a value in place. | |
| immutable_value (immutable_value const &other) noexcept | |
| Copy an immutable value. | |
| immutable_value (immutable_value &&other) noexcept | |
| Move construct an immutable value. | |
| auto | operator= (immutable_value const &other) noexcept -> immutable_value & |
| Copy assign an immutable value. | |
| auto | operator= (immutable_value &&other) noexcept -> immutable_value & |
| Move assign an immutable value. | |
| ~immutable_value () noexcept | |
| Decrement reference count and delete contained pointer if zero. | |
| auto | has_value () const noexcept -> bool |
| Check if the value is engaged. | |
| operator bool () const noexcept | |
| Check if the value is engaged. | |
| auto | get () const noexcept -> element_type const & |
| Get the value. | |
| auto | operator* () const noexcept -> element_type const & |
| Get the value. | |
| auto | operator-> () const noexcept -> element_type const * |
| Get the member of pointer. | |
| operator T const & () const noexcept | |
| Conversion operator. | |
Related Symbols | |
(Note that these are not member symbols.) | |
| template<class X , class Y > | |
| auto | operator== (const immutable_value< X > &lhs, const immutable_value< Y > &rhs) -> bool |
| Compare two immutable values. | |
| template<class X , class Y > | |
| auto | operator (const immutable_value< X > &lhs, const immutable_value< Y > &rhs) |
| Compare two immutable values. | |
An immutable value imlementation.
It is faster than the std::shared_ptr implementation. However, it cannot be used safely in multi-threaded applications.