error: could not convert 'L.ChainedList<T>::Next [with T = Pont]' to bool

Helo,

im getting the message that you see in the title, and i don't know why.

I have a Class called ChainedList that has a method called Next:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
template <class T>
		bool ChainedList<T>::Next()
			{
			if (Pointer->Next != 0)
				{
//This part is not really important now
				Pointer = Pointer->Next;
				Element = Pointer->Data;
//
				return true;				
				}
			else
				return false;
			}


I'm using this method in my main function like this:

1
2
3
4
while (L.Next)
		{
			cout << "( " << L.Element.x << " ; " << L.Element.y <<" )" << '\n';
		}

When the function takes no parameters you can't leave out the parentheses. I think some implementations let you do that, but it's not standard. What the error is saying is that the compiler can't implicitly convert a pointer to function to a bool.
Last edited on
Seems i dumbly forgot to write the parentheses for the method. Thanks for the help.
Topic archived. No new replies allowed.