Boost C++ Libraries: Ticket #1389: filesystem::ostream << boost::format generates operator ambigious error (in MSVC++) https://svn.boost.org/trac10/ticket/1389 <p> The following code </p> <pre class="wiki">#include &lt;boost/format.hpp&gt; #include &lt;boost/filesystem/fstream.hpp&gt; void foo () { using namespace boost::filesystem; ofstream file ( "foo.txt" ); file &lt;&lt; boost::format("hello"); } </pre><p> generates the following compilation error with MSVC++ 7.1: </p> <p> d:\foo.cpp(8) : error C2593: 'operator &lt;&lt;' is ambiguous </p> <blockquote> <p> d:\Programs\boost\boost_1_34_0\boost\filesystem\path.hpp(617): could be 'std::basic_ostream&lt;_Elem,_Traits&gt; &amp;boost::filesystem::operator &lt;&lt;&gt;(std::basic_ostream&lt;_Elem,_Traits&gt; &amp;,const Path &amp;)' with [ </p> <blockquote> <p> _Elem=char, _Traits=std::char_traits, Ch=char, Path=boost::basic_format </p> </blockquote> <p> ] d:\Programs\boost\boost_1_34_0\boost\format\free_funcs.hpp(33): or 'std::basic_ostream&lt;_Elem,_Traits&gt; &amp;boost::operator &lt;&lt;,std::allocator&lt;_Ty&gt;&gt;(std::basic_ostream&lt;_Elem,_Traits&gt; &amp;,const boost::basic_format &amp;)' [found using argument-dependent lookup] with [ </p> <blockquote> <p> _Elem=char, _Traits=std::char_traits, _Ty=char, Ch=char </p> </blockquote> <p> ] while trying to match the argument list '(boost::filesystem::ofstream, boost::basic_format)' with [ </p> <blockquote> <p> Ch=char </p> </blockquote> <p> ] </p> </blockquote> <p> Compiled with options [ /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Gm /RTC1 /MLd /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 /c /ZI /TP /EHa ] </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/1389 Trac 1.4.3 Beman Dawes Sun, 31 May 2009 14:21:22 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/1389#comment:1 https://svn.boost.org/trac10/ticket/1389#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">wontfix</span> </li> </ul> <p> The problem will be resolved by Filesystem V3. </p> <p> Unless there are reports that this is causing serious inconvenience, this isn't going to get fixed for Filesystem v2. </p> <p> Thanks for your patience, </p> <p> --Beman </p> Ticket