Boost logo

Boost :

From: William E. Kempf (wekempf_at_[hidden])
Date: 2002-12-12 15:31:54


Fernando Cacciola said:
> From: "Peter Dimov" <pdimov_at_[hidden]>
>> From: "Fernando Cacciola" <fernando_cacciola_at_[hidden]>
>> > From: "Peter Dimov" <pdimov_at_[hidden]>
>> > optional<> is not intended to replace _all_ situations were optional
>> values
>> > are used.
>> > It is itended to be used on those situations were pointers are
>> difficult
>> to
>> > use;
>> > but I expect programmers to keep using pointers were appropriate.
>> For example, as I said before, optional arguments to a function
>> should
> not
>> > be coded
>> > with optional<> but with conventional pointers.
>>
>> Actually (just a minor observation)
>>
>> void f(optional<T> /*const &*/ opt);
>>
>> is different than
>>
>> void f(T const * pt);
>>
>> as the latter might potentially store 'pt' while the former cannot.
>>
> ? You mean that the code inside f() could hold onto 'pt'?
> Well, yes it can... but that would be nasty.
> It is supposed to know that ownership is not being handed in.
> The use of a pointer is reserved to convey optionality.

It is? Then how do you ever transfer ownership ;).

William E. Kempf


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk