Is it possible to overload the operator + with char strings?
<p>I want to simplify the using of strings like in java.</p>

<p>so i can write <code>"count "+6;</code> and get a string "count 6"
with std::string it's possible to concatenate two strings or std::string with char string.</p>

<p>i wrote 2 functions </p>

<pre><code>template&lt;typename T&gt;
inline static std::string operator+(const std::string str, const T gen){
    return str + std::to_string(gen);
}

template&lt;typename T&gt;
inline static std::string operator+(const T gen, const std::string str){
    return std::to_string(gen) + str;
}
</code></pre>

<p>to concatenate std::string with numbers, but cannot write something like <code>"count "+6;</code> because <code>"count "</code> is a const char[] and not a std::string.</p>

<p>it works with <code>std::string("count")+" is "+6+" and it works also with double "+1.234;</code> , but thats not really pretty =)</p>

<p>is there a possibility to do the same without starting with std::string("")</p>

<pre><code>template&lt;typename T&gt;
inline static std::string operator+(const char* str, const T gen){
    return str + std::to_string(gen);
} 
</code></pre>

<p>this method doesn't work and i get an compiler error</p>

<pre><code>error: invalid operands of types 'const char*' and 'const char [1]' to binary 'operator+'
</code></pre>