Back
Close

Mission Impossible / How to create datatypes which cannot contain invalid state

adrianimboden
22.5K views
Next: Enums - Overview

Create datatypes which do not allow invalid state

Many user defined datatypes created in "classical" C++ allow many states which should not happen in production.

This playground has the goal to show some of them and how to avoid them using C++14/17 standard library type additions.

The build environment is:

  • Clang 7.0.1
  • -std=c++17
  • -Wall -Werror
  • Libraries: Boost 1.68

Disclaimer

This playground was written for a C++ Usergroup session (https://cpp-ug-luzern.blogspot.com/). It may not yet be ready to use without further context.

Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io