467,877 Members | 1,234 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,877 developers. It's quick & easy.

C++ Template, - "non-type" error

Can someone explain this error to me? :

main.cpp:9: instantiated from `void show(const LIST::List<T>&) [with T =
int]'
main.cpp:23: instantiated from here
list.cpp:58: error: dependent-name `LIST::List<T>::ListIterator' is parsed
as a non-type, but instantiation yields a type
..........

This is the first part of the main:

#include "list.h"
#include <iostream>
using namespace std;
using namespace LIST;
template <typename T>

void show(const List<T>& m) {
for(List<T>::ListIterator i = m.begin(); i != m.end(); ++i) cout << *i;
}

------------------------

Thanks

Mat
Jul 23 '05 #1
  • viewed: 1618
Share:
1 Reply
Mat DeLong wrote:
Can someone explain this error to me? :

main.cpp:9: instantiated from `void show(const LIST::List<T>&) [with T =
int]'
main.cpp:23: instantiated from here
list.cpp:58: error: dependent-name `LIST::List<T>::ListIterator' is parsed
as a non-type, but instantiation yields a type
.........

This is the first part of the main:

#include "list.h"
#include <iostream>
using namespace std;
using namespace LIST;
template <typename T>

void show(const List<T>& m) {
for(List<T>::ListIterator i = m.begin(); i != m.end(); ++i) cout << *i; ^
Add 'typename' here.
}

------------------------


V
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Adrian Parker | last post: by
14 posts views Thread by mirnazim | last post: by
15 posts views Thread by Sander Tekelenburg | last post: by
reply views Thread by Robert Oschler | last post: by
8 posts views Thread by Bern McCarty | last post: by
1 post views Thread by =?Utf-8?B?QWxleCBNYWdoZW4=?= | last post: by
reply views Thread by jack112 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.