diff --git a/docs/index.md b/docs/index.md index f15be56..df6f0b7 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,113 +1,117 @@ # Header file `optional.hpp` -
#define TL_OPTIONAL_HPP
+
#define TL_OPTIONAL_HPP
 
-#define TL_OPTIONAL_VERSION_MAJOR
+#define TL_OPTIONAL_VERSION_MAJOR
 
-#define TL_OPTIONAL_VERSION_MINOR
+#define TL_OPTIONAL_VERSION_MINOR
 
-#define IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T)
+#define IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T)
 
-#define IS_TRIVIALLY_COPY_ASSIGNABLE(T)
+#define IS_TRIVIALLY_COPY_ASSIGNABLE(T)
 
-#define IS_TRIVIALLY_DESTRUCTIBLE(T)
+#define IS_TRIVIALLY_DESTRUCTIBLE(T)
 
-#define TL_OPTIONAL_CXX14
+#define TL_OPTIONAL_CXX14
 
-namespace tl
+#define TL_MONOSTATE_INPLACE_MUTEX
+
+#define TL_TRAITS_MUTEX
+
+namespace tl
 {
-    class monostate;
+    class monostate;
     
-    struct in_place_t;
+    struct in_place_t;
     
-    constexpr in_place_t{} in_place;
+    constexpr in_place_t{} in_place;
     
-    struct nullopt_t;
+    struct nullopt_t;
     
     static constexpr nullopt_t nullopt;
     
-    class bad_optional_access;
+    class bad_optional_access;
     
     template <class T>
-    class optional;
+    class optional;
     
     template <class T, class U>
-    constexpr bool operator==(const optional<T>& lhs, const optional<U>& rhs);
+    constexpr bool operator==(const optional<T>& lhs, const optional<U>& rhs);
     template <class T, class U>
-    constexpr bool operator!=(const optional<T>& lhs, const optional<U>& rhs);
+    constexpr bool operator!=(const optional<T>& lhs, const optional<U>& rhs);
     template <class T, class U>
-    constexpr bool operator<(const optional<T>& lhs, const optional<U>& rhs);
+    constexpr bool operator<(const optional<T>& lhs, const optional<U>& rhs);
     template <class T, class U>
-    constexpr bool operator>(const optional<T>& lhs, const optional<U>& rhs);
+    constexpr bool operator>(const optional<T>& lhs, const optional<U>& rhs);
     template <class T, class U>
-    constexpr bool operator<=(const optional<T>& lhs, const optional<U>& rhs);
+    constexpr bool operator<=(const optional<T>& lhs, const optional<U>& rhs);
     template <class T, class U>
-    constexpr bool operator>=(const optional<T>& lhs, const optional<U>& rhs);
+    constexpr bool operator>=(const optional<T>& lhs, const optional<U>& rhs);
     
     template <class T>
-    constexpr bool operator==(const optional<T>& lhs, nullopt_t) noexcept;
+    constexpr bool operator==(const optional<T>& lhs, nullopt_t) noexcept;
     template <class T>
-    constexpr bool operator==(nullopt_t, const optional<T>& rhs) noexcept;
+    constexpr bool operator==(nullopt_t, const optional<T>& rhs) noexcept;
     template <class T>
-    constexpr bool operator!=(const optional<T>& lhs, nullopt_t) noexcept;
+    constexpr bool operator!=(const optional<T>& lhs, nullopt_t) noexcept;
     template <class T>
-    constexpr bool operator!=(nullopt_t, const optional<T>& rhs) noexcept;
+    constexpr bool operator!=(nullopt_t, const optional<T>& rhs) noexcept;
     template <class T>
-    constexpr bool operator<(const optional<T>&, nullopt_t) noexcept;
+    constexpr bool operator<(const optional<T>&, nullopt_t) noexcept;
     template <class T>
-    constexpr bool operator<(nullopt_t, const optional<T>& rhs) noexcept;
+    constexpr bool operator<(nullopt_t, const optional<T>& rhs) noexcept;
     template <class T>
-    constexpr bool operator<=(const optional<T>& lhs, nullopt_t) noexcept;
+    constexpr bool operator<=(const optional<T>& lhs, nullopt_t) noexcept;
     template <class T>
-    constexpr bool operator<=(nullopt_t, const optional<T>&) noexcept;
+    constexpr bool operator<=(nullopt_t, const optional<T>&) noexcept;
     template <class T>
-    constexpr bool operator>(const optional<T>& lhs, nullopt_t) noexcept;
+    constexpr bool operator>(const optional<T>& lhs, nullopt_t) noexcept;
     template <class T>
-    constexpr bool operator>(nullopt_t, const optional<T>&) noexcept;
+    constexpr bool operator>(nullopt_t, const optional<T>&) noexcept;
     template <class T>
-    constexpr bool operator>=(const optional<T>&, nullopt_t) noexcept;
+    constexpr bool operator>=(const optional<T>&, nullopt_t) noexcept;
     template <class T>
-    constexpr bool operator>=(nullopt_t, const optional<T>& rhs) noexcept;
+    constexpr bool operator>=(nullopt_t, const optional<T>& rhs) noexcept;
     
     template <class T, class U>
-    constexpr bool operator==(const optional<T>& lhs, const U& rhs);
+    constexpr bool operator==(const optional<T>& lhs, const U& rhs);
     template <class T, class U>
-    constexpr bool operator==(const U& lhs, const optional<T>& rhs);
+    constexpr bool operator==(const U& lhs, const optional<T>& rhs);
     template <class T, class U>
-    constexpr bool operator!=(const optional<T>& lhs, const U& rhs);
+    constexpr bool operator!=(const optional<T>& lhs, const U& rhs);
     template <class T, class U>
-    constexpr bool operator!=(const U& lhs, const optional<T>& rhs);
+    constexpr bool operator!=(const U& lhs, const optional<T>& rhs);
     template <class T, class U>
-    constexpr bool operator<(const optional<T>& lhs, const U& rhs);
+    constexpr bool operator<(const optional<T>& lhs, const U& rhs);
     template <class T, class U>
-    constexpr bool operator<(const U& lhs, const optional<T>& rhs);
+    constexpr bool operator<(const U& lhs, const optional<T>& rhs);
     template <class T, class U>
-    constexpr bool operator<=(const optional<T>& lhs, const U& rhs);
+    constexpr bool operator<=(const optional<T>& lhs, const U& rhs);
     template <class T, class U>
-    constexpr bool operator<=(const U& lhs, const optional<T>& rhs);
+    constexpr bool operator<=(const U& lhs, const optional<T>& rhs);
     template <class T, class U>
-    constexpr bool operator>(const optional<T>& lhs, const U& rhs);
+    constexpr bool operator>(const optional<T>& lhs, const U& rhs);
     template <class T, class U>
-    constexpr bool operator>(const U& lhs, const optional<T>& rhs);
+    constexpr bool operator>(const U& lhs, const optional<T>& rhs);
     template <class T, class U>
-    constexpr bool operator>=(const optional<T>& lhs, const U& rhs);
+    constexpr bool operator>=(const optional<T>& lhs, const U& rhs);
     template <class T, class U>
-    constexpr bool operator>=(const U& lhs, const optional<T>& rhs);
+    constexpr bool operator>=(const U& lhs, const optional<T>& rhs);
     
     template <class T>
-    void swap(optional<T> &lhs, optional<T> &rhs);
+    void swap(optional<T> &lhs, optional<T>
     
     template <class T>
-    constexpr optional<detail::decay_t<T>> make_optional(T&& v);
+    constexpr optional<detail::decay_t<T>> make_optional(T&& v);
     
     template <class T, class ... Args>
-    constexpr optional<T> make_optional(Args&&... args);
+    constexpr optional<T> make_optional(Args&&... args);
     
     template <class T, class U, class ... Args>
-    constexpr optional<T> make_optional(std::initializer_list<U> il, Args&&... args);
+    constexpr optional<T> make_optional(std::initializer_list<U> il, Args&&... args);
 }
 
-namespace std
+namespace std
 {
 }
@@ -123,14 +127,14 @@ Used to represent an optional with no data; essentially a bool
struct in_place_t
 {
-    in_place_t() = default;
+    in_place_t() = default;
 };
A tag type to tell optional to construct its value in-place ## Variable `tl::in_place` -
constexpr in_place_t{} in_place;
+
constexpr in_place_t{} in_place;
A tag to tell optional to construct its value in-place @@ -138,9 +142,9 @@ A tag to tell optional to construct its value in-place
struct nullopt_t
 {
-    struct do_not_use;
+    struct do_not_use;
     
-    constexpr nullopt_t(do_not_use, do_not_use) noexcept;
+    constexpr nullopt_t(do_not_use, do_not_use) noexcept;
 };
A tag type to represent an empty optional @@ -172,62 +176,62 @@ public: template <class F> constexpr auto and_then(F &&f) const &&; - template <class F> auto map(F &&f) &; - template <class F> auto map(F &&f) &&; - template <class F> auto map(F &&f) const&; - template <class F> auto map(F &&f) const&&; + template <class F> constexpr auto map(F &&f) &; + template <class F> constexpr auto map(F &&f) &&; + template <class F> constexpr auto map(F &&f) const&; + template <class F> constexpr auto map(F &&f) const&&; template <class F> optional<T> or_else (F &&f) &; template <class F> optional<T> or_else (F &&f) &&; template <class F> optional<T> or_else (F &&f) const &; template <class F, class U> - U map_or(F&& f, U&& u) &; + U map_or(F&& f, U&& u) &; template <class F, class U> - U map_or(F&& f, U&& u) &&; + U map_or(F&& f, U&& u) &&; template <class F, class U> - U map_or(F&& f, U&& u) const &; + U map_or(F&& f, U&& u) const &; template <class F, class U> - U map_or(F&& f, U&& u) const &&; + U map_or(F&& f, U&& u) const &&; template <class F, class U> auto map_or_else(F &&f, U &&u) &; template <class F, class U> - auto map_or_else(F &&f, U &&u) &&; + auto map_or_else(F &&f, U &&u) template <class F, class U> - auto map_or_else(F &&f, U &&u) const &; + auto map_or_else(F &&f, U &&u) template <class F, class U> - auto map_or_else(F &&f, U &&u) const &&; + auto map_or_else(F &&f, U &&u) template <class U> - constexpr optional<typename std::decay<U>::type> conjunction(U&& u) const; + constexpr optional<typename std::decay<U>::type> conjunction(U&& u) const; - constexpr optional disjunction(const optional& rhs) &; - constexpr optional disjunction(const optional& rhs) const &; - constexpr optional disjunction(const optional& rhs) &&; - constexpr optional disjunction(const optional& rhs) const &&; - constexpr optional disjunction(optional&& rhs) &; - constexpr optional disjunction(optional&& rhs) const &; - constexpr optional disjunction(optional&& rhs) &&; - constexpr optional disjunction(optional&& rhs) const &&; + constexpr optional disjunction(const optional& rhs) &; + constexpr optional disjunction(const optional& rhs) const &; + constexpr optional disjunction(const optional& rhs) &&; + constexpr optional disjunction(const optional& rhs) const &&; + constexpr optional disjunction(optional&& rhs) &; + constexpr optional disjunction(optional&& rhs) const &; + constexpr optional disjunction(optional&& rhs) &&; + constexpr optional disjunction(optional&& rhs) const &&; - optional take() &; - optional take() const &; - optional take() &&; - optional take() const &&; + optional take() &; + optional take() const &; + optional take() &&; + optional take() const &&; - using value_type = T; + using value_type = T; - constexpr optional() noexcept = default; - constexpr optional(nullopt_t) noexcept; + constexpr optional() noexcept = default; + constexpr optional(nullopt_t) noexcept; - constexpr optional(const optional& rhs) = default; + constexpr optional(const optional& rhs) = default; - constexpr optional(optional&& rhs) = default; + constexpr optional(optional&& rhs) = default; - template <class... Args> constexpr explicit optional(in_place_t, Args&&... args); + template <class... Args> constexpr explicit template <class U, class... Args> - constexpr explicit optional(in_place_t, std::initializer_list<U>&, Args&&... args); + constexpr explicit template <class U=T> constexpr optional(U &&u); @@ -235,13 +239,13 @@ public: template <class U> optional(optional<U> &&rhs); - ~optional() = default; + ~optional() = default; - optional& operator=(nullopt_t) noexcept; + optional& operator=(nullopt_t) noexcept; - optional& operator=(const optional& rhs) = default; + optional& operator=(const optional& rhs) = default; - optional& operator=(optional&& rhs) = default; + optional& operator=(optional&& rhs) = default; optional &operator=(U &&u); @@ -250,11 +254,12 @@ public: optional &operator=(optional<U> && rhs); template <class ... Args> - T& emplace(Args&&... args); + T& emplace(Args&&... args); + template <class U, class... Args> - T& emplace(std::initializer_list<U> il, Args &&... args); + T& - void swap(optional& rhs) noexcept(std::is_nothrow_move_constructible<T>::value&&detail::is_nothrow_swappable<T>::value); + void swap(optional& rhs) noexcept(std::is_nothrow_move_constructible<T>::value&&detail::is_nothrow_swappable<T>::value); constexpr const T *operator->() const; constexpr T *operator->(); @@ -262,18 +267,18 @@ public: constexpr T &operator*(); constexpr const T &operator*() const; - constexpr bool has_value() const noexcept; - constexpr operator bool() const noexcept; + constexpr bool has_value() const noexcept; + constexpr operator bool() const noexcept; - constexpr T& value() &; + constexpr T& value() &; constexpr const T &value() const; template <class U> - constexpr T value_or(U&& u) const &; + constexpr T value_or(U&& u) const &; template <class U> - constexpr T value_or(U&& u) &&; + constexpr T value_or(U&& u) &&; - void reset() noexcept; + void reset() noexcept; };
An optional object is an object that contains the storage for another object and manages the lifetime of this contained object, if any. The contained object may be initialized after the optional object has been initialized, and may be destroyed before the optional object has been destroyed. The initialization state of the contained object is tracked by the optional object. @@ -292,19 +297,17 @@ An optional object is an object that contains the storage for another object and (4) template <class F> constexpr auto and_then(F &&f) const &&; -Carries out some operation which returns an optional on the stored object if there is one. - -*Requires*: `std::invoke(std::forward(f), value())` returns a `std::optional` for some `U`. \\returns Let `U` be the result of `std::invoke(std::forward(f), value())`. Returns a `std::optional`. The return value is empty if `*this` is empty, otherwise the return value of `std::invoke(std::forward(f), value())` is returned. +Carries out some operation which returns an optional on the stored object if there is one. \\requires `std::invoke(std::forward(f), value())` returns a `std::optional` for some `U`. \\returns Let `U` be the result of `std::invoke(std::forward(f), value())`. Returns a `std::optional`. The return value is empty if `*this` is empty, otherwise the return value of `std::invoke(std::forward(f), value())` is returned. ### Function template `tl::optional::map` -
(1)  template <class F> auto map(F &&f) &;
+
(1)  template <class F> constexpr auto map(F &&f) &;
 
-(2)  template <class F> auto map(F &&f) &&;
+(2)  template <class F> constexpr auto map(F &&f) &&;
 
-(3)  template <class F> auto map(F &&f) const&;
+(3)  template <class F> constexpr auto map(F &&f) const&;
 
-(4)  template <class F> auto map(F &&f) const&&;
+(4) template <class F> constexpr auto map(F &&f) const&&;
Carries out some operation on the stored object if there is one. @@ -346,13 +349,13 @@ If there is a value stored, then `f` is called with `**this` and the value is re auto map_or_else(F &&f, U &&u) &; (2) template <class F, class U> - auto map_or_else(F &&f, U &&u) &&; + auto map_or_else(F &&f, U &&u) (3) template <class F, class U> - auto map_or_else(F &&f, U &&u) const &; + auto map_or_else(F &&f, U &&u) (4) template <class F, class U> - auto map_or_else(F &&f, U &&u) const &&; + auto map_or_else(F &&f, U &&u) Maps the stored value with `f` if there is one, otherwise calls `u` and returns the result. @@ -361,39 +364,39 @@ If there is a value stored, then `f` is called with `**this` and the value is re ### Function template `tl::optional::conjunction`
template <class U>
-constexpr optional<typename std::decay<U>::type> conjunction(U&& u) const;
+constexpr optional<typename std::decay<U>::type> conjunction(U&& u) const; *Returns*: `u` if `*this` has a value, otherwise an empty optional. ### Function `tl::optional::disjunction` -
(1)  constexpr optional disjunction(const optional& rhs) &;
+
(1)  constexpr optional disjunction(const optional& rhs) &;
 
