referring to enum values in a template
referring to enum values in a template
- Subject: referring to enum values in a template
- From: Nathan Roberts <email@hidden>
- Date: Fri, 27 Jan 2006 20:11:15 -0600
Hello all,
I'm converting a CodeWarrior project to XCode, and I'm down to two
lines that won't compile. The lines are template code, and they fail
during instantiation. In fact, the two lines look pretty much
equivalent, so I'll just include code for one.
Basically, I've got an enum that's defined in a template class. I'm
trying to refer to one of the values of the enum. In CW this
compiled just fine when I had just the name of the enum value
(eNotice); gcc wants me to be more specific (I used
TVectorMessage<T>::ECode::eNotice). This latter seems to pass the
syntax check, and to give an error during instantiation (T = STask),
saying that 'eNotice' is not a member of 'TVectorMessage<STask>::ECode'.
I don't know if code will be necessary or helpful -- this may just be
a syntax thing -- but I've included what I think are the relevant
snippets below.
Thanks for your help!
Nate
code snippets:
1. TVectorMessage<T>
template <class T> class TVectorMessage
{
public:
enum ECode { eInsert, eDelete, eChange, eNotice };
//...
}
2. TVectorMessageNotice<T>
template <class T> class TVectorMessageNotice : public
TVectorMessage<T>
{
//...
//gcc errors on this line: 'eNotice' is not a member of
'TVectorMessage<STask>::ECode'
TVectorMessageNotice( const index_type inBegin, const index_type
inEnd )
: TVectorMessage<T>
(TVectorMessage<T>::ECode::eNotice,inBegin,inEnd) {} //NVR 1/20/06
added "TVectorMessage<T>::ECode::"
};
3. Instantiation code:
~TBroadcasterVector ( void )
{
index_type e_index = super::size(); //NVR 1/20/06 added "super"
// inform listeners that all elements will be changed
BroadcastMessage(TVectorMessageNotice<T>(0,e_index)); //
instantiate TVectorMessageNotice<STask> on this line
//...
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden