Opened 12 years ago

Closed 12 years ago

#4674 closed Bugs (duplicate)

output operator<< of thread::id

Reported by: ka55i0peia@… Owned by: Anthony Williams
Milestone: To Be Determined Component: thread
Version: Boost 1.44.0 Severity: Problem
Keywords: Cc:

Description

Hi,

std::cout << boost::this_thread::get_id();

produces:

thread.hpp(473) : error C2662: 'std::basic_ostream<_Elem,_Traits> &boost::thread::id::print<char,std::char_traits<char>>(std::basic_ostream<_Elem,_Traits> &)' : cannot convert 'this' pointer from 'const boost::thread::id' to 'boost::thread::id &'

For me it was okay to comment the const out:

operator<<(std::basic_ostream<charT, traits>& os, /*const*/ thread::id& x)
    {
        return x.print(os);
    }

Greetings, Jan.

Change History (2)

comment:1 by Marshall Clow, 12 years ago

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 <<

comment:2 by Anthony Williams, 12 years ago

Resolution: duplicate
Status: newclosed

Fixed. Duplicate of #4565

Note: See TracTickets for help on using tickets.