Boost logo

Boost :

From: Richard Jennings (richard.jennings_at_[hidden])
Date: 2005-12-22 05:18:07

I'm getting a complaint of an ambiguity when I use BOOST_ENUM_VALUES with
std::size_t as the type.

BOOST_ENM_VALUES(MyTypeName, std::size_t,

The error is:
E2015 Ambiguity between 'boost::optional<unsigned int>::optional(int
boost::detail::none_helper::* const &)' and 'boost::optional<unsigned
int>::optional(const unsigned int &)'

Which is in the static method 'values' for the case where the index is
zero. The line is:
return optional_value(0);

This does not happen if I use 'int', but does also happen with 'unsigned
int'. A guess is that the compiler thinks that the zero might be null

A possible solution is to do a cast:
return optional_value(static_cast<value_type>(0));

This only happens for the zero value, other values are fine.

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