// // Created by eric on 5/13/20. // #ifndef TGCLIC_UTILS_H #define TGCLIC_UTILS_H #include namespace detail { template struct overload; template struct overload : public F { explicit overload(F f) : F(f) { } }; template struct overload : public overload , overload { overload(F f, Fs... fs) : overload(f), overload(fs...) { } using overload::operator(); using overload::operator(); }; } // namespace detail template auto overloaded(F... f) { return detail::overload(f...); } template class singleton { private: static std::unique_ptr p; public: static T& instance(){ return *p; } }; template std::unique_ptr singleton::p = std::make_unique(); #endif //TGCLIC_UTILS_H