Registration is now open for CppCon 2021, which starts on October 24 and will be held both in person and online. To whet your appetite for this year’s conference, we’re posting videos of some of the top-rated talks from our most recent in-person conference in 2019 and our online conference in 2020. Here’s another CppCon talk video we hope you will enjoy – and why not register today for CppCon 2021 to attend in person, online, or both!
by Ben Deane
Summary of the talk:
"You have all these algorithms at your disposal. *Learn them.*"
-- Sean Parent, GoingNative 2013.
Great advice, and the algorithms can do a lot. But they can't do everything, and the fixed set in the standard was never meant to be the last word in every problem. Sometimes we do need to write our own solutions. What are the best practices for that?
This talk examines how to build our own algorithms. We'll start with a raw loop that solves a nontrivial problem, and turn it into a generic algorithm capable of supporting a wide variety of use cases without loss of expressivity or efficiency.
Along the way we'll consider algorithmic patterns, how to structure the
interface, how the types interact, iterator category concerns, testing, and
more. We'll look at how ranges and concepts help us to refine and focus things.
We'll also see where the existing algorithms fall short, and take a look at some non-obvious use cases, including some minor modifications or wrappings that give us extra flexibility.