Thread: Ancient enum?

  1. #1
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472

    Ancient enum?

    In a recent post the use of enum was described as 'archaic' why would that be? Surely its a convenient way of listing a group of constants?

  2. #2
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by rogster001 View Post
    In a recent post the use of enum was described as 'archaic' why would that be? Surely its a convenient way of listing a group of constants?
    It could have been me, stating that static consts are preferable for the purposes of template metaprogramming.

    Everywhere except that context, there's nothing archaic about enum.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  3. #3
    The larch
    Join Date
    May 2006
    Posts
    3,573
    Perhaps it was about template metaprogramming:

    Code:
    template <int N>
    struct Archaic
    {
         enum { value = N };
    };
    
    template <int N>
    struct Modern
    {
         static const int value = N;
    };
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. enum [tag] [: type] Is this non-standard?
    By HyperShadow in forum C++ Programming
    Replies: 2
    Last Post: 12-09-2007, 10:29 PM
  2. enum switchcase and windows message q
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 11-27-2006, 01:16 PM
  3. Conflicting enum issue
    By 7force in forum C Programming
    Replies: 1
    Last Post: 07-05-2006, 03:51 AM
  4. Switch case and enum help
    By SomeCrazyGuy in forum C++ Programming
    Replies: 9
    Last Post: 04-21-2005, 08:53 PM
  5. enum
    By JerryL in forum C++ Programming
    Replies: 5
    Last Post: 02-25-2004, 05:45 PM