Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62722 - trunk/boost/thread/detail
From: anthony_at_[hidden]
Date: 2010-06-10 04:34:53


Author: anthonyw
Date: 2010-06-10 04:34:52 EDT (Thu, 10 Jun 2010)
New Revision: 62722
URL: http://svn.boost.org/trac/boost/changeset/62722

Log:
Fix for issue #3761 --- if define operator<< for thread::id outside
the class if not supported inside.

Text files modified:
   trunk/boost/thread/detail/thread.hpp | 26 ++++++++++++++++++++++++++
   1 files changed, 26 insertions(+), 0 deletions(-)

Modified: trunk/boost/thread/detail/thread.hpp
==============================================================================
--- trunk/boost/thread/detail/thread.hpp (original)
+++ trunk/boost/thread/detail/thread.hpp 2010-06-10 04:34:52 EDT (Thu, 10 Jun 2010)
@@ -432,6 +432,7 @@
         }
 
 #ifndef BOOST_NO_IOSTREAM
+#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
         template<class charT, class traits>
         friend std::basic_ostream<charT, traits>&
         operator<<(std::basic_ostream<charT, traits>& os, const id& x)
@@ -445,9 +446,34 @@
                 return os<<"{Not-any-thread}";
             }
         }
+#else
+ template<class charT, class traits>
+ std::basic_ostream<charT, traits>&
+ print(std::basic_ostream<charT, traits>& os)
+ {
+ if(thread_data)
+ {
+ return os<<thread_data;
+ }
+ else
+ {
+ return os<<"{Not-any-thread}";
+ }
+ }
+
+#endif
 #endif
     };
 
+#if !defined(BOOST_NO_IOSTREAM) && defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+ template<class charT, class traits>
+ std::basic_ostream<charT, traits>&
+ operator<<(std::basic_ostream<charT, traits>& os, const id& x)
+ {
+ return x.print(os);
+ }
+#endif
+
     inline bool thread::operator==(const thread& other) const
     {
         return get_id()==other.get_id();


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk