By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,851 Members | 2,097 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,851 IT Pros & Developers. It's quick & easy.

C++ Enumeration Class

P: 3
Yesterday I was in need for a more advanced form of enumeration in C++, something similar to Java Enumeration classes. But C++ only supports the basic C enum.

This can be fine for many things, but I am looking for a more sophisticated solution like the one in the Dr. Dobb's portal 2003 article "When enum Just Isn't Enough: Enumeration Classes for C++" at It seems the link is wrong: the code is in a zip file at (and then in

I must say that I am fairly new in template programming but i get the basic idea of Yves Meynard's Enum templates.

I am on windows using MinGW (GCC 3.4.2) and the code simply will not compile. I am getting some compiler errors:

line 47 Enum.h type `std::set<const Enum<T>*, Enum<T>::Enum_Ptr_Less, std::allocator<const Enum<T>*> >' is not derived from type `Enum<T>'

line 47 Enum.h ISO C++ forbids declaration of `size_type' with no type


I was wondering if anybody could give some advise on the code in the article - whether or not it will compile ever with gcc 3.4.2 in MinGW? What changes could I do such that it would work?

Thanks, kofler
Mar 20 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.