const pointer as a constructor argument
<p>Ok, this is an odd one: (This is EXTREMELY cut down example code. Please don't get uppity about the lack of destructors or whatever)</p>

<pre><code>template &lt;class f, class g&gt; class Ptr;

class RealBase
{
};

template &lt;class a, class b, class c = Ptr&lt;a,b&gt; &gt;
class Base : public RealBase
{
public:
    Base(){};
};

template &lt;class d, class e&gt;
class Derived : public Base &lt;d,e&gt;
{
public:
    Derived(){};
    void DerivedMethod(){};
};
typedef Derived&lt;double,double&gt; D_Derived;

template &lt;class f, class g&gt;
class Ptr
{
public:
    Ptr(){};
    Ptr(Base&lt;f,g,Ptr&lt;f,g&gt; &gt;* a){in = a;};
    Base&lt;f,g,Ptr&lt;f,g&gt; &gt;* operator-&gt;()
    {
     return in;
    };

    Base&lt;f,g,Ptr&lt;f,g&gt; &gt;&amp; operator*()
    {
     return *in;
    };
private:
    Base&lt;f,g,Ptr&lt;f,g&gt; &gt;* in;
};
</code></pre>

<p>I'm using the Ptr class from this example in a vector, as a pointer to a Derived class.</p>

<p>As we can see, the Ptr takes a Base&lt;>* as it's constructor argument.</p>

<p>Unfortunately I need a constructor that takes a const Base&lt;>*, and I cannot simply do this:
<pre><code>Ptr(const Base&lt;>* a) { in = const_cast&lt;Base&lt;>*>(a)};
</pre></code>
Any ideas how I can make this class accept a const Base&lt;>* as it's constructor?</p>

<p>(N.B. I may be being dozy here and doing something dumb, so please forgive me if it's really obvious, I've been on a computer for faaar to long today)</p>

<p>EDIT</p>

<p>Come on guys, comment on <em>why</em> for a down vote</p>

<p>EDIT2
Quick syntax edit (used variable names from the real code instead of the example code)</p>

<p>EDIT</p>

<p>Ok, turns out I can fix this by making changes to unrelated code, so it's a bit of a non-problem now =] Took me about a day to fix it though =[</p>
