• 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 
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 shared_future<R>
18 
19 // shared_future& operator=(const shared_future&);
20 
21 
22 #define BOOST_THREAD_VERSION 3
23 #include <boost/thread/future.hpp>
24 #include <boost/detail/lightweight_test.hpp>
25 
main()26 int main()
27 {
28   {
29     typedef int T;
30     boost::promise<T> p;
31     boost::shared_future<T> f0((p.get_future()));
32     boost::shared_future<T> f;
33     f = f0;
34     BOOST_TEST(f0.valid());
35     BOOST_TEST(f.valid());
36 
37   }
38   {
39     typedef int T;
40     boost::shared_future<T> f0;
41     boost::shared_future<T> f;
42     f = f0;
43     BOOST_TEST(!f0.valid());
44     BOOST_TEST(!f.valid());
45   }
46   {
47     typedef int& T;
48     boost::promise<T> p;
49     boost::shared_future<T> f0((p.get_future()));
50     boost::shared_future<T> f;
51     f = f0;
52     BOOST_TEST(f0.valid());
53     BOOST_TEST(f.valid());
54   }
55   {
56     typedef int& T;
57     boost::shared_future<T> f0;
58     boost::shared_future<T> f;
59     f = f0;
60     BOOST_TEST(!f0.valid());
61     BOOST_TEST(!f.valid());
62   }
63   {
64     typedef void T;
65     boost::promise<T> p;
66     boost::shared_future<T> f0((p.get_future()));
67     boost::shared_future<T> f;
68     f = f0;
69     BOOST_TEST(f0.valid());
70     BOOST_TEST(f.valid());
71   }
72   {
73     typedef void T;
74     boost::shared_future<T> f0;
75     boost::shared_future<T> f;
76     f = f0;
77     BOOST_TEST(!f0.valid());
78     BOOST_TEST(!f.valid());
79   }
80 
81   return boost::report_errors();
82 }
83 
84 //#include "../../../remove_error_code_unused_warning.hpp"
85 
86