Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
robertshepherdcpp authored Apr 3, 2023
1 parent 22464a2 commit 6759b66
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ BM_for_each 144 ns 82.6 ns 8173558
### `mlib::transform`
`mlib::transform` is a `constexpr` function takes a given tuple, `t` and a given function `f` that transforms one of the elements inside of the tuple. An example invocation of `mlib::transfrom` looks like this:
```C++
std::tuple<int, char, bool> t{42, 'c', true};
std::tuple t{1, 4, 7, 'c', true, false};
mlib::transform(t, [](auto& t){return decltype(t)(static_cast<int>(t));});
```
This invokation, has a tuple t: `std::tuple<int, char, bool>` and then transforms that tuple using the `[](auto& t){return decltype(t)(static_cast<int>(t));};`, and does so accordingly.
This invokation, has a tuple t: `std::tuple<int, char, bool>` and then transforms that tuple using the `[](auto t) { return (static_cast<int>(t)) + 1; };`, and does so accordingly.
`mlib::transform`'s implementation looks like this:
```C++
Expand Down

0 comments on commit 6759b66

Please sign in to comment.