4684ddb6aa
- import libcxx - reduce targets to the one when compiled as a tools Change-Id: Iabb8427f80ff8e89463559a28bcb8b4f2bdbc496
43 lines
977 B
C++
43 lines
977 B
C++
//===----------------------------------------------------------------------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
// Source Licenses. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// <optional>
|
|
|
|
// template <class T>
|
|
// class optional
|
|
// {
|
|
// public:
|
|
// typedef T value_type;
|
|
// ...
|
|
|
|
#include <experimental/optional>
|
|
#include <type_traits>
|
|
|
|
#if _LIBCPP_STD_VER > 11
|
|
|
|
using std::experimental::optional;
|
|
|
|
template <class Opt, class T>
|
|
void
|
|
test()
|
|
{
|
|
static_assert(std::is_same<typename Opt::value_type, T>::value, "");
|
|
}
|
|
|
|
#endif // _LIBCPP_STD_VER > 11
|
|
|
|
int main()
|
|
{
|
|
#if _LIBCPP_STD_VER > 11
|
|
test<optional<int>, int>();
|
|
test<optional<const int>, const int>();
|
|
test<optional<double>, double>();
|
|
test<optional<const double>, const double>();
|
|
#endif // _LIBCPP_STD_VER > 11
|
|
}
|