Click for commercial
Scott Meyers Training Courses
Each of the following presentations is lecture-only (no hands-on programming) and is compiler- and platform-independent. Listed lengths are approximate.
Note that material from any of Scott's longer courses (i.e., one or more days) can also be extracted and presented as a short course.
- CPU Caches and Why You Care
No matter what programming language or technology you use, if your software fails to make effective use of the underlying CPU caches, your system's performance will suffer. A lot. This session provides a wide-ranging overview of CPU caches, how they operate, and how that affects high-level decisions on things like data structures and traversal strategies. Both single- and multi-threaded execution are considered. Specific topics include different cache types (data, instruction, TLB); private and shared caches; cache lines and speculative prefetching; false sharing; and cache-friendly program organization, data structures, and traversal strategies. If you care at all about performance, the information in this talk is essential. Length: 1.5 hours.
- Move Semantics, Rvalue References, and Perfect
Forwarding in C++11
Probably the most pervasive new feature in C++11 is move semantics, which allows compilers to replace expensive copy operations with inexpensive move operations. This talk explains the motivation for move semantics, the conditions under which compilers can replaces copies with moves, and how programmers can control the process. It also describes rvalue references, the new language feature on which move semantics is based, as well as perfect forwarding, another technology based on rvalue references that enables move semantics to be more widely applied than would otherwise be possible. Length: 1.5-3.0 hours, depending on the depth of the treatment.
- Adventures in Perfect Forwarding in C++11
The thing about perfect forwarding (introduced in the short course on move semantics and rvalue references) is that there's both less and more to it than the name suggests. Perfect forwarding isn't perfect, for example: there are types that cannot be perfect-forwarded. Such imperfections have implications for both those who specify interfaces as well as those who use them. Perfect forwarding is implemented via function templates with parameters declared to be of type
T&&. Such parameters are treated specially during type deduction, which is fine, unless you want to specialize the templates. The only parameter type that gets the special treatment is
T&&, so you can't overload on something like
T*&&to "partially specialize" for pointer types. Achieving the effect of such specialization calls for more sophisticated techniques. Perfect forwarding complicates use of the pImpl idiom, because the template instantiation mechanism typically wants all the template code in the header file, yet the use of pImpl is motivated by the desire to avoid having to do that. This talk begins with a very brief review of perfect forwarding, then proceeds to an examination of the practical issues such as those above that arise when you try to put perfect forwarding into day-to-day use. Length: 2.0 hours.
- C++ Under the Hood
An examination of how the fundamental language features are implemented. A primary goal is to demonstrate that programmers pay no penalties for using C++ instead of C, that they actually gain flexibility, maintainability, and greater potential for reuse through the language's support for abstraction, encapsulation, and inheritance. Specific language features to be discussed include classes, member functions, virtual functions and virtual calls, new and delete, inlines, and inheritance. Attendees are encouraged to bring questions about the costs or likely implementation strategies for any feature in the language. If desired, this seminar can also cover information on how to control code bloat when using templates. Length: 1.5 hours without coverage of templates and code bloat; 2.0 hours with such coverage.
- When C++ Hits the Hardware
This class addresses two issues of particular interest to developers of embedded systems, but the material should be of interest to everybody working with C++. First, it examines the parts of programs that don't change during execution, i.e., the parts that could be burned into ROM. Second, it describes an elegant approach to modeling memory-mapped IO that provides a natural interface for users, great flexibility for implementers, maximal efficiency (in both size and space), and compile-time prevention of common client errors. The technique is based on a combination of templates, classes, inline functions, placement and custom new (without requiring dynamic memory allocation), references, bit operations, volatile memory, private member functions, and reinterpret_casts, but the generated code should be as good as that produced by the most hardcore hardware hacker. Length: 1.5 hours.
- Using the STL Efficiently
The STL is easy to use, but, unfortunately, it's also easy to use inefficiently. This seminar, based on material in Scott's book, Effective STL, describes proven ways to make more efficient use of STL components. Topics covered include the importance and behavior of remove; why range member functions are preferable to iterative use of their single-element counterparts; how to efficiently erase elements from containers under a variety of conditions; the importance of using reserve for vectors and strings and how "the swap trick" can be used to eliminate excess capacity that can result; why and how to prefer sorted vectors over sets, multisets, maps, and multimaps; an overview of the nonstandard hashed containers, including those in TR1; how to choose among sorting and partitioning algorithms; why to prefer member functions over algorithms with the same names; and why to prefer function objects over function pointers as algorithm parameters. Length: 3.0 hours.
For additional information on any of these courses, or to discuss the creation of new courses to meet your specific needs, contact Scott directly.