Boost logo

Boost :

Subject: Re: [boost] [core] Breaking bugfix in scoped enums
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2014-06-07 05:02:12


Le 07/06/14 01:30, Peter Dimov a écrit :
> Vicente J. Botet Escriba wrote:
>
>> operator enum_type() const BOOST_NOEXCEPT { return
>> get_native_value_(); }
>>
>> I was expecting two implicit conversions: one from EnumType to
>> enum_type and the other from enum_type to int. Am I missing something
>> in C++98?
>
> If enum_type is an enum type, its conversion to int is not
> user-defined and doesn't count.
>
>
Thanks Peter I don't know to what I was thinking :(
An enum (scoped or not) is always implicitly convertible to its
underlying type.

Andrey, why this implicit conversion must be removed? What is wrong with it?

- operator enum_type() const BOOST_NOEXCEPT { return get_native_value_(); }

I have added the line you removed and all the test pass. Which case need
to remove this implicit conversion?

Best,
Vicente


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