blob: 8710314ef2c906ec3b7949acf8c7b95a2c4781c1 (
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
27
28
29
30
31
32
33
34
|
#pragma once
#include <initializer_list>
#include <utility>
#include <functional>
namespace mbgl {
namespace gl {
using ProcAddress = void (*)();
template <class>
class ExtensionFunction;
template <class R, class... Args>
class ExtensionFunction<R(Args...)> {
public:
ExtensionFunction(const ProcAddress ptr_) : ptr(ptr_) {
}
explicit operator bool() const {
return ptr;
}
R operator()(Args... args) const {
return (*reinterpret_cast<R (*)(Args...)>(ptr))(std::forward<Args>(args)...);
}
private:
const ProcAddress ptr;
};
} // namespace gl
} // namespace mbgl
|