blob: 5415a3177f8382cc4c0295791b9a7700d734e86c (
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
|
#pragma once
#include <memory>
namespace mbgl {
// Using this type as a return type enforces the client to retain the returned object.
template <typename T>
class Pass {
public:
Pass(T&& obj_) : obj(std::forward<T>(obj_)) {}
Pass(Pass&&) noexcept = default;
Pass(const Pass&) = delete;
Pass& operator=(const Pass&) = delete;
operator T() && { return std::move(obj); }
private:
T obj;
};
template <typename T>
using PassRefPtr = Pass<std::shared_ptr<T>>;
} // namespace mbgl
|