use_allocator_pass.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. // <boost/thread/future.hpp>
  14. // class packaged_task<R(ArgTypes...)>
  15. // template <class Callable, class Alloc>
  16. // struct uses_allocator<packaged_task<Callable>, Alloc>
  17. // : true_type { };
  18. #define BOOST_THREAD_VERSION 4
  19. #if BOOST_THREAD_VERSION == 4
  20. #define BOOST_THREAD_DETAIL_SIGNATURE double()
  21. #else
  22. #define BOOST_THREAD_DETAIL_SIGNATURE double
  23. #endif
  24. #include <boost/thread/future.hpp>
  25. #include <boost/detail/lightweight_test.hpp>
  26. #include <boost/static_assert.hpp>
  27. #if defined BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS
  28. #include "../test_allocator.hpp"
  29. int main()
  30. {
  31. BOOST_STATIC_ASSERT_MSG((boost::csbl::uses_allocator<boost::packaged_task<BOOST_THREAD_DETAIL_SIGNATURE>, test_allocator<double> >::value), "");
  32. return boost::report_errors();
  33. }
  34. #else
  35. int main()
  36. {
  37. return boost::report_errors();
  38. }
  39. #endif