<p>I am trying to use a stringstream object in VC++ (VStudio 2003) butI am getting an error when I use the overloaded &lt;&lt; operator to try and set some manipulators.  </p>

<p>I am trying the following:  </p>

<pre><code>int SomeInt = 1;  
stringstream StrStream;  
StrStream &lt;&lt; std::setw(2) &lt;&lt; SomeInt;  
</code></pre>

<p>This will not compile (error C2593: 'operator &lt;&lt;' is ambiguous).<br>
Does VStudio 2003 support using manipulators in this way?<br>
I know that I can just set the width directly on the stringstream object e.g. StrStream.width(2);<br>
I was wondering why the more usual method doesn't work?</p>

[{'answer_id': 69721, 'author': 'Jesse Beder', 'author_id': 112, 'author_profile': 'https://Stackoverflow.com/users/112', 'pm_score': 2, 'selected': True, 'text': '<p>Are you sure you included all of the right headers? The following compiles for me in VS2003:</p>\n\n<pre><code>#include &lt;iostream&gt;\n#include &lt;sstream&gt;\n#include &lt;iomanip&gt;\n\nint main()\n{\n   int SomeInt = 1;\n   std::stringstream StrStream;\n   StrStream &lt;&lt; std::setw(2) &lt;&lt; SomeInt;\n   return 0;\n}\n</code></pre>\n'}, {'answer_id': 69732, 'author': 'Allan Wind', 'author_id': 9706, 'author_profile': 'https://Stackoverflow.com/users/9706', 'pm_score': 1, 'selected': False, 'text': '<p>I love this <a href="http://www.cplusplus.com/reference/" rel="nofollow noreferrer">reference site</a> for stream questions like this.</p>\n\n<p>/Allan</p>\n'}, {'answer_id': 69779, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': "<p>You probably just forgot to include iomanip, but I can't be sure because you didn't include code for a complete program there.</p>\n\n<p>This complete program works fine over here using VS 2003:</p>\n\n<pre><code>#include &lt;sstream&gt;\n#include &lt;iomanip&gt;\n\nint main()\n{\n    int SomeInt = 1;\n    std::stringstream StrStream;\n    StrStream &lt;&lt; std::setw(2) &lt;&lt; SomeInt;\n}\n</code></pre>\n"}]
['https://Stackoverflow.com/questions/69695', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1682/']