Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我最近开始使用 SFML,并注意到没有提供任何类型的“FreeResource”方法。例如,sf::Font有一个名为 的函数LoadFromFile,但没有释放资源的函数。
sf::Font
LoadFromFile
我觉得这很奇怪。我错过了什么吗?我唯一的选择是创建sf::Font指针并动态分配和删除它吗?
sf::Font将其字体数据存储在一个std::map名为 myGlyphs 的文件中(参见源代码)。当 Font 的析构函数被调用时,该映射中的所有内容都将被自动释放(由std::map析构函数)。
std::map