diff --git a/example/executor.cpp b/example/executor.cpp index 184523da..2bb663c9 100644 --- a/example/executor.cpp +++ b/example/executor.cpp @@ -87,12 +87,14 @@ int main() submit_some( ea2); ea2.underlying_executor().run_queued_closures(); } +#if ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) std::cout << BOOST_CONTEXTOF << std::endl; { boost::executor_adaptor < boost::basic_thread_pool > ea1(4); boost::executor_adaptor < boost::serial_executor > ea2(ea1); submit_some(ea2); } +#endif std::cout << BOOST_CONTEXTOF << std::endl; } catch (std::exception& ex) diff --git a/include/boost/thread/executors/executor_adaptor.hpp b/include/boost/thread/executors/executor_adaptor.hpp index 4b69f713..0a60669f 100644 --- a/include/boost/thread/executors/executor_adaptor.hpp +++ b/include/boost/thread/executors/executor_adaptor.hpp @@ -99,26 +99,26 @@ namespace executors return ex.submit(boost::move(closure)); } -//#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) -// template -// void submit(Closure & closure) -// { -// work w ((closure)); -// submit(boost::move(w)); -// } -//#endif -// void submit(void (*closure)()) -// { -// work w ((closure)); -// submit(boost::move(w)); -// } -// -// template -// void submit(BOOST_THREAD_RV_REF(Closure) closure) -// { -// work w =boost::move(closure); -// submit(boost::move(w)); -// } +#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + template + void submit(Closure & closure) + { + work w ((closure)); + submit(boost::move(w)); + } +#endif + void submit(void (*closure)()) + { + work w ((closure)); + submit(boost::move(w)); + } + + template + void submit(BOOST_THREAD_RV_REF(Closure) closure) + { + work w =boost::move(closure); + submit(boost::move(w)); + } /** * Effects: try to execute one task. diff --git a/include/boost/thread/executors/serial_executor.hpp b/include/boost/thread/executors/serial_executor.hpp index ae91224b..c58743eb 100644 --- a/include/boost/thread/executors/serial_executor.hpp +++ b/include/boost/thread/executors/serial_executor.hpp @@ -22,7 +22,8 @@ namespace boost { - +namespace executors +{ class serial_executor { /// type-erasure to store the works to do @@ -201,7 +202,8 @@ namespace boost } }; - +} +using executors::serial_executor; } #include