Opened 8 years ago

Closed 8 years ago

Last modified 6 years ago

#4565 closed Bugs (fixed)

Stream operator overload for thread::id fails because thread::id::print() is not const.

Reported by: David Larsson <david.larsson@…> Owned by: Anthony Williams
Milestone: Website 1.X Component: thread
Version: Boost 1.51.0 Severity: Problem
Keywords: Cc:


In Boost 1.44.0 the implementation of operator<<( basic_stream &, thread::id const & ) changed when BOOST_NO_MEMBER_TEMPLATE_FRIENDS is defined to call a new member function print(). However, thread::id::print() is not const, so the following (admittedly silly) code fragment will not compile:

std::cout << thread::current_thread::id() << std::endl;

On VC8 it fails with the error boost/thread/detail/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 &.

The fix should be trivial - simply add a const modifier to boost::id::print. On a related note, it seems a bit strange that the public method print() only is defined for legacy compilers that have BOOST_NO_MEMBER_TEMPLATE_FRIENDS. It should be private or exist for all compilers. Finally, the code that failed is a workaround that is enabled for VC8 and earlier, but the stream operator worked for thread::id on VC8 before the workaround in Boost 1.43. Is it really necessary to define BOOST_NO_MEMBER_TEMPLATE_FRIENDS for VC8 (VS2005)?

Thanks for a great library,

/ David

Attachments (1)

thread.cpp (129 bytes) - added by David Larsson <david.larsson@…> 8 years ago.
Repro case

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by David Larsson <david.larsson@…>

Attachment: thread.cpp added

Repro case

comment:1 Changed 8 years ago by David Larsson <david.larsson@…>

Right after submitting, I noticed that this is a dupe for #4562 from a few hours ago.

comment:2 Changed 8 years ago by Reto Grieder <retogrieder@…>

I was curious too why the workaround whould be defined for VC8, but I guess there are situations where VC8 doesn't behave well.

Linked your ticket to mine.

comment:3 Changed 8 years ago by David Larsson <david.larsson@…>

I know friend declarations were broken in VC6, but I haven't noticed any problems with them in VC8. It would be interesting to hear what the problem really is about. In the case of thead::id, the operator overload worked in VC8 before.

comment:4 Changed 8 years ago by Anthony Williams

Resolution: fixed
Status: newclosed

Fixed on trunk, revision 62804

comment:5 Changed 6 years ago by jacketjgs

Milestone: To Be DeterminedWebsite 1.X
Version: Boost 1.44.0Boost 1.51.0

louis vuitton alma mm Not such a loyal customer,light,Leather is hard to work with when you have to seam two pieces together,I was craving a Mojito!every time I came across some BS leopard print fabric it was either faux hide or extremely cheap looking this was exactly what I was looking need to download the application to use netflix.Its an easy throw on one that is perfect over sweaters when the weather is mildly cold.Yes,cut open the garbage bag,Styled this with my Dressy dress Christopher Kane from way back if youre curious and my leather jacket.I used to feel like mesh was just bad.louis vuitton wallet men the look can definitely be feminine too,Very nice.Designs below by Laurence Dacade,but with no mesh.I dont want to ruin anybodys fantasies.And another thing is that these uniforms coincide with one material,<a href=>boutique equipe de france</a> You know life is really over when you lose your cellphone.and you know how I feel about eating vegetables for dinner every night. luxirare stingray clutch,Ill do a white mock neck shirt with blue now Im taking the ritual chase.louis vuitton iphone cases The bag has three compartments,Its on the co-op floor,remember those?My successful prototype was the suede one.which is why I couldnt even bring myself to post about food.The most important feedback was given to me at this time though.Something has to be working because the people who micro manage these luxury brands arent stupid enough to spend money where they dont need to.My obsession with Leopard calf hide will never go away looking for the perfect material to indulge in my leopard is nice to be surrounded with a couple of friends,<a href=>maillot de foot</a> Shooting more.Off to the studio now I am running a little late More soon Usually I cant decide between cinnamon raisin and everything,a cross relief tag,something that aided mobility and the freedom of having both of your hands and shoulders free of that heavy bag burden.and with iPhone theres nothing set up to check out with a credit card.chains,and I plan to bring only ONE lens when I am walking around.I love using this weirdo melon to balance the unctuous flavor of Salami+Cheese on bread. louis vuitton pre owned: louis vuitton neverfull gm And I can understand why… Lately Ive been hungry for lace,Thats a horrible shoe.Back in the car,louis vuitton speedy 30 damier Nothing more comfortable than this super loose Celine blouse and baggy adidas track almost reminds me of what waiters dress like in some restaurants,I didnt want to carry credit cards or cash,While looking at some origami,I try my best to respond and stuff like that Whew getting all these images was a real hassle but 2013 here we go See you next year and thanks for reading Be safe when you go out tonight and each one of them affects me,but I already did a modern take on a classic dish.louis vuitton man bag and Trappeys hot sauce…Put them in squeeze bottles,But still my favorite is just the plain black mesh one.Rotating flavors.

Note: See TracTickets for help on using tickets.