Boost C++ Libraries: Ticket #4674: output operator<< of thread::id https://svn.boost.org/trac10/ticket/4674 <p> Hi, </p> <div class="wiki-code"><div class="code"><pre><span class="n">std</span><span class="o">::</span><span class="n">cout</span> <span class="o">&lt;&lt;</span> <span class="n">boost</span><span class="o">::</span><span class="n">this_thread</span><span class="o">::</span><span class="n">get_id</span><span class="p">();</span> </pre></div></div><p> produces: </p> <pre class="wiki">thread.hpp(473) : error C2662: 'std::basic_ostream&lt;_Elem,_Traits&gt; &amp;boost::thread::id::print&lt;char,std::char_traits&lt;char&gt;&gt;(std::basic_ostream&lt;_Elem,_Traits&gt; &amp;)' : cannot convert 'this' pointer from 'const boost::thread::id' to 'boost::thread::id &amp;' </pre><p> For me it was okay to comment the const out: </p> <div class="wiki-code"><div class="code"><pre><span class="k">operator</span><span class="o">&lt;&lt;</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">basic_ostream</span><span class="o">&lt;</span><span class="n">charT</span><span class="p">,</span> <span class="n">traits</span><span class="o">&gt;&amp;</span> <span class="n">os</span><span class="p">,</span> <span class="cm">/*const*/</span> <span class="kr">thread</span><span class="o">::</span><span class="n">id</span><span class="o">&amp;</span> <span class="n">x</span><span class="p">)</span> <span class="p">{</span> <span class="k">return</span> <span class="n">x</span><span class="p">.</span><span class="n">print</span><span class="p">(</span><span class="n">os</span><span class="p">);</span> <span class="p">}</span> </pre></div></div><p> Greetings, Jan. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4674 Trac 1.4.3 Marshall Clow Wed, 22 Sep 2010 16:58:48 GMT <link>https://svn.boost.org/trac10/ticket/4674#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4674#comment:1</guid> <description> <p> I suspect that the actual problem is that thread::id::print is not const, and the fix is to add that, rather than removing the const on operator &lt;&lt; </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Anthony Williams</dc:creator> <pubDate>Thu, 28 Oct 2010 13:35:05 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/4674#comment:2 https://svn.boost.org/trac10/ticket/4674#comment:2 <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">duplicate</span> </li> </ul> <p> Fixed. Duplicate of <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4565" title="#4565: Bugs: Stream operator overload for thread::id fails because ... (closed: fixed)">#4565</a> </p> Ticket