Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84691 - trunk/libs/thread/test
From: vicente.botet_at_[hidden]
Date: 2013-06-08 12:04:46


Author: viboes
Date: 2013-06-08 12:04:46 EDT (Sat, 08 Jun 2013)
New Revision: 84691
URL: http://svn.boost.org/trac/boost/changeset/84691

Log:
Thread: Added test_8674.cpp test.

Added:
   trunk/libs/thread/test/test_8674.cpp (contents, props changed)

Added: trunk/libs/thread/test/test_8674.cpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/libs/thread/test/test_8674.cpp 2013-06-08 12:04:46 EDT (Sat, 08 Jun 2013) (r84691)
@@ -0,0 +1,43 @@
+// Copyright (C) 2013 Vicente Botet
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <iostream>
+
+#define USE_STD 0
+#define USE_BOOST 1
+
+#define USED_THREAD_API USE_BOOST
+//#define USED_THREAD_API USE_STD
+
+#if USED_THREAD_API == USE_BOOST
+
+# define BOOST_THREAD_VERSION 4
+# include <boost/thread/future.hpp>
+
+ using boost::future;
+ using boost::async;
+
+#endif
+#if USED_THREAD_API == USE_STD
+# include <future>
+ using std::future;
+ using std::async;
+#endif
+
+
+
+future<void> do_something()
+{
+ auto result = async( []{ std::cout<< "A\n"; } );
+ std::cout << "B\n";
+ return result; // error here
+}
+
+int main()
+{
+ do_something().wait();
+ std::cout << "Hello, World!" << std::endl;
+ return 0;
+}


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk