diff --git a/docs/index.md b/docs/index.md index 993f68f..f15be56 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,6 +1,20 @@ # Header file `optional.hpp` -
namespace tl
+#define TL_OPTIONAL_HPP
+
+#define TL_OPTIONAL_VERSION_MAJOR
+
+#define TL_OPTIONAL_VERSION_MINOR
+
+#define IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T)
+
+#define IS_TRIVIALLY_COPY_ASSIGNABLE(T)
+
+#define IS_TRIVIALLY_DESTRUCTIBLE(T)
+
+#define TL_OPTIONAL_CXX14
+
+namespace tl
{
class monostate;
@@ -160,8 +174,8 @@ public:
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> auto map(F &&f) const&;
+ template <class F> auto map(F &&f) const&&;
template <class F> optional<T> or_else (F &&f) &;
template <class F> optional<T> or_else (F &&f) &&;
@@ -207,9 +221,9 @@ public:
constexpr optional() noexcept = default;
constexpr optional(nullopt_t) noexcept;
- constexpr optional(const optional& rhs);
+ constexpr optional(const optional& rhs) = default;
- constexpr optional(optional&& rhs) noexcept(std::is_nothrow_move_constructible<T>::value);
+ constexpr optional(optional&& rhs) = default;
template <class... Args> constexpr explicit optional(in_place_t, Args&&... args);
template <class U, class... Args>
@@ -225,9 +239,9 @@ public:
optional& operator=(nullopt_t) noexcept;
- optional& operator=(const optional& rhs);
+ optional& operator=(const optional& rhs) = default;
- optional& operator=(optional&& rhs) noexcept(std::is_nothrow_move_assignable<T>::value&&std::is_nothrow_move_constructible<T>::value);
+ optional& operator=(optional&& rhs) = default;
optional &operator=(U &&u);
@@ -251,7 +265,7 @@ public:
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>
@@ -280,9 +294,7 @@ An optional object is an object that contains the storage for another object and
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.
+*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`
@@ -290,9 +302,9 @@ Carries out some operation which returns an optional on the stored object if the
(2) template <class F> auto map(F &&f) &&;
-(3) template <class F> auto map(F &&f) const &;
+(3) template <class F> auto map(F &&f) const&;
-(4) template <class F> auto map(F &&f) const &&;
+(4) template <class F> auto map(F &&f) const&&;
Carries out some operation on the stored object if there is one.
@@ -308,9 +320,7 @@ Carries out some operation on the stored object if there is one.
Calls `f` if the optional is empty
-*Requires*: `std::invoke_result_tconstexpr optional(const optional& rhs);
+constexpr optional(const optional& rhs) = default;
Copy constructor
@@ -405,7 +415,7 @@ If `rhs` contains a value, the stored value is direct-initialized with it. Other
### Constructor `tl::optional::optional`
-constexpr optional(optional&& rhs) noexcept(std::is_nothrow_move_constructible<T>::value);
+constexpr optional(optional&& rhs) = default;
Move constructor
@@ -454,7 +464,7 @@ Destroys the current value if there is one.
### Assignment operator `tl::optional::operator=`
-optional& operator=(const optional& rhs);
+optional& operator=(const optional& rhs) = default;
Copy assignment.
@@ -462,7 +472,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) noexcept(std::is_nothrow_move_assignable<T>::value&&std::is_nothrow_move_constructible<T>::value);
+optional& operator=(optional&& rhs) = default;
Move assignment.
@@ -538,12 +548,14 @@ If neither optionals have a value, nothing happens. If both have a value, the va
### Function `tl::optional::value`
-(1) constexpr T &value();
+(1) constexpr T& value() &;
(2) constexpr const T &value() const;
*Returns*: the contained value if there is one, otherwise throws \[bad\_optional\_access\]
+synopsis constexpr T \&value();
+
### Function template `tl::optional::value_or`
(1) template <class U>