15,666,883 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View Python questions
View Javascript questions
View C++ questions
View Java questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
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.