Click here to Skip to main content
15,902,635 members

Comments by rrrado (Top 3 by date)

rrrado 11-Jul-10 6:44am View    
Well I'm afraid I'll have to declare enum outside, thank you.
rrrado 10-Jul-10 8:07am View    
The problem is that I need that enum type as type of parameter of some methods, for exaple
int base<derived>::GetColumnPos(derived::CENUM e)
rrrado 10-Jul-10 7:51am View    
Well I know my code does not look standard, but AFAIK using class being declared as parameter of parent template is widely used in WTL and other libraries. As sauro wrote static_cast<derived*>(this)->identifier(); works, then why not type declarations?

I have various types of grid controls in application, each grid has it's own class and columns declared in enumeration. I want to keep enum inside class, because it is used only by that class and to avoid many enums at global level. There is lot of code (more methods) which is similar to each grid so I want to use templates to define it. One of such generic method is for example int GetColumnPos(T::enumColumn col) which accepts column identification. Yes it could be declared as int, but type checking would be weak and it would not be so nice and self-explaining.