1// Copyright (C) 2010 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
6
7#define BOOST_THREAD_VERSION 3
8
9#include <boost/thread/thread_only.hpp>
10#include <boost/thread/future.hpp>
11#include <boost/config.hpp>
12
13#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
14struct MovableButNonCopyable {
15#if ! defined BOOST_NO_CXX11_DELETED_FUNCTIONS
16 MovableButNonCopyable(MovableButNonCopyable const&) = delete;
17 MovableButNonCopyable& operator=(MovableButNonCopyable const&) = delete;
18#else
19private:
20 MovableButNonCopyable(MovableButNonCopyable const&);
21 MovableButNonCopyable& operator=(MovableButNonCopyable const&);
22#endif
23public:
24 MovableButNonCopyable() {};
25 MovableButNonCopyable(MovableButNonCopyable&&) {};
26 MovableButNonCopyable& operator=(MovableButNonCopyable&&)
27 {
28 return *this;
29 };
30};
31
32MovableButNonCopyable construct()
33{
34 return MovableButNonCopyable();
35}
36
37int main()
38{
39 boost::packaged_task<MovableButNonCopyable> pt(construct);
40 pt();
41 return 0;
42}
43#else
44int main()
45{
46 return 0;
47}
48#endif
49

source code of boost/libs/thread/test/test_6174.cpp