Skip to the content.

🔗 Week 1: core guidelines

🔗 Pre-Class Learning Material

🔗 Conversation Starters/Discussion Questions

  1. Which is more intuitive or easier to pick up: patterns or antipatterns? is it important to be familiar with both?
  2. With so many guidelines/best practices, what are effective strategies to try to familiarize yourself with them? To what extent is it necessary to learn by doing?
  3. Are guidelines that aren’t concrete enough to be automatically refereed practical?
  4. To what extent should we/is it effective to argue “because the guidelines say so” about a coding decision (instead of a deeper reason)?
  5. What guidelines or terminology were most difficult to understand or most unfamiliar?
  6. Do you disagree with any of the guidelines mentioned?

🔗 Week 2: smart pointers

🔗 Pre-Class Learning Material

I would recommend watching both as they are related. Obviously, come with things you don’t fully understand or want more clarification on, but also it would be fun to discuss things y’all disagree with.

🔗 Week 3: STL algorithms

🔗 Pre-Class Learning Material

🔗 Conversation Starters/Discussion Questions

  1. Which of the algorithms did you learn about for the first time that you found useful/surprising?
  2. Can you bring a sample of your favorite STL algorithm usage, something you find either beautiful or really helpful?

🔗 Week 4: C++ Secrets

🔗 Pre-Class Learning Material

🔗 Conversation Starters/Discussion Questions

  1. Would you use any of these non-conforming secrets in your own code? If so, which ones?
  2. What do you think of the committee’s choices in choosing simplicity over flexibility/C compatibility in standardizing designated initializers? How does the wide presence of non-standard extensions in compilers affect the rationale behind this decision?

🔗 Week 5: Parallelism

🔗 Pre-Class Learning Material

If, after watching that, you think “my god how do I get in on these c++ 17 parallel algorithms”, have no fear…

🔗 Conversation Starters/Discussion Questions

  1. Why are parallel max, min, and inner product hard? Can they run with linear speedups in terms of cpus/gpus?
  2. How can we use caching and spacial locality to improve parallel algorithms?
  3. How important is legibility versus speed for industry code?
  4. How much should you optimize code for a certain platform, given that such optimizations would cause performance decreases on other platforms?

🔗 Week 6: Concepts

🔗 Pre-Class Learning Material

This is the video to watch. Explains what concepts are, why we want them, and how we’ll use them.

Less important (but nice nevertheless), which follows my initial thoughts on concepts. The Haskell typeclasses Grimm mentions are described at .

🔗 Week 7: Compiler Optimizations

🔗 Pre-Class Learning Material

The first video is a broad discussion of things the compiler tries to optimize automatically and ways to write code utilizing this.

The second gives specific examples of some compiler switches and what they do.

(Just the portion from 7:00 - 33:00. The rest of the video shows some interesting benchmarking examples, but isn’t necessary to get the general idea of the talk.)

Found the following in perusing through some compiler optimization settings, thought it might also be helpful. By godbolt no less.

🔗 Week 9: Design Patterns

🔗 Pre-Class Learning Material

I also highly recommend watching the Godbolt talk that Nitash sent on Friday since it will allow us to expand on our discussion, but it’s not required.

🔗 Conversation Starters/Discussion Questions

🔗 Week 10: Ranges

🔗 Pre-Class Learning Material

A more graphical look at the views available in C++20. Feel free to skip the first 20 minutes.

Treasure trove of range examples: range_by_example. (Thanks @wfpunch!)

Range exercises put together by @cgnitash.

🔗 Conversation Starters/Discussion Questions

  1. Can you think of an interesting application of composing views? Something with polynomials, prime numbers, images, or anything else?
  2. Have you ever used lazy evaluation? Do you know of any cases where lazy evaluation can significantly hurt performance? This is one of the first times I’ve seen lazy evaluation in C++; do you know of any other places (libraries or the language) where things are lazy?
  3. How do you feel about the function call syntax that was shown as an example in the second video? Does this style remind you of any other programming language? How would you like to program in a language where every function began with a return statement?
  4. Have you ever seen the type_name() function shown in the first video? For you template metaprogrammers, do you think it would be useful when debugging your template code?

🔗 Week 11: Template Metaprogramming

🔗 Pre-Class Learning Material

After watching waaay too many talks on template metaprogramming, I think this one is a good choice to start some good discussion:

Nitash has some good suggestions below. What I really came out of this understanding is just how hard modern C++ compilers have been working to simplify and eliminate the need for meta programming. One big help is fold expressions. Let’s also watch this short (<8 minute) summary of them:

