• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 // Copyright (C) 2011 Vicente J. Botet Escriba
10 //
11 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
12 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
13 
14 // <boost/thread/thread.hpp>
15 
16 // class thread
17 
18 // template <class F, class ...Args> thread(F&& f, Args&&... args);
19 
20 #define BOOST_THREAD_USES_MOVE
21 
22 #include <boost/thread/thread_only.hpp>
23 #include <new>
24 #include <cstdlib>
25 #include <cassert>
26 #include <boost/detail/lightweight_test.hpp>
27 #include <boost/static_assert.hpp>
28 
29 class MoveOnly
30 {
31 public:
32   BOOST_THREAD_MOVABLE_ONLY(MoveOnly)
MoveOnly()33   MoveOnly()
34   {
35   }
MoveOnly(BOOST_THREAD_RV_REF (MoveOnly))36   MoveOnly(BOOST_THREAD_RV_REF(MoveOnly))
37   {}
38 
operator ()()39   void operator()()
40   {
41   }
42 };
43 
MakeMoveOnly()44 MoveOnly MakeMoveOnly() {
45   return BOOST_THREAD_MAKE_RV_REF(MoveOnly());
46 }
47 
48 #if defined  BOOST_NO_CXX11_RVALUE_REFERENCES && defined BOOST_THREAD_USES_MOVE
49 BOOST_STATIC_ASSERT(::boost::is_function<boost::rv<boost::rv<MoveOnly> >&>::value==false);
50 #endif
51 
main()52 int main()
53 {
54   {
55     boost::thread t(( BOOST_THREAD_MAKE_RV_REF(MakeMoveOnly()) ));
56     t.join();
57   }
58   return boost::report_errors();
59 }
60