Reduce template instantiations of std::vector<std::string>

The new StringMap code for luax_enumerror causes code to be generated for
std::vector. By using an extern template (an old feature standardised in c++11)
we can instantiate it once instead, in StringMap.cpp.

--HG--
branch : minor
This commit is contained in:
Bart van Strien
2017-10-16 14:40:17 +02:00
parent 75e0caa0ff
commit bf1a9344eb
3 changed files with 32 additions and 0 deletions
+6
View File
@@ -26,6 +26,12 @@
#include <string>
#include <vector>
// As StringMap instantiates std::vector<std::string> for instances that use
// getNames(), we end up with multiple copies in the object files. This
// declaration means we only emit it once (in StringMap.cpp).
extern template class std::vector<std::string>;
extern template decltype(std::vector<std::string>().emplace_back("")) std::vector<std::string>::emplace_back<const char *const&>(const char *const&);
namespace love
{