Skip to content

Commit 86b846d

Browse files
fix: assign6 readme typo
1 parent 4148284 commit 86b846d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

assign6/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ It can help to **think about what the type of `output` is and work backwards fro
140140
> * Returns the optional itself if it has a value; otherwise, it calls a function to produce a new optional.
141141
> *
142142
> * The opposite of `and_then`.
143-
> * The function passed to `or_else` takes a non-optional instance of type `T` and returns a `std::optional<U>`.
143+
> * The function passed to `or_else` takes in no arguments and returns a `std::optional<U>`.
144144
> * If the optional has a value, `or_else` returns it.
145-
> * If the optional doesn't have a value (i.e. it is `std::nullopt`), `or_else applies the function to its value and returns the result.
145+
> * If the optional doesn't have a value (i.e. it is `std::nullopt`), `or_else invokes the function and returns the result.
146146
> */
147147
> template <typename U>
148148
> std::optional<U> std::optional<T>::or_else(std::function<std::optional<U>(T)> func);
@@ -154,7 +154,7 @@ It can help to **think about what the type of `output` is and work backwards fro
154154
> opt
155155
> .and_then([](T value) -> std::optional<U> { return /* ... */; })
156156
> .transform([](T value) -> U { return /* ... */; });
157-
> .or_else([](T value) -> std::optional<U> { return /* ... */; })
157+
> .or_else([]() -> std::optional<U> { return /* ... */; })
158158
> ```
159159
>
160160
> <sup>Note that the `->` notation in the lambda function is a way of explicitly writing out the return type of the function!</sup>

0 commit comments

Comments
 (0)