Define function / method if not defined before c++ : <p>I don't use C++11 yet, so I wrote the functions <code>to_string(whatever)</code> by myself. They should only be compiled if they don't exist. If I switch to C++11, they should be skipped. I have something like this:</p>

<pre><code>#ifndef to_string

string to_string(int a){
    string ret;
    stringstream b;
    b &lt;&lt; a;
    b &gt;&gt; ret;
    return ret;
}

string to_string(double a){
    string ret;
    stringstream b;
    b &lt;&lt; a;
    b &gt;&gt; ret;
    return ret;
}

#endif
</code></pre>

<p>This doesn't work apparently. Is something like this possible and if yes, how?</p>
