Home | History | Annotate | Download | only in optional.inplace
      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 // <optional>
     11 
     12 // struct in_place_t{};
     13 // constexpr in_place_t in_place{};
     14 
     15 #include <experimental/optional>
     16 #include <type_traits>
     17 
     18 #if _LIBCPP_STD_VER > 11
     19 
     20 using std::experimental::optional;
     21 using std::experimental::in_place_t;
     22 using std::experimental::in_place;
     23 
     24 constexpr
     25 int
     26 test(const in_place_t&)
     27 {
     28     return 3;
     29 }
     30 
     31 #endif
     32 
     33 int main()
     34 {
     35 #if _LIBCPP_STD_VER > 11
     36 
     37     static_assert((std::is_class<in_place_t>::value), "");
     38     static_assert((std::is_empty<in_place_t>::value), "");
     39 
     40     static_assert(test(in_place) == 3, "");
     41 #endif
     42 }
     43