-(2)  constexpr optional disjunction(const optional& rhs) const &;
+(2)  constexpr optional disjunction(const optional& rhs) const &;
 
-(3)  constexpr optional disjunction(const optional& rhs) &&;
+(3)  constexpr optional disjunction(const optional& rhs) &&;
 
-(4)  constexpr optional disjunction(const optional& rhs) const &&;
+(4)  constexpr optional disjunction(const optional& rhs) const &&;
 
-(5)  constexpr optional disjunction(optional&& rhs) &;
+(5)  constexpr optional disjunction(optional&& rhs) &;
 
-(6)  constexpr optional disjunction(optional&& rhs) const &;
+(6)  constexpr optional disjunction(optional&& rhs) const &;
 
-(7)  constexpr optional disjunction(optional&& rhs) &&;
+(7)  constexpr optional disjunction(optional&& rhs) &&;
 
-(8)  constexpr optional disjunction(optional&& rhs) const &&;
+(8) constexpr optional disjunction(optional&& rhs) const &&;
*Returns*: `rhs` if `*this` is empty, otherwise the current value. ### Function `tl::optional::take` -
(1)  optional take() &;
+
(1)  optional take() &;
 
-(2)  optional take() const &;
+(2)  optional take() const &;
 
-(3)  optional take() &&;
+(3)  optional take() &&;
 
