Commit 2fbb85b5 authored by Dominik Charousset's avatar Dominik Charousset

Add operator-> to `param`

parent 2cc11799
...@@ -63,6 +63,11 @@ public: ...@@ -63,6 +63,11 @@ public:
return *x_; return *x_;
} }
const T* operator->() const {
return x_;
}
/// Detaches the value if needed and returns a mutable reference to it.
T& get_mutable() { T& get_mutable() {
if (flag_ == shared_access) { if (flag_ == shared_access) {
auto cpy = new T(get()); auto cpy = new T(get());
...@@ -72,6 +77,7 @@ public: ...@@ -72,6 +77,7 @@ public:
return *x_; return *x_;
} }
/// Moves the value out of the `param`.
T&& move() { T&& move() {
return std::move(get_mutable()); return std::move(get_mutable());
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment