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

M

Mat DeLong

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
 
V

Victor Bazarov

Mat said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top