-(4)  optional take() const &&;
+(4) optional take() const &&;
Takes the value out of the optional, leaving it empty @@ -401,13 +404,13 @@ Takes the value out of the optional, leaving it empty
(1)  constexpr optional() noexcept = default;
 
-(2)  constexpr optional(nullopt_t) noexcept;
+(2) constexpr optional(nullopt_t) noexcept; Constructs an optional that does not contain a value. ### Constructor `tl::optional::optional` -
constexpr optional(const optional& rhs) = default;
+
constexpr optional(const optional& rhs) = default;
Copy constructor @@ -415,7 +418,7 @@ If `rhs` contains a value, the stored value is direct-initialized with it. Other ### Constructor `tl::optional::optional` -
constexpr optional(optional&& rhs) = default;
+
constexpr optional(optional&& rhs) = default;
Move constructor @@ -423,13 +426,15 @@ If `rhs` contains a value, the stored value is direct-initialized with it. Other ### Function template `tl::optional::optional` -
(1)  template <class... Args> constexpr explicit optional(in_place_t, Args&&... args);
+
(1)  template <class... Args> constexpr explicit
 
 (2)  template <class U, class... Args>
-     constexpr explicit optional(in_place_t, std::initializer_list<U>&, Args&&... args);
+ constexpr explicit
Constructs the stored value in-place using the given arguments. +optional(in\_place\_t, Args&&... args); + ### Function template `tl::optional::optional`
template <class U=T> constexpr optional(U &&u);
@@ -456,7 +461,7 @@ Destroys the stored value if there is one. ### Assignment operator `tl::optional::operator=` -
optional& operator=(nullopt_t) noexcept;
+
optional& operator=(nullopt_t) noexcept;
Assignment to empty. @@ -464,7 +469,7 @@ Destroys the current value if there is one. ### Assignment operator `tl::optional::operator=` -
optional& operator=(const optional& rhs) = default;
+
optional& operator=(const optional& rhs) = default;
Copy assignment. @@ -472,7 +477,7 @@ Copies the value from `rhs` if there is one. Otherwise resets the stored value i ### Assignment operator `tl::optional::operator=` -
optional& operator=(optional&& rhs) = default;
+
optional& operator=(optional&& rhs) = default;
Move assignment. @@ -502,17 +507,21 @@ Moves the value from `rhs` if there is one. Otherwise resets the stored value in ### Function template `tl::optional::emplace` -
(1)  template <class ... Args>
-     T& emplace(Args&&... args);
+
template <class ... Args>
+T& emplace(Args&&... args);
-(2) template <class U, class... Args> - T& emplace(std::initializer_list<U> il, Args &&... args);
+Constructs the value in-place, destroying the current one if there is one. \\group emplace -Constructs the value in-place, destroying the current one if there is one. +### Function template `tl::optional::emplace` + +
(1)  template <class U, class... Args>
+     T&
+ +emplace(std::initializer\_list\ il, Args &&... args); ### Function `tl::optional::swap` -
void swap(optional& rhs) noexcept(std::is_nothrow_move_constructible<T>::value&&detail::is_nothrow_swappable<T>::value);
+
void swap(optional& rhs) noexcept(std::is_nothrow_move_constructible<T>::value&&detail::is_nothrow_swappable<T>::value);
Swaps this optional with the other. @@ -577,22 +586,22 @@ Destroys the stored value if one exists, making the optional empty ## Comparison operator `tl::operator==`
(1)  template <class T, class U>
-     constexpr bool operator==(const optional<T>& lhs, const optional<U>& rhs);
+     constexpr bool operator==(const optional<T>& lhs, const optional<U>& rhs);
 
 (2)  template <class T, class U>
