Boost logo

Boost :

Subject: [boost] markable -- informal review request
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2016-09-16 09:23:14

Hi Everyone, I would like to ask your opinion, suggestions, and perhaps an
informal review of the 'markable' library. An alternative to
boost::optional when performance really matters. It is the second
incarnation of the 'compact_optional' library that I have presented last

The main differences from the previous version:
* name change: it is called 'markable' so that it is not confused with
'optional'. It uses "mark values" and mark policies"
* it has the ability to mark an empty state even for the types with strong
invariants, by marking a bit pattern rather than any proper value of T (an
idea by Matt Calabrese)

An example use case:

typedef markable<mark_int<int, -1>> opt_int;

opt_int oi;
opt_int o2 (2);
assert (!oi.has_value());assert (o2.has_value());assert (o2.value() == 2);
static_assert (sizeof(opt_int) == sizeof(int), "");

The github repository:
And documentation therein:

Any comments, suggestions or critique are most welcome.


Boost list run by bdawes at, gregod at, cpdaniel at, john at