diff options
Diffstat (limited to 'include/mbgl/util/immutable.hpp')
-rw-r--r-- | include/mbgl/util/immutable.hpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/mbgl/util/immutable.hpp b/include/mbgl/util/immutable.hpp index eb26c0d282..b4117166dd 100644 --- a/include/mbgl/util/immutable.hpp +++ b/include/mbgl/util/immutable.hpp @@ -39,6 +39,7 @@ private: template <class S> friend class Immutable; template <class S, class... Args> friend Mutable<S> makeMutable(Args&&...); + template <class S, class U> friend Mutable<S> staticMutableCast(const Mutable<U>&); }; template <class T, class... Args> @@ -46,6 +47,11 @@ Mutable<T> makeMutable(Args&&... args) { return Mutable<T>(std::make_shared<T>(std::forward<Args>(args)...)); } +template <class S, class U> +Mutable<S> staticMutableCast(const Mutable<U>& u) { + return Mutable<S>(std::static_pointer_cast<S>(u.ptr)); +} + /** * `Immutable<T>` is a non-nullable shared reference to a `const T`. Construction requires * a transfer of unique ownership from a `Mutable<T>`; once constructed it has the same behavior |