-     constexpr bool operator!=(const optional<T>& lhs, const optional<U>& rhs);
+     constexpr bool operator!=(const optional<T>& lhs, const optional<U>& rhs);
 
 (3)  template <class T, class U>
-     constexpr bool operator<(const optional<T>& lhs, const optional<U>& rhs);
+     constexpr bool operator<(const optional<T>& lhs, const optional<U>& rhs);
 
 (4)  template <class T, class U>
-     constexpr bool operator>(const optional<T>& lhs, const optional<U>& rhs);
+     constexpr bool operator>(const optional<T>& lhs, const optional<U>& rhs);
 
 (5)  template <class T, class U>
-     constexpr bool operator<=(const optional<T>& lhs, const optional<U>& rhs);
+     constexpr bool operator<=(const optional<T>& lhs, const optional<U>& rhs);
 
 (6)  template <class T, class U>
-     constexpr bool operator>=(const optional<T>& lhs, const optional<U>& rhs);
+ constexpr bool operator>=(const optional<T>& lhs, const optional<U>& rhs); Compares two optional objects @@ -601,40 +610,40 @@ If both optionals contain a value, they are compared with `T`s relational operat ## Comparison operator `tl::operator==`
(1)  template <class T>
-     constexpr bool operator==(const optional<T>& lhs, nullopt_t) noexcept;
+     constexpr bool operator==(const optional<T>& lhs, nullopt_t) noexcept;
 
 (2)  template <class T>
