Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85494 - in trunk: boost/thread libs/thread/example
From: vicente.botet_at_[hidden]
Date: 2013-08-27 18:37:16


Author: viboes
Date: 2013-08-27 18:37:15 EDT (Tue, 27 Aug 2013)
New Revision: 85494
URL: http://svn.boost.org/trac/boost/changeset/85494

Log:
Thread: fix scoped_thread variadic constructor.

Text files modified:
   trunk/boost/thread/scoped_thread.hpp | 10 ++++------
   trunk/libs/thread/example/scoped_thread.cpp | 8 +++++++-
   2 files changed, 11 insertions(+), 7 deletions(-)

Modified: trunk/boost/thread/scoped_thread.hpp
==============================================================================
--- trunk/boost/thread/scoped_thread.hpp Tue Aug 27 18:35:21 2013 (r85493)
+++ trunk/boost/thread/scoped_thread.hpp 2013-08-27 18:37:15 EDT (Tue, 27 Aug 2013) (r85494)
@@ -47,9 +47,8 @@
      *
      */
 #if ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
- template <class F, class ...Args>
- explicit strict_scoped_thread(BOOST_THREAD_FWD_REF(F) f, BOOST_THREAD_FWD_REF(Args)... args,
- typename disable_if<is_same<typename decay<F>::type, thread>, dummy* >::type=0) :
+ template <class F, class ...Args, typename = typename disable_if<is_same<typename decay<F>::type, thread>, dummy* >::type>
+ explicit strict_scoped_thread(BOOST_THREAD_FWD_REF(F) f, BOOST_THREAD_FWD_REF(Args)... args) :
       t_(boost::forward<F>(f), boost::forward<Args>(args)...) {}
 #else
     template <class F>
@@ -138,9 +137,8 @@
      */
 
 #if ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
- template <class F, class ...Args>
- explicit scoped_thread(BOOST_THREAD_FWD_REF(F) f, BOOST_THREAD_FWD_REF(Args)... args,
- typename disable_if<is_same<typename decay<F>::type, thread>, dummy* >::type=0) :
+ template <class F, class ...Args, typename = typename disable_if<is_same<typename decay<F>::type, thread>, dummy* >::type>
+ explicit scoped_thread(BOOST_THREAD_FWD_REF(F) f, BOOST_THREAD_FWD_REF(Args)... args) :
       t_(boost::forward<F>(f), boost::forward<Args>(args)...) {}
 #else
     template <class F>

Modified: trunk/libs/thread/example/scoped_thread.cpp
==============================================================================
--- trunk/libs/thread/example/scoped_thread.cpp Tue Aug 27 18:35:21 2013 (r85493)
+++ trunk/libs/thread/example/scoped_thread.cpp 2013-08-27 18:37:15 EDT (Tue, 27 Aug 2013) (r85494)
@@ -13,6 +13,9 @@
 {
   ++i;
 }
+void f(int, int)
+{
+}
 
 struct func
 {
@@ -81,7 +84,10 @@
 
     do_something_in_current_thread();
   }
-
+ {
+ boost::scoped_thread<> g( f, 1, 2 );
+ do_something_in_current_thread();
+ }
   return 0;
 }
 


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