Skip to content

Commit

Permalink
Deploying to gh-pages from @ e892ba8 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
huixie90 committed Jun 5, 2024
1 parent 27e222d commit 194d459
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 79 deletions.
12 changes: 12 additions & 0 deletions any_view.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,18 @@ struct UI {
The implementation of creation of the results of `getWidgetNames` is hidden in a separate translation unit.
And this is what we are going to measure
```cpp
lib::UI ui{global_widgets | std::views::take(state.range(0)) |
td::ranges::to<std::vector>()};
for (auto _ : state) {
for (auto const& name : ui.getWidgetNames()) {
benchmark::DoNotOptimize(const_cast<std::string&>(name));
}
}
```

In first case, we use the `view` directly. It is tedious to spell the type, and it is impossible to use lambda now because the function type is part of the result type. We ended up writing something like this

```cpp
Expand Down
Loading

0 comments on commit 194d459

Please sign in to comment.