summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-01-15 15:43:10 +0200
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-01-15 15:43:10 +0200
commitf5e49a422d2f5e0a9e7fafadd27acbcd56f3f803 (patch)
treeaa72187744c3c148c1c3da0636da4800092f523c
parent12295ef3355170d1877da5ef183eecfe7ad982be (diff)
downloadqtlocation-mapboxgl-upstream/mikhail_immutable_modifications.tar.gz
[core] Simplify mbgl::Immutableupstream/mikhail_immutable_modifications
-rw-r--r--include/mbgl/util/immutable.hpp20
1 files changed, 5 insertions, 15 deletions
diff --git a/include/mbgl/util/immutable.hpp b/include/mbgl/util/immutable.hpp
index b4117166dd..4d251df8d9 100644
--- a/include/mbgl/util/immutable.hpp
+++ b/include/mbgl/util/immutable.hpp
@@ -69,12 +69,11 @@ public:
: ptr(std::const_pointer_cast<const S>(std::move(s.ptr))) {}
template <class S>
- Immutable(Immutable<S>&& s)
+ Immutable(Immutable<S> s)
: ptr(std::move(s.ptr)) {}
- template <class S>
- Immutable(const Immutable<S>& s)
- : ptr(s.ptr) {}
+ Immutable(Immutable&&) = default;
+ Immutable(const Immutable&) = default;
template <class S>
Immutable& operator=(Mutable<S>&& s) {
@@ -82,17 +81,8 @@ public:
return *this;
}
- template <class S>
- Immutable& operator=(Immutable<S>&& s) {
- ptr = std::move(s.ptr);
- return *this;
- }
-
- template <class S>
- Immutable& operator=(const Immutable<S>& s) {
- ptr = s.ptr;
- return *this;
- }
+ Immutable& operator=(Immutable&&) = default;
+ Immutable& operator=(const Immutable&) = default;
const T* get() const { return ptr.get(); }
const T* operator->() const { return ptr.get(); }