Classic interfaces that use bitmask to select many properties at once can be hard to use and very easy to break.
by Krzysztof Ostrowski
From the article:
Suppose we have an interface that returns some value depending on combination of other values, and we would like get resource of some type
Rthat is common for Alice and Bob. Here is our interface:R query(std::uint32_t bitmask);
First question arises quickly: what to put into
bitmask? There are plenty of values of type
Multiple possible ways to fix our interface and make it much easier to use exist. We will consider three of them.