diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-02-28 16:55:08 +0200 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-02-28 17:45:21 +0200 |
commit | ceec74f52ff74876dcce9470d8f474b013783480 (patch) | |
tree | 9c9b6caf5167f5bc7525f5c850d0d403dd10a30b /include | |
parent | 810999fadf41576204752113f33336a69603de4a (diff) | |
download | qtlocation-mapboxgl-ceec74f52ff74876dcce9470d8f474b013783480.tar.gz |
[core] peer must not wrap itself
Diffstat (limited to 'include')
-rw-r--r-- | include/mbgl/util/peer.hpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/mbgl/util/peer.hpp b/include/mbgl/util/peer.hpp index d56526b80d..d16efddb57 100644 --- a/include/mbgl/util/peer.hpp +++ b/include/mbgl/util/peer.hpp @@ -12,7 +12,9 @@ public: peer() noexcept : storage(nullptr, noop_deleter) {} template <class T> - peer(T&& value) noexcept : storage(new std::decay_t<T>(std::forward<T>(value)), cast_deleter<std::decay_t<T>>) {} + peer(T&& value) noexcept : storage(new std::decay_t<T>(std::forward<T>(value)), cast_deleter<std::decay_t<T>>) { + static_assert(!std::is_same<peer, std::decay_t<T>>::value, "Peer must not wrap itself."); + } bool has_value() const noexcept { return static_cast<bool>(storage); } |