-     constexpr bool operator==(nullopt_t, const optional<T>& rhs) noexcept;
+     constexpr bool operator==(nullopt_t, const optional<T>& rhs) noexcept;
 
 (3)  template <class T>
-     constexpr bool operator!=(const optional<T>& lhs, nullopt_t) noexcept;
+     constexpr bool operator!=(const optional<T>& lhs, nullopt_t) noexcept;
 
 (4)  template <class T>
-     constexpr bool operator!=(nullopt_t, const optional<T>& rhs) noexcept;
+     constexpr bool operator!=(nullopt_t, const optional<T>& rhs) noexcept;
 
 (5)  template <class T>
-     constexpr bool operator<(const optional<T>&, nullopt_t) noexcept;
+     constexpr bool operator<(const optional<T>&, nullopt_t) noexcept;
 
 (6)  template <class T>
-     constexpr bool operator<(nullopt_t, const optional<T>& rhs) noexcept;
+     constexpr bool operator<(nullopt_t, const optional<T>& rhs) noexcept;
 
 (7)  template <class T>
-     constexpr bool operator<=(const optional<T>& lhs, nullopt_t) noexcept;
+     constexpr bool operator<=(const optional<T>& lhs, nullopt_t) noexcept;
 
 (8)  template <class T>
-     constexpr bool operator<=(nullopt_t, const optional<T>&) noexcept;
+     constexpr bool operator<=(nullopt_t, const optional<T>&) noexcept;
 
 (9)  template <class T>
