Skip to content

Commit 62fc949

Browse files
authored
Typo.
1 parent 53920cf commit 62fc949

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ Even better though, is using ```std::any_of```:
3030

3131
```
3232
// Determines whether 'v' contains 4.
33-
const bool equals_four = std::any_of(v.cbegin(), v.cend(), [](int i)->bool{ return i == 4; });
33+
const bool contains_four = std::any_of(v.cbegin(), v.cend(), [](int i)->bool{ return i == 4; });
3434
```
3535

3636
Here, we've taken a raw ```for loop``` and replaced it with an STL algorithm that, in one line, tells us more clearly what is occurring. This improves readability, minimizes number of lines of code, and provides (likely) the best algorithm for what you're trying to do.
3737

3838
With the release of C++20, this will simplify even further using ranges:
3939
```
40-
const bool equals_four = std::ranges::any_of(v, [](int i)->bool{ return i == 4; });
40+
const bool contains_four = std::ranges::any_of(v, [](int i)->bool{ return i == 4; });
4141
```
4242

4343
## Related STL Talks

0 commit comments

Comments
 (0)