title: Use template class in another class in C++
body: <p>I have a template class that I want to use in another class. The problem is that I want to use the template class without knowing the actual type. </p>
  
  <p>A simple example:</p>
  
  <pre><code>template &lt;class T&gt; 
  class Foo{
      private:
          T x_;
      public:
          void Foo(T);
  };
  </code></pre>
  
  <p>Now, another class using <code>Foo</code>. What I would like to do is:</p>
  
  <pre><code>class Bar{
      private:
          Foo foo_;
  
      public:
          Bar(Foo);
  };
  </code></pre>
  
  <p>The problem is that <code>Foo</code> requires a template argument when used inside <code>Bar</code>. It would be nice if the <code>Bar</code> class would handle <code>Foo</code> with any template argument. Is there a workaround?</p>