Skip to content

Commit

Permalink
ref #11192- boost::future<>::then() with an executor doesn't compile …
Browse files Browse the repository at this point in the history
…when the callback returns a future
  • Loading branch information
viboes committed Apr 17, 2015
1 parent 0d8ddfe commit 45c9a1d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
16 changes: 16 additions & 0 deletions example/executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
#include <string>
#include <iostream>

boost::future<void> p(boost::future<void>) {
return boost::make_ready_future();
}

void p1()
{
// std::cout << BOOST_CONTEXTOF << std::endl;
Expand Down Expand Up @@ -147,4 +151,16 @@ int test_executor_adaptor()
int main()
{
return test_executor_adaptor();

#if defined BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION \
&& defined BOOST_THREAD_PROVIDES_EXECUTORS \
&& ! defined BOOST_NO_CXX11_RVALUE_REFERENCES

// compiles
boost::make_ready_future().then(&p);

boost::basic_thread_pool executor;
// doesn't compile
boost::make_ready_future().then(executor, &p);
#endif
}
5 changes: 3 additions & 2 deletions include/boost/thread/future.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,7 @@ namespace boost


typedef typename base_type::move_dest_type move_dest_type;
public: // when_all
public: // // todo move to private and add the needed friends (when_all, executors, ...)

BOOST_THREAD_FUTURE(future_ptr a_future):
base_type(a_future)
Expand Down Expand Up @@ -1626,12 +1626,13 @@ namespace boost

typedef typename base_type::move_dest_type move_dest_type;

public: // todo move to private and add the needed friends

BOOST_THREAD_FUTURE(future_ptr a_future):
base_type(a_future)
{
}

public:
BOOST_THREAD_MOVABLE_ONLY(BOOST_THREAD_FUTURE)
typedef future_state::state state;
typedef R value_type; // EXTENSION
Expand Down

0 comments on commit 45c9a1d

Please sign in to comment.