optional extra material…

For those of you who want something more (NOT required!) here is Herb Sutter talking about how to replace template meta programming with more sensible alternatives:

A brief, example-driven primer on using SFINAE to test for the presence of a member function in a struct contributed by @cgnitash. (Find the example code all spliced together on Compiler Explorer here).

Also, reccomended by @cgnitash: CppCon 2014: Walter E. Brown “Modern Template Metaprogramming: A Compendium, Part I”.

🔗 In-Class Material

🔗 Week 12: Topic TBD

🔗 Pre-Class Learning Material

A good overview of C++ modules. It’s a bit on the long side, but covers a lot of ground and is the most clear and well organized out of the module talks I was able to find.

Extra if interested… Also a good talk, but more narrowly focused on building/compiling modules.

🔗 Conversation Starters/Discussion Questions

  1. benefits of modules
  2. problems with switching over to modules
  3. anything you didn’t understand about modules (in the video or otherwise)
  4. bigger picture impact
    • how does this change c++?
    • …how we write/think about c++?

🔗 Week 13: Move Semantics

🔗 Pre-Class Learning Material

  1. CppCon 2019: Klaus Iglberger “Back to Basics: Move Semantics (part 1 of 2)”
    • covers r- and l-value references, move constructor and assignment operator
  2. CppCon 2019: Klaus Iglberger “Back to Basics: Move Semantics (part 2 of 2)”
    • reccomended: first half hour (discusses forwarding references)
    • optional: second half hour, which has some tricky exercises
      • these might be fun to talk through in class (feel free to watch ahead of time!)

These talks were part of a “Back to Basics” series at CppCon 2019, many of which I have enjoyed. It’s worth searching CppCon 2019 Back to Basics up on YouTube and perusing them!

🔗 Conversation Starters/Discussion Questions

  1. What (????) does this code snippet even do? (I checked, it compiles.)
    std::string s{"hi"};
    s + s = s;
    
  2. What are the plusses and minuses of using
    ...
    , pi( std::move(w.pi) )
    { w.pi = nullptr }
    ...
    

    versus

    ... ,pi( std::exchange(w.pi, nullptr))
    
  3. Why is it important to make move constructors and move assignment operators noexcept?
  4. What is std::swap and how does it relate to moving?
  5. What is the point of a function with a const return object (e.g., const Widget getWidget();)? When (if ever) would this be useful?
  6. Do you have any obervations/comments or questions about the giant “Paramater Conventions” table at 53:43?

🔗 Week 14: Polymorphism & Object-Oriented Programming

🔗 Pre-Class Learning Material

  1. CppCon 2019: Jon Kalb “Back to Basics: Object-Oriented Programming”
    • start at 4:42, watch until 28:30
    • introduces object-oriented programming, discusses some design best practices
    • rest of the talk discusses implementation best practices (reccommended!)
  2. Better Code: Runtime Polymorphism - Sean Parent
    • start at 1:48, watch until 38:21
    • discusses a solution for runtime polymorphism without an inheritance-based API
    • middle part goes on a bit of a tangent about copy constructors and saving copies before presenting the complete solution, feel free to fast foward that part
    • rest of the talk adds real-world context and discusses some additional features made straightforward to implement by using the runtime-concept idiom (reccomended!)

🔗 Conversation Starters/Discussion Questions

  1. What are the best examples of object-oriented or runtime-polymorphic you’ve used, maintained, and/or implemented? What made them great to work with?
  2. What are the worst examples of object-oriented or runtime-polymorphic you’ve used, maintained, and/or implemented? What made them not so great to work with?
  3. How do C++’s polymorphism toolkit/idioms compare to approaches to polymorphism in other languages (Rust? Python? etc.)?
  4. From the Sean Parent YouTube comments… (WON YOO)

    I see global draw() function can be specifically defined with different types if I want to have a different behavior in the function other than a template function defines. Wouldn’t this pattern cause developers less convenient to find what methods can be overridden or not unlike the traditional polymorphism? For example, in traditional inheritance, if a method is virtual, I can know that can be overridden.

  5. Also from the Sean Parent YouTube comments… (Rob Inson)

    How is it different from the pimpl idiom? …

🔗 Week 15: Topic TBD

🔗 Pre-Class Learning Material

TODO

🔗 Conversation Starters/Discussion Questions

  1. TODO
  2. TODO
  3. TODO
  4. TODO
  5. TODO