Re: enums that are really just sets of constants
- From: Jonathan Wakely <gtkmm kayari org>
- To: "Dr. Diether Knof" <dknof gmx de>
- Cc: gtkmm <gtkmm-list gnome org>
- Subject: Re: enums that are really just sets of constants
- Date: Sat, 22 Apr 2017 07:55:50 +0100
On 22 April 2017 at 05:57, Dr. Diether Knof wrote:
Hello,
for the integer wraps used for flags I have a third proposition, a working example is attached:
* "enum class DisplayOption" for the individual flags
* "class DisplayOptions" with an implicit converter DisplayOption -> DisplayOptions
So we get an enum for the single options and avoid the old enum-style.
Why not have the constants declared inside the class, so you only have
one name to remember, not DisplayOption and DisplayOptions?
You can overload operator| and operator& for enums, so the only
benefit to this seems to be the implicit conversion to bool (why not
explciit?)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]