c++ - Using extern template class with STL classes -
i'm trying limit template instantiations of std::map, std::multimap, , std::vector 1 object file in attempt improve compile , link times. far understand, reason can't use
#include <vector> extern template class std::vector<int>; std::vector<int> myobj;
is vs10's header contains definitions of members, they're treated inline compiler, , instantiated anyways. assumption correct work if remove function bodies header? if so, happen have such header, , able share it?
i've tried listing members so
extern template std::vector<int>::vector(); // works extern template std::vector<int>::~vector(); // no effect
and while ctor removed, dtor still defined according dumpbin
. reason that? because reason dtor considered inline , ctor not?
it's standard stl data structures implemented in header files, isn't vs10 specific. why want limit 1 object file?
there problems splitting templates between headers , source files - can search that.
Comments
Post a Comment