Imported Upstream version 1.57.0
[platform/upstream/boost.git] / libs / thread / test / sync / futures / packaged_task / use_allocator_pass.cpp
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
10 // Copyright (C) 2011 Vicente J. Botet Escriba
11 //
12 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
13 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
14
15 // <boost/thread/future.hpp>
16
17 // class packaged_task<R(ArgTypes...)>
18
19 // template <class Callable, class Alloc>
20 //   struct uses_allocator<packaged_task<Callable>, Alloc>
21 //      : true_type { };
22
23
24 #define BOOST_THREAD_VERSION 4
25 #if BOOST_THREAD_VERSION == 4
26 #define BOOST_THREAD_DETAIL_SIGNATURE double()
27 #else
28 #define BOOST_THREAD_DETAIL_SIGNATURE double
29 #endif
30
31 #include <boost/thread/future.hpp>
32 #include <boost/detail/lightweight_test.hpp>
33 #include <boost/static_assert.hpp>
34
35 #if defined BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS
36 #include "../test_allocator.hpp"
37
38 int main()
39 {
40
41   BOOST_STATIC_ASSERT_MSG((boost::csbl::uses_allocator<boost::packaged_task<BOOST_THREAD_DETAIL_SIGNATURE>, test_allocator<double> >::value), "");
42
43   return boost::report_errors();
44 }
45
46 #else
47 int main()
48 {
49   return boost::report_errors();
50 }
51 #endif
52
53