title: Generating C++ typename by concatenating template parameter with a string
body: <p>I'm trying to figure out a way to use Boost::MPL to generate a typename which is the concatenation of a template parameter and a string.</p>
  
  <p>I have pairs of classes which are named: <code>X</code> and <code>XProvider</code>.  The latter is a factory class which instantiates objects inherited from the former type.</p>
  
  <p>The template class is intended to manage the instantiation of types at runtime: it contains, among other things, an unordered_map and some other misc. members.  </p>
  
  <p>What I am ultimately trying to achieve is a metafunction that looks something like this:</p>
  
  <p>Given the class </p>
  
  <pre><code>template &lt;typename T&gt;
  class Plugin_Manager{
  
      using Base_Type = T;
  
      std::vector&lt;Get_Provider_Type&lt;Base_Type&gt;::type *&gt; m_provider_collection;
  
        */ ... /*
  
  };
  </code></pre>
  
  <p>Where <code>Get_Provider_Type&lt;T&gt;</code> is a metafunction which returns a typename TProvider.</p>
  
  <p>Based on <a href="https://stackoverflow.com/questions/4693819/c-template-string-concatenation?lq=1">this answer</a>, I think that the metafunction should look something along the lines of this:</p>
  
  <pre><code>    template &lt; typename Str1, typename Str2 &gt;
      struct concat : boost::mpl::insert_range &lt; Str1, typename boost::mpl::end&lt;Str1&gt;::type, Str2 &gt; {};
  
  
      template &lt;class T&gt; struct Get_Provider_Type{
          typedef typename boost::mpl::string&lt;boost::mpl::c_str&lt;T&gt;::value&gt;::type Base_Name;
          typedef boost::mpl::string&lt;'Prov', 'ider'&gt; Suffix;
  
          typedef typename concat&lt;Base_Name, Suffix&gt;::type type;
      };
  </code></pre>
  
  <p>However, I am really not understanding <code>mpl::c_str</code> or <code>mpl::string</code> or their correct usage, and I cannot follow the error messages that I am receiving.  The code as written above gives me the error message:</p>
  
  <pre><code>    error C2039: 'value_type' : is not a member of 'foo'
  </code></pre>
  
  <p>(foo here being the template argument --  <code>Plugin_Manager&lt;foo&gt;</code>)</p>
  
  <p>I realize that I can likely make this work if I use a large macro rather than c++ template, but I would <b>really</b> like to avoid that if <b>at all</b> possible.</p>
  
  <p>I'd really appreciate any suggestions.</p>
  
  <p>Thanks-
  Shmuel</p>