How Invariant are Invariants?
David Olsen
Class invariants are a vital tool when writing robust code. Classes are easier to use and easier to maintain if you know that some conditions are always true. But C++ makes it impossible to maintain invariants in all cases. We will look at a simple class with a seemingly simple invariant. Then we'll discover why that class is impossible to implement correctly and explore techniques for dealing with the situation. You will come away with new insights on class invariants and guidelines for writing and using classes in robust code.
David Olsen
David Olsen has three decades of software development experience in a variety of programming languages and development environments. For the last decade he has been the lead engineer for the NVIDIA HPC C++ compiler, focusing on running standard parallel algorithms on GPUs.