Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #13699

Re: one enum is a subset of another

From Thomas Boell <tboell@domain.invalid>
Newsgroups comp.lang.c++
Subject Re: one enum is a subset of another
Date 2012-02-02 02:38 +0100
Organization albasani.net
Message-ID <20120202023846.274d007a@arcadia> (permalink)
References <7aac0ea8-61ab-481e-80a6-c9ab215b009e@gi10g2000vbb.googlegroups.com> <20120201140814.3c116fb2@arcadia> <jgciba$f4c$1@portraits.wsisiz.edu.pl>

Show all headers | View raw


On Thu, 02 Feb 2012 00:37:15 +0100
"Matt D." <nospam@invalid.local> wrote:

> On 2/1/2012 14:08, Thomas Boell wrote:
> > You could do something like this:
> >
> > #define FRUIT_VALUES	\
> >      APPLE,	\
> >      BANANA,	\
> >      ORANGE
> >
> > enum Fruit
> > {
> > 	FRUIT_VALUES
> > };
> >
> > enum Things
> > {
> > 	FRUIT_VALUES,
> > 	BEERCAN, CAR, ALOT
> > };
> >
> > Whether using the preprocessor like this is "good style" depends on
> > your point of view.
> 
> It's seems very much like inheritance, so it made me think that perhaps 
> using something along the following could be of use: 
> http://www.codeproject.com/Articles/16150/Inheriting-a-C-enum-type

He forgot to start the NewFruits enum values after the end of Fruit, so
he will not be able to distinguish Apples from Oranges.

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

one enum is a subset of another Christopher <cpisz@austin.rr.com> - 2012-01-31 14:56 -0800
  Re: one enum is a subset of another Paul N <gw7rib@aol.com> - 2012-01-31 15:19 -0800
    Re: one enum is a subset of another Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-01-31 23:56 +0000
  Re: one enum is a subset of another Marcel Müller <news.5.maazl@spamgourmet.com> - 2012-02-01 09:51 +0100
    Re: one enum is a subset of another Larry Evans <cppljevans@suddenlink.net> - 2012-02-01 11:46 -0600
      Re: one enum is a subset of another Marcel Müller <news.5.maazl@spamgourmet.com> - 2012-02-01 21:14 +0100
  Re: one enum is a subset of another Thomas Boell <tboell@domain.invalid> - 2012-02-01 14:08 +0100
    Re: one enum is a subset of another Tobias Müller <troplin@bluewin.ch> - 2012-02-01 21:34 +0000
    Re: one enum is a subset of another "Matt D." <nospam@invalid.local> - 2012-02-02 00:37 +0100
      Re: one enum is a subset of another Thomas Boell <tboell@domain.invalid> - 2012-02-02 02:38 +0100
  Re: one enum is a subset of another Larry Evans <cppljevans@suddenlink.net> - 2012-02-01 12:28 -0600

csiph-web