【发布时间】:2014-10-08 01:09:19
【问题描述】:
建议使用显式模板实例化来减少编译时间。我想知道该怎么做。例如
// a.h
template<typename T> class A {...};
template class A<int>; // explicit template instantiation to reduce compilation time
但是在每个包含 a.h 的翻译单元中,似乎 A<int> 将被编译。编译时间没有减少。如何使用显式模板实例化来减少编译时间?
【问题讨论】:
标签: c++ templates compilation