C++ template specialization question
<p>I'm trying to implement a generic toString() function that would work on all types. All our internal classes derive from Abstract which includes a signature for toString(). In other words, all our internal classes have in some form, a toString method. </p>

<p>The problem is, the primitive types (int, char, double..) don't have a native toString function. But we do have a utility function that calls the lexical_cast to give back the string value of the primitive. We don't want a whole bunch of if statements depending  So I'm trying to create a templated utility class that would do the job.</p>

<p>My first hack at this is the below:</p>

<pre><code>    template&lt;class T&gt;
    class ObjectToString {
    public:
        string objectToString(T value) {
            iil::stringUtils::StringSp ret(stringUtils::valueToString&lt;T&gt;(value));
            return ret;
        }
    };

    template&lt;&gt;
    class ObjectToString &lt;Abstract&lt;T&gt;*&gt; {
    public:
        iil::stringUtils::StringSp objectToString(Abstract&lt;T&gt;* value) {
            return iil::stringUtils::StringSp(new std::string("AAAA"));
        }
    };
</code></pre>

<p>The problem now is, since Abstract is a templated class, it needs the template value T. I have no idea how to set that. Could anyone advise?</p>
