Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2008-07-10 11:26:19


Felipe Magno de Almeida wrote:
> On Thu, Jul 10, 2008 at 6:22 AM, Maciej Sobczak <prog_at_[hidden]> wrote:
>> Thorsten Ottosen wrote:
>
> [snip]
>
>> BTW - what about optional<bool>?
>>
>> optional<bool> optional_switch = ...
>>
>> if (optional_switch)
>> {
>> // the switch can be "false" here!
>> }
>
> But you use a dereference operator to access the value.
> Do you find confusing to use a pointer to a bool too?
> It seems natural to use the unspecified-bool-type idiom
> to me. But this is only personal taste IMHO.

Note that C++0x has explicit conversion operators, so the
unspecified-bool-type idiom will be going away as compilers add this
C++0x feature.

--Beman


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