-     constexpr bool operator>(const optional<T>& lhs, nullopt_t) noexcept;
+     constexpr bool operator>(const optional<T>& lhs, nullopt_t) noexcept;
 
 (10)  template <class T>
-     constexpr bool operator>(nullopt_t, const optional<T>&) noexcept;
+     constexpr bool operator>(nullopt_t, const optional<T>&) noexcept;
 
 (11)  template <class T>
-     constexpr bool operator>=(const optional<T>&, nullopt_t) noexcept;
+     constexpr bool operator>=(const optional<T>&, nullopt_t) noexcept;
 
 (12)  template <class T>
-     constexpr bool operator>=(nullopt_t, const optional<T>& rhs) noexcept;
+ constexpr bool operator>=(nullopt_t, const optional<T>& rhs) noexcept; Compares an optional to a `nullopt` @@ -643,43 +652,50 @@ Equivalent to comparing the optional to an empty optional ## Comparison operator `tl::operator==`
(1)  template <class T, class U>
-     constexpr bool operator==(const optional<T>& lhs, const U& rhs);
+     constexpr bool operator==(const optional<T>& lhs, const U& rhs);
 
 (2)  template <class T, class U>
-     constexpr bool operator==(const U& lhs, const optional<T>& rhs);
+     constexpr bool operator==(const U& lhs, const optional<T>& rhs);
 
 (3)  template <class T, class U>
-     constexpr bool operator!=(const optional<T>& lhs, const U& rhs);
+     constexpr bool operator!=(const optional<T>& lhs, const U& rhs);
 
 (4)  template <class T, class U>
-     constexpr bool operator!=(const U& lhs, const optional<T>& rhs);
+     constexpr bool operator!=(const U& lhs, const optional<T>& rhs);
 
 (5)  template <class T, class U>
-     constexpr bool operator<(const optional<T>& lhs, const U& rhs);
+     constexpr bool operator<(const optional<T>& lhs, const U& rhs);
 
 (6)  template <class T, class U>
-     constexpr bool operator<(const U& lhs, const optional<T>& rhs);
+     constexpr bool operator<(const U& lhs, const optional<T>& rhs);
 
 (7)  template <class T, class U>
-     constexpr bool operator<=(const optional<T>& lhs, const U& rhs);
+     constexpr bool operator<=(const optional<T>& lhs, const U& rhs);
 
 (8)  template <class T, class U>
-     constexpr bool operator<=(const U& lhs, const optional<T>& rhs);
+     constexpr bool operator<=(const U& lhs, const optional<T>& rhs);
 
 (9)  template <class T, class U>
-     constexpr bool operator>(const optional<T>& lhs, const U& rhs);
+     constexpr bool operator>(const optional<T>& lhs, const U& rhs);
 
 (10)  template <class T, class U>
-     constexpr bool operator>(const U& lhs, const optional<T>& rhs);
+     constexpr bool operator>(const U& lhs, const optional<T>& rhs);
 
 (11)  template <class T, class U>
-     constexpr bool operator>=(const optional<T>& lhs, const U& rhs);
+     constexpr bool operator>=(const optional<T>& lhs, const U& rhs);
 
 (12)  template <class T, class U>
-     constexpr bool operator>=(const U& lhs, const optional<T>& rhs);
+ constexpr bool operator>=(const U& lhs, const optional<T>& rhs); Compares the optional with a value. If the optional has a value, it is compared with the other value using `T`s relational operators. Otherwise, the optional is considered less than the value. +## Function template `tl::swap` + +
template <class T>
+void swap(optional<T> &lhs, optional<T>
+ +\&rhs); + -----