From 07f394a1b45b4ced8bf9993e652d2d58e2bcedb6 Mon Sep 17 00:00:00 2001 From: Oliver Kowalke Date: Sun, 13 Jul 2014 20:35:15 +0200 Subject: [PATCH] fixes for MSVC --- include/boost/fiber/fiber.hpp | 4 ++-- .../boost/fiber/future/detail/task_object.hpp | 2 +- include/boost/fiber/future/packaged_task.hpp | 18 +++++++++--------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/boost/fiber/fiber.hpp b/include/boost/fiber/fiber.hpp index acfba0a2..686942d6 100644 --- a/include/boost/fiber/fiber.hpp +++ b/include/boost/fiber/fiber.hpp @@ -81,7 +81,7 @@ public: impl_() { coro_t::call_type coro( detail::trampoline< fiber_fn >, attrs, stack_alloc); - detail::setup< fiber_fn > s( fn, & coro); + detail::setup< fiber_fn > s( forward< fiber_fn >( fn), & coro); impl_.reset( s.allocate() ); BOOST_ASSERT( impl_); @@ -94,7 +94,7 @@ public: impl_() { typename coro_t::call_type coro( detail::trampoline< fiber_fn >, attrs, stack_alloc); - detail::setup< fiber_fn > s( fn, & coro); + detail::setup< fiber_fn > s( forward< fiber_fn >( fn), & coro); impl_.reset( s.allocate() ); BOOST_ASSERT( impl_); diff --git a/include/boost/fiber/future/detail/task_object.hpp b/include/boost/fiber/future/detail/task_object.hpp index 6e2b78e4..7a3eaa0f 100644 --- a/include/boost/fiber/future/detail/task_object.hpp +++ b/include/boost/fiber/future/detail/task_object.hpp @@ -84,7 +84,7 @@ public: >::other allocator_t; #ifdef BOOST_NO_RVALUE_REFERENCES - task_object( Fn const& fn, allocator_t const& alloc) : + task_object( Fn fn, allocator_t const& alloc) : task_base< void >(), fn_( fn), alloc_( alloc) diff --git a/include/boost/fiber/future/packaged_task.hpp b/include/boost/fiber/future/packaged_task.hpp index b3c0cb41..a254d1de 100644 --- a/include/boost/fiber/future/packaged_task.hpp +++ b/include/boost/fiber/future/packaged_task.hpp @@ -72,16 +72,16 @@ public: //TODO: constructs a std::packaged_task object // with a shared state and a copy of the task, // initialized with forward< Fn >( fn) - detail::task_object< + typedef detail::task_object< task_fn, std::allocator< packaged_task< R() > >, R > object_t; std::allocator< packaged_task< R() > > alloc; - object_t::allocator_t a( alloc); + typename object_t::allocator_t a( alloc); task_ = ptr_t( // placement new - ::new( a.allocate( 1) ) object_t( fn, a) ); + ::new( a.allocate( 1) ) object_t( forward< task_fn >( fn), a) ); } template< typename Allocator > @@ -102,7 +102,7 @@ public: typename object_t::allocator_t a( alloc); task_ = ptr_t( // placement new - ::new( a.allocate( 1) ) object_t( fn, a) ); + ::new( a.allocate( 1) ) object_t( forward< task_fn >( fn), a) ); } #endif @@ -312,7 +312,7 @@ public: } #ifdef BOOST_MSVC - typedef void ( * task_fn)(); + typedef void( * task_fn)(); explicit packaged_task( task_fn fn) : obtained_( false), @@ -321,16 +321,16 @@ public: //TODO: constructs a std::packaged_task object // with a shared state and a copy of the task, // initialized with forward< Fn >( fn) - detail::task_object< + typedef detail::task_object< task_fn, std::allocator< packaged_task< void() > >, void > object_t; std::allocator< packaged_task< void() > > alloc; - object_t::allocator_t a( alloc); + typename object_t::allocator_t a( alloc); task_ = ptr_t( // placement new - ::new( a.allocate( 1) ) object_t( fn, a) ); + ::new( a.allocate( 1) ) object_t( forward< task_fn >( fn), a) ); } template< typename Allocator > @@ -351,7 +351,7 @@ public: typename object_t::allocator_t a( alloc); task_ = ptr_t( // placement new - ::new( a.allocate( 1) ) object_t( fn, a) ); + ::new( a.allocate( 1) ) object_t( forward< task_fn >( fn), a) ); } #endif