Difference between revisions of "Intermediate C++ Game Programming Tutorial 16"

From Chilipedia
Jump to: navigation, search
Line 6: Line 6:
 
* <code><functional></code> functors as predicates
 
* <code><functional></code> functors as predicates
 
* Lambda functions
 
* Lambda functions
 +
 +
== <span style="color:green">Errata</span> ==
 +
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: [https://en.cppreference.com/w/cpp/algorithm/remove]
  
 
== Video Timestamp Index ==
 
== Video Timestamp Index ==

Revision as of 12:07, 10 May 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.

Topics Covered

  • Algorithms std::sort and std::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

Tutorial 16

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.

Links

Algorithms Library

See also