test_10340.cpp 608 B

12345678910111213141516171819202122232425262728
  1. // Copyright (C) 2014 Vicente Botet
  2. //
  3. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. #define BOOST_THREAD_VERSION 4
  6. #include <boost/thread/future.hpp>
  7. struct foo
  8. {
  9. foo(int i_): i(i_) {}
  10. int i;
  11. };
  12. int main()
  13. {
  14. boost::promise<foo> p;
  15. const foo f(42);
  16. p.set_value(f);
  17. // Clearly a const future ref isn't much use, but I needed to
  18. // prove the problem wasn't me trying to copy a unique_future
  19. const boost::future<foo>& fut = boost::make_ready_future( foo(42) );
  20. return 0;
  21. }