How do I create an optional C++ template parameter for a class? : <p>I have a class right now that is defined as</p>

<pre><code>template &lt;class A&gt; class MyClass { };
</code></pre>

<p>I would like to add an optional template parameter B which would lead to</p>

<pre><code>template &lt;class A, class B&gt; class MyClass {};
</code></pre>

<p>but I want it in such a way such that if B is not specified, i.e. if I define</p>

<pre><code>MyClass&lt;double&gt; x;
</code></pre>

<p>then B will be the same type as A (or double in the above case) as well.</p>

<p>Is that even possible in C++?</p>
