Re: enum count

Discussion in 'C++' started by Clive, Jul 26, 2003.

  1. Clive

    Clive Guest

    > > If you have an enum, is there any way during execution to find the
    number
    > of
    > > values in the enum?

    >
    > No.


    yeah, i didnt think there was.

    > From that you can do int(fifteen)+1, but this is a very special case.
    > As soon as 'great' is changed to
    >
    > enum great { five = 5, ten = 10, fifteen = 15 };


    that is a very good way to get around the problem!

    > 'great' has to be around. Just open the definition and count.


    At the moment, the definition is changing as i go along programming, adding
    in new cases as i go along.

    i cant be bothered thinking up all the possible cases that i might need,
    because i just know later down the track i'll think of a new one. So that
    method of adding an extra one at the end seems like the solution i am
    looking for.

    Thankyou for the information.
    Clive, Jul 26, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. -

    enum within an enum

    -, Jun 12, 2005, in forum: Java
    Replies:
    6
    Views:
    522
  2. Jerminia
    Replies:
    3
    Views:
    611
    Roedy Green
    Oct 7, 2005
  3. Ernst Murnleitner

    How to enum an enum?

    Ernst Murnleitner, Nov 12, 2003, in forum: C++
    Replies:
    5
    Views:
    440
    Rolf Magnus
    Nov 13, 2003
  4. mrhicks
    Replies:
    2
    Views:
    400
    Dave Thompson
    Jun 10, 2004
  5. Randy
    Replies:
    1
    Views:
    507
    David Harmon
    Jan 7, 2006
Loading...

Share This Page