1 #pragma once
2 
3 #include <initializer_list>
4 #include <utility>
5 #include <functional>
6 
7 namespace mbgl {
8 namespace gl {
9 
10 using ProcAddress = void (*)();
11 
12 template <class>
13 class ExtensionFunction;
14 
15 template <class R, class... Args>
16 class ExtensionFunction<R(Args...)> {
17 public:
ExtensionFunction(const ProcAddress ptr_)18     ExtensionFunction(const ProcAddress ptr_) : ptr(ptr_) {
19     }
20 
operator bool() const21     explicit operator bool() const {
22         return ptr;
23     }
24 
operator ()(Args...args) const25     R operator()(Args... args) const {
26         return (*reinterpret_cast<R (*)(Args...)>(ptr))(std::forward<Args>(args)...);
27     }
28 
29 private:
30     const ProcAddress ptr;
31 };
32 
33 } // namespace gl
34 } // namespace mbgl
35