test_6174.cpp 1.1 KB

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