Sujet : Re: enum sets
De : thiago.adams (at) *nospam* gmail.com (Thiago Adams)
Groupes : comp.lang.cDate : 29. Aug 2024, 12:38:56
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vapmkg$3ullf$4@dont-email.me>
References : 1 2
User-Agent : Mozilla Thunderbird
On 29/08/2024 05:30, Bonita Montero wrote:
Am 29.08.2024 um 01:42 schrieb Thiago Adams:
I am wondering how useful would be to have enum sets.
>
Let´s say you have a function that accepts only monospaced fonts.Then you can use enum monospaced_font_type. Or a switch case where you need to check all and only monospaced_font_type.
>
But at same type you can store at same object monospaced_font_type or font_type.
>
enum font_type
{
enum monospaced_font_type
{
CASCADIA_FONT,
},
ARIAL_FONT
};
>
This could be arranged in any way.
>
>
Use C++:
struct font_type
{
struct monospaced_font_type
{
static constexpr int CASCADIA_FONT = 123;
};
static constexpr int ARIAL_FONT = 456;
};
It would not help the switch case warnings.