#pragma once #include #include namespace sf { class Texture; class Font; } template class ResourceHolder { public: bool load(Id id, const std::string& filename) { auto resource = std::make_unique(); if (!resource->loadFromFile(filename)) return false; _resources[id] = std::move(resource); return true; } Resource& get(Id id) const { const auto found = _resources.find(id); return *found->second; } private: std::map> _resources; }; namespace Fonts { enum class Id { GUI }; } using FontHolder = ResourceHolder;