summaryrefslogtreecommitdiff
path: root/src/mbgl/util/ptr.hpp
blob: 87c4e9f7cf66e0b7daaff3f5052015c2c2582cf1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#pragma once

#include <memory>
#include <cassert>

namespace mbgl {
namespace util {

template <typename T>
class ptr : public ::std::shared_ptr<T> {
public:
    template <typename... Args>
    ptr(Args &&... args)
        : ::std::shared_ptr<T>(::std::forward<Args>(args)...) {}

    auto operator->() const -> decltype(this->::std::shared_ptr<T>::operator->()) {
        assert(*this);
        return ::std::shared_ptr<T>::operator->();
    }
    auto operator*() const -> decltype(this->::std::shared_ptr<T>::operator*()) {
        assert(*this);
        return ::std::shared_ptr<T>::operator*();
    }
};
} // namespace util
} // namespace mbgl