Boost logo

Boost :

From: Richard Jennings (richard.jennings_at_[hidden])
Date: 2005-12-20 12:08:17


I'm just trying out enum rev4.3 with Borland 5.6.4 and it fails to compile.

This is because of the 'not-found clause' in the parse method. Eg. for
the example

BOOST_ENUM(boolean,
        (False)
        (True)
)

that generates:
...
typedef boost::optional<boolean> optional;
static optional parse(const char* str)
{
   if(strcmp(str, "False") == 0) return optional(False);
   if(strcmp(str, "True") == 0) return optional(True);
   return false;
}
...
[taken from test/enum.cpp]
my compiler complains that it can't convert 'bool' to
'boost::optional<boolean>' on the last return statement, and I would tend
to agree with it!

If I change the return to be:

return optional();

Then it compiles.

Is there a particular reason why this compiler complains about the
conversion whereas the others are fine with it? Would you consider making
this change to support this compiler?

Richard
 


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