LPCSTR-based enum -- possible?

Discussion in 'C++' started by vb739, Apr 12, 2007.

  1. vb739

    vb739 Guest

    Can something like this be done:

    enum ABC
    {
    A = "A",
    B = "B",
    C = "C"
    };

    , that is can a const string address be used as an enum value?

    Thanks,
    V.
     
    vb739, Apr 12, 2007
    #1
    1. Advertising

  2. vb739

    Greg Comeau Guest

    In article <>,
    vb739 <> wrote:
    >Can something like this be done:
    >
    >enum ABC
    >{
    > A = "A",
    > B = "B",
    > C = "C"
    >};
    >
    >, that is can a const string address be used as an enum value?


    No. But you'll probably want to have a look here:

    http://www.comeaucomputing.com/techtalk/#enumtostring

    Sit down first.
    --
    Greg Comeau / 4.3.9 with C++0xisms now in beta!
    Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout
    World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
    Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
     
    Greg Comeau, Apr 12, 2007
    #2
    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:
    549
  2. Jerminia
    Replies:
    3
    Views:
    633
    Roedy Green
    Oct 7, 2005
  3. Ernst Murnleitner

    How to enum an enum?

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

Share This Page