diff options
Diffstat (limited to 'include/mbgl/style/layer.hpp')
-rw-r--r-- | include/mbgl/style/layer.hpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/mbgl/style/layer.hpp b/include/mbgl/style/layer.hpp index a66ff37b22..cfaca60e60 100644 --- a/include/mbgl/style/layer.hpp +++ b/include/mbgl/style/layer.hpp @@ -6,6 +6,8 @@ #include <mbgl/style/types.hpp> #include <mbgl/style/conversion.hpp> +#include <mapbox/weak.hpp> + #include <cassert> #include <memory> #include <string> @@ -124,10 +126,15 @@ public: const LayerTypeInfo* getTypeInfo() const noexcept; + mapbox::base::WeakPtr<Layer> makeWeakPtr() { + return weakFactory.makeWeakPtr(); + } + protected: virtual Mutable<Impl> mutableBaseImpl() const = 0; LayerObserver* observer; + mapbox::base::WeakPtrFactory<Layer> weakFactory {this}; }; } // namespace style |