summaryrefslogtreecommitdiff
path: root/src/mbgl/util/ptr.hpp
blob: 2dc811818151ac14e874fc0f7e91e18e5e1d0813 (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>
    inline ptr(Args &&... args)
        : ::std::shared_ptr<T>(::std::forward<Args>(args)...) {}

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