Usage of NamedType and type_safe implementations

Viewed 15

Recently, there was a talk in my team to use strong types. After a bit of reading different blogs, I am inclined towards avoiding Primitive Obsession and have found below 2 implementations.

NamedType by Jonathan Boccara - https://github.com/joboccara/NamedType and type_safe by Jonathan Müller - https://github.com/foonathan/type_safe (Coincidentally both being Jonathans).

Since in our codebase, we use something like below, it is easier to adopt using NamedType.

typedef std::uint16_t UNS16;
typedef std::uint32_t UNS32;

Has anyone adapted their codebases to use either of the above implementations?

0 Answers
Related