KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
See title. I have a template. I want to force a particular instance of a template to instantiate. How do I do this? More specifically, can you force an abstract template class to instantiate? I might elaborate as I have the same question. In my case I am building a library, some of the template implementations are large and include lots of stuff, but are only generated for a couple of types. I want to compile them in the library and export all the methods, but not include the header with the code everywhere. ie: template<class T> OS_EXPORT_DECL class MyTmpl { T *item1; public: inline T *simpleGetT() { return(item1); } /* small inline code in here */ } T *doSomeReallyBigMergeStuff(T *b); // note only declaration here }; // *** implementation source file only seen inside library template<class T> MyTmpl<T>::doSomeReallyBigMergeStuff(T *b) { ... a really big method, but don't want to duplicate it, so it is a template ... } I could of course reference all the methods inside the library which would force them to compile and export but the desire isn't to add un-needed code to the library like the argument formatting for the items and the code to call them etc. ????? specifically I am building the library for several versions of MSC and GCC and intel compilers.
Tags (comma-separated)
Save Edits
Cancel