|
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.
eg:
BOOST_ENM_VALUES(MyTypeName, std::size_t,
(fred)(0)
(jane)(1)
)
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
pointer?
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 acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk