|
| | Shared ()=default |
| |
template<class U = T>
requires (!std::is_same_v<std::remove_cvref_t<U>, Shared> && std::is_constructible_v<T, U &&>) |
| | Shared (U &&value) |
| | Hold a T built from value: Shared<std::string> s = "text".
|
| |
template<class A , class B , class... Rest>
requires std::is_aggregate_v<T> |
| | Shared (A &&a, B &&b, Rest &&...rest) |
| | Build an aggregate T in place: Shared<MethodId>{"La;", "run", "()V"}.
|
| |
| const T & | get () const noexcept |
| |
| const T & | operator* () const noexcept |
| |
| const T * | operator-> () const noexcept |
| |
template<class T>
class dex::model::Shared< T >
An immutable value held by a shared pointer.
Copies share one allocation, but a Shared compares by value and can never be changed in place — to change it, assign a new value — so the sharing is invisible except for memory use. Instruction operands use it: a large method refers to the same few strings, types and members thousands of times.
A default-constructed (or moved-from) Shared holds T{}.