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 // template <class T> 13 // class optional 14 // { 15 // public: 16 // typedef T value_type; 17 // ... 18 19 #include <experimental/optional> 20 #include <type_traits> 21 22 #if _LIBCPP_STD_VER > 11 23 24 using std::experimental::optional; 25 26 template <class Opt, class T> 27 void test()28test() 29 { 30 static_assert(std::is_same<typename Opt::value_type, T>::value, ""); 31 } 32 33 #endif // _LIBCPP_STD_VER > 11 34 main()35int main() 36 { 37 #if _LIBCPP_STD_VER > 11 38 test<optional<int>, int>(); 39 test<optional<const int>, const int>(); 40 test<optional<double>, double>(); 41 test<optional<const double>, const double>(); 42 #endif // _LIBCPP_STD_VER > 11 43 } 44