Difference between revisions of "Intermediate C++ Game Programming Tutorial 16"
From Chilipedia
(→Video Timestamp Index) |
(→Video Timestamp Index) |
||
Line 14: | Line 14: | ||
* The role of Templates and Iterators to make Algorithms independent of Data Types and Containers (chart) [https://youtu.be/3J1Pz30IE4Q?t=17s 0:17] | * The role of Templates and Iterators to make Algorithms independent of Data Types and Containers (chart) [https://youtu.be/3J1Pz30IE4Q?t=17s 0:17] | ||
* <code>std::sort</code> algorithm [https://youtu.be/3J1Pz30IE4Q?t=43s 0:43] | * <code>std::sort</code> algorithm [https://youtu.be/3J1Pz30IE4Q?t=43s 0:43] | ||
+ | * [WORK-IN-PROGRESS] | ||
== Homework == | == Homework == |
Revision as of 19:54, 28 September 2019
In the video we take a look at a couple of bangers from <algorithm>
, and we learn what lambda functions are and how to use them.
Contents
[hide]Topics Covered
- Algorithms
std::sort
andstd::remove_if
- Concepts (as in, type concepts like Comparable)
-
<functional>
functors as predicates - Lambda functions
Errata
In the video Chili states that std::remove does not preserve the relative order of elements in the container, but this is fake news! Relative order is preserved: [1]
Video Timestamp Index
- The role of Templates and Iterators to make Algorithms independent of Data Types and Containers (chart) 0:17
-
std::sort
algorithm 0:43 - [WORK-IN-PROGRESS]
Homework
Solve the problems in Source.cpp attached below using the <algorithm> library and other parts of the standard library as extensively as possible. As a bonus problem, implement the sprite drawing effect shown at the end of the video using a lambda function.
Related Series
For an in-depth look into the <algorithm> library and beyond, check out STD Gems.