template<class E> class CFreeList template<class E> class CFreeListChunk template<class T> class CLinkedList In the CFreeList class I have a member : CLinkedList<CFreeListChunk<E>> m_oChunkList;
🔒 Locked
Template classes
Advertisement
Original Post
Hi!
I've written a template class for linked lists.
But Now I want to create a new template class that uses
the linked list class, but it doesn't work
These are my tree classes :
But i get this error
cfreelist.h(55) : error C2146: syntax error : missing ',' before identifier 'm_oChunkList'
Hmm.. havn't got a clue...
plz help!
/lazy
[edited by - lazy303 on December 19, 2002 3:27:18 PM]
quote:
Original post by Lazy303
The forum removes some of my text!
I repeat: Put your code in source boxes. You do so by using the forum tags (in square brackets) [ source ] and [ /source ] (though without the spaces in the tags, which I insert only to prevent them from turning up as a source box instead of text).
I also suggest you glance at the forum FAQ''s ...
shouldn''t that be:
you have to leave a space between the angled brackets or the compiler thinks you''re using the >> operator.
ai-junkie.com
CLinkedList<CFreeListChunk<E> > m_oChunkList;
you have to leave a space between the angled brackets or the compiler thinks you''re using the >> operator.
ai-junkie.com
yep... you''re right ... vc++ can''t handle that... (and I think Lazy303 uses vc++ because of the error message...)
quote:
Original post by BitMaster
I think some C++ compilers have problems with using a double ">" for templates. Try to insert a space between them, otherwise they might be confused with the shift operator.
quote:
Original post by Miserable
I repeat: Put your code in source boxes. You do so by using the forum tags (in square brackets) [ source ] and [ /source ] (though without the spaces in the tags, which I insert only to prevent them from turning up as a source box instead of text).
I also suggest you glance at the forum FAQ's ...
It's actually a little more involved than that.
[source] tags place syntax highlighted text in a white box and do not attempt to interpret angular brackets-enclosed as HTML. Like [code] tags, they also display text in monospace font. Unfortunately, the [source] box is rather large for less than say 10 lines of code. To correctly show angular brackets in regular text (including [code] tags-enclosed text), use the HTML entity < and for the opening bracket. Here's a couple of examples:
template < typename T >
ATemplateClassInPlainText
{
...
};
The advantage of the [code] tag is that it maintains whitespace (indenting, etc), which the [source] tag does as well.
How did I write [source] and [code] without the spaces and without the board interpreting them as tags? I used the HTML entity for a left square bracket - ] And how did I get this spiffy small grey text? I used the GDNet editedby style: <span class="editedby"> text here </span>
[Edit: Darnit! Used the wrong entity.]
[edited by - Oluseyi on December 19, 2002 5:27:18 PM]
">>" being interpretted as shift is not an error in the compiler. That is the standard.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement