We will analyse such code
std::vector vec{1, 2, 3, 4, 5};
for (auto it = vec.begin(); it != vec.end(); ++it) {
std::cout << *it << ' ';
}
auto last = std::prev(vec.end());
for (auto it = last; it != std::prev(vec.begin()); --it) {
std::cout << *it << ' ';
}
auto third = std::begin(vec) + 2;
std::cout << vec[3] << ' ' << *third;
std::vector a{0, 1, 2, 3, 4};
std::vector b{5, 4, 2, 3, 1};
int r1 = std::inner_product(a.begin(), a.end(), b.begin(), 0);
// 0 x 5 + 1 x 4 + 2 x 2 + 3 x 3 + 4 x 1
// r1 = 21
int r2 = std::inner_product(a.begin(), a.end(), b.begin(), 0,
std::plus<>(), std::equal_to<>());
// (0 == 5) + (1 == 4) + (2 == 2) + (3 == 3) + (4 == 1)
// r2 = 2
int r3 = std::transform_reduce(a.begin(), a.end(), b.begin(), 0);
int r4 = std::transform_reduce(a.begin(), a.end(), b.begin(), 0,
std::plus<>(), std::equal_to<>());
Your abilities after STL Algorithms in C++ 17 training
- can use C++ documentation effectively
- know and choose proper algorithm depending on application
- apply algorithms instead of raw loops
Agenda
- iterators
- algorithms - overview
- cryptographic application impl. - group activity
- recap
Activities
- pre-work to be done before our training
- pre-test pre-test at the beginning
- exercises followed by trainers implementation
- coding dojo
- participants solutions code review
- post-work with code review
- post-test one week after the training
- certificate of completion
Duration
- 1 day (6 hours with breaks)
Form
- online
- classroom