1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#pragma once namespace mbgl { namespace gl { template <typename T> class Preserve { public: Preserve() : data(T::Get()) { } ~Preserve() { T::Set(data); } private: const typename T::Type data; }; } // namespace gl } // namespace mbgl