title: How do I force a particular instance of a C++ template to instantiate?
body: <p>See title. I have a template. I want to force a particular instance of a template to instantiate. How do I do this?</p>
  
  <p>More specifically, can you force an abstract template class to instantiate?</p>
  
  <hr>
  
  <p>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.</p>
  
  <p>ie:</p>
  
  <pre><code>template&lt;class T&gt;
  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&lt;class T&gt;
  MyTmpl&lt;T&gt;::doSomeReallyBigMergeStuff(T *b)
  {
      ... a really big method, but don't want to duplicate it, 
          so it is a template ...
  }
  </code></pre>
  
  <p>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.</p>
  
  <p>?????  specifically I am building the library for several versions of MSC and GCC and intel compilers.</p>