Skip to content

Commit

Permalink
update(cpp-stl): usage of find find_if
Browse files Browse the repository at this point in the history
issue #104
  • Loading branch information
sabertazimi committed Nov 23, 2018
1 parent f339a63 commit af05970
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions language/cpp/cppBasicNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@
- [Permutation Algorithms](#permutation-algorithms)
- [Numeric Algorithms](#numeric-algorithms)
- [Query Algorithms](#query-algorithms)
- [Equal STL Algo](#equal-stl-algo)
- [Search Algortihms](#search-algortihms)
- [Find STL Algo](#find-stl-algo)
- [Set Algortihms](#set-algortihms)
- [Mover Algorithms](#mover-algorithms)
- [Value Algorithms](#value-algorithms)
Expand Down Expand Up @@ -947,6 +949,8 @@ lexicographical_compare
mismatch
```

#### Equal STL Algo

```cpp
template<class InputIt1, class InputIt2>
bool equal(
Expand Down Expand Up @@ -995,6 +999,24 @@ max_element
minmax_element
```

#### Find STL Algo

```cpp
template<class InputIterator, class T>
InputIterator find (InputIterator first, InputIterator last, const T& val) {
while (first!=last) {
if (*first==val) return first;
++first;
}
return last;
}
```
```cpp
auto it = std::find_if(begin(g_register_descriptors), end(g_register_descriptors),
[r](auto&& rd) { return rd.r == r; });
```

### Set Algortihms

```cpp
Expand Down

0 comments on commit af05970

Please sign in to comment.