Home | History | Annotate | Download | only in futures.promise
      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 // UNSUPPORTED: libcpp-has-no-threads
     11 // UNSUPPORTED: c++98, c++03
     12 
     13 // <future>
     14 
     15 // class promise<R>
     16 
     17 // promise();
     18 
     19 #include <future>
     20 #include <cassert>
     21 
     22 int main()
     23 {
     24     {
     25         std::promise<int> p;
     26         std::future<int> f = p.get_future();
     27         assert(f.valid());
     28     }
     29     {
     30         std::promise<int&> p;
     31         std::future<int&> f = p.get_future();
     32         assert(f.valid());
     33     }
     34     {
     35         std::promise<void> p;
     36         std::future<void> f = p.get_future();
     37         assert(f.valid());
     38     }
     39 }
     40