<p>C++ 0x has template aliases (sometimes referred to as template typedefs). See <a href="http://en.wikipedia.org/wiki/C%2B%2B0x#Alias_templates" rel="noreferrer">here</a>. Current spec of C++ does not. </p>

<p>What do you like to use as work around ? Container objects or Macros ?
Do you feel its worth it ?</p>

[{'answer_id': 26162, 'author': 'Konrad Rudolph', 'author_id': 1968, 'author_profile': 'https://Stackoverflow.com/users/1968', 'pm_score': 8, 'selected': True, 'text': '<blockquote>\n  <p>What do you like to use as work around ? Container objects or Macros ? Do you feel its worth it ?</p>\n</blockquote>\n\n<p>The canonical way is to use a metafunction like thus:</p>\n\n<pre><code>template &lt;typename T&gt;\nstruct my_string_map {\n    typedef std::map&lt;std::string, T&gt; type;\n};\n\n// Invoke:\n\nmy_string_map&lt;int&gt;::type my_str_int_map;\n</code></pre>\n\n<p>This is also used in the STL (<code>allocator::rebind&lt;U&gt;</code>) and in many libraries including Boost. We use it extensively in a <a href="http://www.seqan.de/dddoc/html/index.html" rel="noreferrer">bioinformatical library</a>.</p>\n\n<p>It\'s bloated, but it\'s the best alternative 99% of the time. Using macros here is not worth the many downsides.</p>\n\n<p>(EDIT: I\'ve amended the code to reflect Boost/STL conventions as pointed out by Daniel in his comment.)</p>\n'}, {'answer_id': 2089853, 'author': 'xghost', 'author_id': 253585, 'author_profile': 'https://Stackoverflow.com/users/253585', 'pm_score': 4, 'selected': False, 'text': "<blockquote>\n<pre><code>template &lt;typename T&gt;\nstruct my_string_map : public std::map&lt;std::string,T&gt; \n{\n};\n</code></pre>\n</blockquote>\n\n<p>You shouldn't inherit from classes that do not have a virtual destructor. It's related to destructors in derived classes not being called when they should be and you could end up with unallocated memory.</p>\n\n<p>That being said you could *****probably***** get away with it in the instance above because you're not adding any more data to your derived type. Note that this is not an endorsement. I still advice you <strong>don't</strong> do it. The fact that you <em>can</em> do it doesn't mean you <em>should</em>.</p>\n\n<p>EDIT: Yes, this is a reply to ShaChris23's post. I probably missed something because it showed up above his/her message instead of below.</p>\n"}, {'answer_id': 15489480, 'author': 'Andrei Pokrovsky', 'author_id': 231742, 'author_profile': 'https://Stackoverflow.com/users/231742', 'pm_score': 0, 'selected': False, 'text': '<p>Sometimes you can just explicitly write out the untemplated typedefs for all the necessary types. If the base class is templated on multiple template args with only one type desired to be typedefed you can inherit a specialized class with typedef effectively included in the inherited class name. This approach is less abstruse than the metafunction approach.</p>\n'}]
['https://Stackoverflow.com/questions/26151', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2759/']