473,320 Members | 1,802 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

C++ Enumeration Class

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 http://www.ddj.com/dept/cpp/184403955. It seems the link is wrong: the code is in a zip file at ftp://ftp.cuj.com/pub/2003/cujmay2003.zip (and then in meynard.zip).

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
0 1366

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

Similar topics

1
by: Sergey Poberezovskiy | last post by:
Hi, I have a simple enumeration in my schema: <xs:element name="el_1"> <xs:simpleType> <xs:restiction base="xs:string"> <xs:enumeration value="value and space 1"/> <xs:enumeration...
2
by: Barguast | last post by:
This is a trivial problem, but I'm just looking for a nice way to do it, that's all :) I've got an enumeration which enumerates a number of different text encodings, for example: public enum...
4
by: Marshal | last post by:
Sure... IEnumerable was inconvenient suggesting a separate class to service the enumeration, IEnumerator, and multiple operations: Current, MoveNext, Reset. (I'll warp the definition of "operation"...
3
by: Sampson | last post by:
I have a question about enumeration and how to populate them during runtime. I am using vb.net but will happily take any advice in c# as well. Here is an example to help illustrate what I am...
7
by: Don | last post by:
I need to get the type of an enumeration from an instance of a class. e.g. Public Class MyClass Public Enum MyEnum value1 = 1 End Enum End Class
27
by: Ben Finney | last post by:
Antoon Pardon wrote: > I just downloaded your enum module for python > and played a bit with it. IMO some of the behaviour makes it less > usefull. Feedback is appreciated. I'm hoping to...
7
by: Nathan | last post by:
I'd like to use an enumeration as a datasource for a drop-down box. Is there a way to do this?
0
by: John Saunders | last post by:
Given a schema as follows: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">...
2
by: Charlie | last post by:
Hi: How would I bind a list to an enumeration so that enumeration value becomes list values and enumeration constants becomes list text? Do you loop through enum and add manually or is there a...
3
by: scotchfx | last post by:
Is there any way of declaring an enumeration in a base class in such a way that it can be "overridden" in a derived class... for instance: class Base{ public: enum Enum { //empty }; } ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.