
10 Jul
2008
10 Jul
'08
3:26 p.m.
Felipe Magno de Almeida wrote:
On Thu, Jul 10, 2008 at 6:22 AM, Maciej Sobczak <prog@msobczak.com> 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