tmp/tmpltxlk5iq/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### Header `<optional>` synopsis <a id="optional.syn">[[optional.syn]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
namespace std {
|
| 5 |
+
// [optional.optional], class template optional
|
| 6 |
+
template <class T>
|
| 7 |
+
class optional;
|
| 8 |
+
|
| 9 |
+
// [optional.nullopt], no-value state indicator
|
| 10 |
+
struct nullopt_t{see below};
|
| 11 |
+
inline constexpr nullopt_t nullopt(unspecified);
|
| 12 |
+
|
| 13 |
+
// [optional.bad.access], class bad_optional_access
|
| 14 |
+
class bad_optional_access;
|
| 15 |
+
|
| 16 |
+
// [optional.relops], relational operators
|
| 17 |
+
template <class T, class U>
|
| 18 |
+
constexpr bool operator==(const optional<T>&, const optional<U>&);
|
| 19 |
+
template <class T, class U>
|
| 20 |
+
constexpr bool operator!=(const optional<T>&, const optional<U>&);
|
| 21 |
+
template <class T, class U>
|
| 22 |
+
constexpr bool operator<(const optional<T>&, const optional<U>&);
|
| 23 |
+
template <class T, class U>
|
| 24 |
+
constexpr bool operator>(const optional<T>&, const optional<U>&);
|
| 25 |
+
template <class T, class U>
|
| 26 |
+
constexpr bool operator<=(const optional<T>&, const optional<U>&);
|
| 27 |
+
template <class T, class U>
|
| 28 |
+
constexpr bool operator>=(const optional<T>&, const optional<U>&);
|
| 29 |
+
|
| 30 |
+
// [optional.nullops], comparison with nullopt
|
| 31 |
+
template <class T> constexpr bool operator==(const optional<T>&, nullopt_t) noexcept;
|
| 32 |
+
template <class T> constexpr bool operator==(nullopt_t, const optional<T>&) noexcept;
|
| 33 |
+
template <class T> constexpr bool operator!=(const optional<T>&, nullopt_t) noexcept;
|
| 34 |
+
template <class T> constexpr bool operator!=(nullopt_t, const optional<T>&) noexcept;
|
| 35 |
+
template <class T> constexpr bool operator<(const optional<T>&, nullopt_t) noexcept;
|
| 36 |
+
template <class T> constexpr bool operator<(nullopt_t, const optional<T>&) noexcept;
|
| 37 |
+
template <class T> constexpr bool operator<=(const optional<T>&, nullopt_t) noexcept;
|
| 38 |
+
template <class T> constexpr bool operator<=(nullopt_t, const optional<T>&) noexcept;
|
| 39 |
+
template <class T> constexpr bool operator>(const optional<T>&, nullopt_t) noexcept;
|
| 40 |
+
template <class T> constexpr bool operator>(nullopt_t, const optional<T>&) noexcept;
|
| 41 |
+
template <class T> constexpr bool operator>=(const optional<T>&, nullopt_t) noexcept;
|
| 42 |
+
template <class T> constexpr bool operator>=(nullopt_t, const optional<T>&) noexcept;
|
| 43 |
+
|
| 44 |
+
// [optional.comp_with_t], comparison with T
|
| 45 |
+
template <class T, class U> constexpr bool operator==(const optional<T>&, const U&);
|
| 46 |
+
template <class T, class U> constexpr bool operator==(const U&, const optional<T>&);
|
| 47 |
+
template <class T, class U> constexpr bool operator!=(const optional<T>&, const U&);
|
| 48 |
+
template <class T, class U> constexpr bool operator!=(const U&, const optional<T>&);
|
| 49 |
+
template <class T, class U> constexpr bool operator<(const optional<T>&, const U&);
|
| 50 |
+
template <class T, class U> constexpr bool operator<(const U&, const optional<T>&);
|
| 51 |
+
template <class T, class U> constexpr bool operator<=(const optional<T>&, const U&);
|
| 52 |
+
template <class T, class U> constexpr bool operator<=(const U&, const optional<T>&);
|
| 53 |
+
template <class T, class U> constexpr bool operator>(const optional<T>&, const U&);
|
| 54 |
+
template <class T, class U> constexpr bool operator>(const U&, const optional<T>&);
|
| 55 |
+
template <class T, class U> constexpr bool operator>=(const optional<T>&, const U&);
|
| 56 |
+
template <class T, class U> constexpr bool operator>=(const U&, const optional<T>&);
|
| 57 |
+
|
| 58 |
+
// [optional.specalg], specialized algorithms
|
| 59 |
+
template <class T>
|
| 60 |
+
void swap(optional<T>&, optional<T>&) noexcept(see below);
|
| 61 |
+
|
| 62 |
+
template <class T>
|
| 63 |
+
constexpr optional<see below> make_optional(T&&);
|
| 64 |
+
template <class T, class... Args>
|
| 65 |
+
constexpr optional<T> make_optional(Args&&... args);
|
| 66 |
+
template <class T, class U, class... Args>
|
| 67 |
+
constexpr optional<T> make_optional(initializer_list<U> il, Args&&... args);
|
| 68 |
+
|
| 69 |
+
// [optional.hash], hash support
|
| 70 |
+
template <class T> struct hash;
|
| 71 |
+
template <class T> struct hash<optional<T>>;
|
| 72 |
+
}
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
A program that necessitates the instantiation of template `optional` for
|
| 76 |
+
a reference type, or for possibly cv-qualified types `in_place_t` or
|
| 77 |
+
`nullopt_t` is ill-formed.
|
| 78 |
+
|