Home | History | Annotate | Download | only in optional.object
      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: c++98, c++03, c++11, c++14
     11 // <optional>
     12 
     13 // template <class T>
     14 // class optional
     15 // {
     16 // public:
     17 //     typedef T value_type;
     18 //     ...
     19 
     20 #include <optional>
     21 #include <type_traits>
     22 
     23 using std::optional;
     24 
     25 template <class Opt, class T>
     26 void
     27 test()
     28 {
     29     static_assert(std::is_same<typename Opt::value_type, T>::value, "");
     30 }
     31 
     32 int main()
     33 {
     34     test<optional<int>, int>();
     35     test<optional<const int>, const int>();
     36     test<optional<double>, double>();
     37     test<optional<const double>, const double>();
     38 }
     39