1*a9e65961SEric Fiselier //===----------------------------------------------------------------------===// 2*a9e65961SEric Fiselier // 3*a9e65961SEric Fiselier // The LLVM Compiler Infrastructure 4*a9e65961SEric Fiselier // 5*a9e65961SEric Fiselier // This file is dual licensed under the MIT and the University of Illinois Open 6*a9e65961SEric Fiselier // Source Licenses. See LICENSE.TXT for details. 7*a9e65961SEric Fiselier // 8*a9e65961SEric Fiselier //===----------------------------------------------------------------------===// 9*a9e65961SEric Fiselier 10*a9e65961SEric Fiselier // UNSUPPORTED: c++98, c++03, c++11, c++14 11*a9e65961SEric Fiselier // <optional> 12*a9e65961SEric Fiselier 13*a9e65961SEric Fiselier // template <class T> constexpr bool operator<(const optional<T>& x, nullopt_t) noexcept; 14*a9e65961SEric Fiselier // template <class T> constexpr bool operator<(nullopt_t, const optional<T>& x) noexcept; 15*a9e65961SEric Fiselier 16*a9e65961SEric Fiselier #include <optional> 17*a9e65961SEric Fiselier 18*a9e65961SEric Fiselier int main() 19*a9e65961SEric Fiselier { 20*a9e65961SEric Fiselier using std::optional; 21*a9e65961SEric Fiselier using std::nullopt_t; 22*a9e65961SEric Fiselier using std::nullopt; 23*a9e65961SEric Fiselier 24*a9e65961SEric Fiselier { 25*a9e65961SEric Fiselier typedef int T; 26*a9e65961SEric Fiselier typedef optional<T> O; 27*a9e65961SEric Fiselier 28*a9e65961SEric Fiselier constexpr O o1; // disengaged 29*a9e65961SEric Fiselier constexpr O o2{1}; // engaged 30*a9e65961SEric Fiselier 31*a9e65961SEric Fiselier static_assert ( !(nullopt < o1), "" ); 32*a9e65961SEric Fiselier static_assert ( (nullopt < o2), "" ); 33*a9e65961SEric Fiselier static_assert ( !(o1 < nullopt), "" ); 34*a9e65961SEric Fiselier static_assert ( !(o2 < nullopt), "" ); 35*a9e65961SEric Fiselier 36*a9e65961SEric Fiselier static_assert (noexcept(nullopt < o1), ""); 37*a9e65961SEric Fiselier static_assert (noexcept(o1 < nullopt), ""); 38*a9e65961SEric Fiselier } 39*a9e65961SEric Fiselier } 40