Boost logo

Boost :

Subject: Re: [boost] [optional] memory use for optional refs and ptrs
From: Jeffrey Lee Hellrung, Jr. (jhellrung_at_[hidden])
Date: 2010-10-05 15:13:30

On 10/5/2010 11:27 AM, Christian Holmquist wrote:
> On 5 October 2010 12:55, Fernando Cacciola<fernando.cacciola_at_[hidden]>wrote:
>> On 05/10/2010 01:09 p.m., Jeffrey Lee Hellrung, Jr. wrote:
>>> What about "null references"?
>>> What about it?
> It's convenient to pass optional values as pointers, even though one would
> much prefer passing them as optional references.
> void foo(Data* output) // no way to tell if implementation supports the
> output to be null
> void foo(optional<Data&> output) // clearly the intention is that the output
> is optional, and that the implementation is responsible for checking if
> output is assigned by caller or not
> optional<T&> could unless I'm mistaken remove the member boolean, since
> there is no such thing as a null reference.

That about it.

- Jeff

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