This page is out of date

Boost Value Wrappers

There are at least two boost libraries (value_initialized and optional) that are value wrappers - they intend to model the semantics of their template parameter, with a few additions. It might be valuable to refactor these interfaces so the code common to the concept of value wrapping is factored out. This would allow us to address many issues in one place: cv-qualifier semantics, access via the -> operator, reference semantics, and compiler non-conformance issues.

Perhaps a logical place to start would be the optional header - one could factor out all the semantics that aren't generally applicable to value wrappers, in order to place this in a base class that optional could derive from. Due to historical reasons, that is not the angle which I have approached this with. The prototype here is very simple, leaving out many subtleties that optional takes into account.

Value wrapper.

I came to work on this via my difficulty with 3.6.2, paragraph 3. See also this GCC bug report and the explanation in the file.

There is also a brief test of some of the conversion and const semantics. I have found this to not compile with EDG based compilers, or with GCC without the pedantic flag (see this GCC bug report.) [an error occurred while processing this directive]