
"vicente.botet" <vicente.botet@wanadoo.fr> writes:
N2497 includes the following thread constructor overloadings template <class F> explicit thread(F f); template <class F, class ...Args> thread(F&& f, Args&&... args); void swap(thread&&);
Boost.Threads try to conforms to N2497 as muh as possible. Boost.Threads defines already
#ifdef BOOST_HAS_RVALUE_REFS template <class F> thread(F&& f); #else #ifdef BOOST_NO_SFINAE template <class F> explicit thread(F f); #else template <class F>explicit thread(F f, typename disable_if< boost::is_convertible<F&, detail::thread_move_t<F> >, dummy* >::type=0); #endif template <class F>explicit thread(detail::thread_move_t<F> f); template <class F,class ...Args> thread(F f, Args... args)
I have some questions. Is there any deep raison for which template <class F> explicit thread(F f); should not always be defined?
It causes problems with the move semantics emulation, being a better match in some cases and causing additional copies.
Is there any deep raison to emulate template <class F,class ...Args> thread(F f, Args... args) instead of template <class F,class ...Args> thread(F&& f, Args... args)
The former is easier.
Could template <class F, class ...Args> thread(F&& f, Args&&... args); rally be emulated?
Only with a myriad of overloads.
You provide 'void swap(thread&)'. Could 'void swap(thread&&)' be emulated?
Yes. I thought it was there :-(
Do you know if the following overloadings are taken in account by the boost::swap utility? void swap(thread& x, thread& y); void swap(thread&& x, thread& y); void swap(thread& x, thread&& y);
No, I don't. Anthony -- Anthony Williams Author of C++ Concurrency in Action | http://www.manning.com/williams Custom Software Development | http://www.justsoftwaresolutions.co.uk Just Software Solutions Ltd, Registered in England, Company Number 5478976. Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK