Boost logo

Boost :

Subject: Re: [boost] [optional] Safe optional
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2014-11-17 14:41:03

2014-11-17 18:01 GMT+01:00 Robert Ramey <ramey_at_[hidden]>:

> Andrzej Krzemienski wrote
> > My idea is to provide another type wrapper, say safe_optional
> > <T>
> > , that
> > would choose different tradeoffs: prefer "safety" to some flexibility
> > and/or efficiency. It would probably be part of Boost.Optional library as
> > the implementation can be reused - only the interface would be changed.
> >
> > One downside of this solution is that we would have two libraries for
> > doing
> > nearly the same thing, which could "scatter" the community. There is a
> > value for standardizing certain things and making them universal.
> Can't this concern be addressed by making this an addition to the optional
> library.
> So that safe_optional<T> would be an wrapper around optional<T> with
> extra error checking?

In fact, Boost.Optional already comes with two interfaces:
1. optional_base<T> (with minimum set of operations)
2. optional<T> that derives from the former.

Although the former one is not advertized in the documentation, the intent
was that it is used by people who are not happy with the latter interface,
so they can use it to build whatever interface they like. I was planning
to use optional_base as a base for the new interface. First, I want to see
peoples' reaction.


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