accumulate and ostringstream compile error
<p>I'm getting the following compile error in the marked lines:</p>

<blockquote>
  <p>error: conversion from ‘<code>std::basic_ostream&lt;char,
  std::char_traits&lt;char&gt; &gt;</code>’ to non-scalar type ‘<code>std::ostringstream</code>’
  requested</p>
</blockquote>

<p>Could you help me to correct my example?</p>

<pre><code>#include &lt;numeric&gt;
#include &lt;sstream&gt;

using namespace std;

ostringstream ConvertLettersToNumbers(ostringstream acc, char input)
{
    if(isdigit(input))
    {
        return acc &lt;&lt; input; // error
    }
    else
    {
        return acc &lt;&lt; static_cast&lt;int&gt;(input); // error
    }
};

int main(int argc, char **argv)
{
    string stringToCovert = "ABC";

    ostringstream out = accumulate(stringToCovert.begin(), stringToCovert.end(),     
         string(), ConvertLettersToNumbers);

    string convertedString = out.str(); // expected "656667"

    return 0;
}
</code></pre>

<p><strong>EDIT</strong>: My first version using strings that works but is slow:</p>

<pre><code>   string ConvertLettersToNumbers(string acc, char input)
    {
        if(isdigit(input))
        {
            return acc + input;
        }
        else
        {
            stringstream sstr;
            sstr &lt;&lt; static_cast&lt;int&gt;(input);
            return acc + sstr.str();
        }
    };
</code></pre>
