xref: /freebsd/contrib/llvm-project/libcxx/include/expected (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
1bdd1243dSDimitry Andric// -*- C++ -*-
2bdd1243dSDimitry Andric//===----------------------------------------------------------------------===//
3bdd1243dSDimitry Andric//
4bdd1243dSDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5bdd1243dSDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
6bdd1243dSDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7bdd1243dSDimitry Andric//
8bdd1243dSDimitry Andric//===----------------------------------------------------------------------===//
9bdd1243dSDimitry Andric
10bdd1243dSDimitry Andric#ifndef _LIBCPP_EXPECTED
11bdd1243dSDimitry Andric#define _LIBCPP_EXPECTED
12bdd1243dSDimitry Andric
13bdd1243dSDimitry Andric/*
14bdd1243dSDimitry Andric  Header <expected> synopsis
15bdd1243dSDimitry Andric
16bdd1243dSDimitry Andricnamespace std {
17bdd1243dSDimitry Andric  // [expected.unexpected], class template unexpected
18bdd1243dSDimitry Andric  template<class E> class unexpected;
19bdd1243dSDimitry Andric
20bdd1243dSDimitry Andric  // [expected.bad], class template bad_expected_access
21bdd1243dSDimitry Andric  template<class E> class bad_expected_access;
22bdd1243dSDimitry Andric
23bdd1243dSDimitry Andric  // [expected.bad.void], specialization for void
24bdd1243dSDimitry Andric  template<> class bad_expected_access<void>;
25bdd1243dSDimitry Andric
26bdd1243dSDimitry Andric  // in-place construction of unexpected values
27bdd1243dSDimitry Andric  struct unexpect_t {
28bdd1243dSDimitry Andric    explicit unexpect_t() = default;
29bdd1243dSDimitry Andric  };
30bdd1243dSDimitry Andric  inline constexpr unexpect_t unexpect{};
31bdd1243dSDimitry Andric
32bdd1243dSDimitry Andric  // [expected.expected], class template expected
33bdd1243dSDimitry Andric  template<class T, class E> class expected;
34bdd1243dSDimitry Andric
35bdd1243dSDimitry Andric  // [expected.void], partial specialization of expected for void types
36bdd1243dSDimitry Andric  template<class T, class E> requires is_void_v<T> class expected<T, E>;
37bdd1243dSDimitry Andric}
38bdd1243dSDimitry Andric
39bdd1243dSDimitry Andric*/
40bdd1243dSDimitry Andric
41bdd1243dSDimitry Andric#include <__config>
42*0fca6ea1SDimitry Andric
43*0fca6ea1SDimitry Andric#if _LIBCPP_STD_VER >= 23
44bdd1243dSDimitry Andric#  include <__expected/bad_expected_access.h>
45bdd1243dSDimitry Andric#  include <__expected/expected.h>
46bdd1243dSDimitry Andric#  include <__expected/unexpect.h>
47bdd1243dSDimitry Andric#  include <__expected/unexpected.h>
48*0fca6ea1SDimitry Andric#endif
49*0fca6ea1SDimitry Andric
50bdd1243dSDimitry Andric#include <version>
51bdd1243dSDimitry Andric
52bdd1243dSDimitry Andric#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
53bdd1243dSDimitry Andric#  pragma GCC system_header
54bdd1243dSDimitry Andric#endif
55bdd1243dSDimitry Andric
56*0fca6ea1SDimitry Andric#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
57*0fca6ea1SDimitry Andric#  include <cstddef>
58*0fca6ea1SDimitry Andric#  include <initializer_list>
59*0fca6ea1SDimitry Andric#  include <new>
60*0fca6ea1SDimitry Andric#endif
61*0fca6ea1SDimitry Andric
62bdd1243dSDimitry Andric#endif // _LIBCPP_EXPECTED
63