Skip to content

Latest commit

 

History

History
40 lines (32 loc) · 3.12 KB

File metadata and controls

40 lines (32 loc) · 3.12 KB

How not to Write Yourself to Death with C++

C++ is a very practical programming language. It has plenty of features to prevent all kinds of errors on syntactic level, is so fast that it rarely needs to be optimised... but it's said that too much code is needed to accomplish trivial tasks.

That's usually a consequence of overly low-level library interfaces, often designed with C compatibility and maximum performance in mind. However, a clean interface that needs minimal amount of code for typical usage is often more important. Designing such interfaces tends to be more difficult because they often can't be clean if they follow the low level behaviour. It requires much more skill than implementing the actual functionality.

Proper use of various features other languages were designed not to have allows creating classes that can be used with even less code than the same in high-level interpreted languages.

This is a series of lessons about various less known features of C++ that can be used to greatly reduce the amount of code needed to solve a task. The lessons are in markdown, designed to be converted to slides using Marp.

Coverage

Stuff that will be explained:

  • How to achieve the same functionality with less code
  • How to take your time to accelerate a lot of future development
    • Less code in the future
    • Less future errors to deal with
  • A lot of C++ tricks to achieve unusual functionality

Stuff that is not the goal:

  • Advanced algorithms
  • Optimising code for speed
  • Code style

Requirements

  • Experience with programming
  • Knowledge of C++ sufficient to write common stuff without checking solutions online
  • Understanding of object oriented design

Being able to read C++ code and having used some other object-oriented programming language is not enough.

Outline

  1. Introduction
  2. Object model in C++
  3. Nontrivial operator usage
  4. Generic functions and SFINAE
  5. Clean interface
  6. Generic classes
  7. Memory manipulation
  8. Runtime metaprogramming
  9. Template metaprogramming
  10. Putting it all together