You could also use a null pointer to A to represent the null state, but
that would require the systematic use of pointers instead of instances
of A, i.e., dynamic allocation, which is better avoided when possible.
Instead, what you show above burries the null state inside the class,
which is not a bad idea.
Anyway, your example is way too abstract, especially because of the
default constructor, which is very unlikely for a class holding
meaningful "state". It may also be the case that a special pattern of
values adequately represents the null state, in which case you do not
need anything else. If you really need a special constructor, you can
use whatever type lets it be different from the others, and in this case
I would not choose nullptr_t, but rather define a specific, class-local,
enum/struct/class, used only for that particular ctor.
But this was all before std::optional. You may not like it, but this is
exactly what std::optional is for. Here is an SO discussion of its use:
http://stackoverflow.com/questions/16860960/how-should-one-use-stdoptional
I can't see why one should avoid it, except maybe when the storage
requirements are large enough and null values frequent enough to make a
difference. But then std::optional of a pointer is still a good idea.
-- Alain.