For this line:
if(it->getName == nam)
it tells me (No match for the 'operator=='in it.std::_List_Iterator<TP>::operator ->[with_TP= record]0->record::getName==nam )
and for this line:
int addRecord( list< record >& database )
{
I get, a function-definition is not allowed here berofe '{' token.
Can anyone explain to me why I'm getting these errors.
Thank you!
Expand|Select|Wrap|Line Numbers
- //returns a valid iterator if name is used already otherwise is returns 0
- list< record> :: iterator existName(list <record> & database, const string& nam)
- {
- list <record>::iterator it;
- for (it = database.begin(); it != database.end(); it++)
- {
- if(it->getName == nam)
- {
- return it;
- }
- return database.end();
- }
- //add database records to end of list
- //gets input from the keyboard
- int addRecord( list< record >& database )
- {
- cout << "Enter a blank to exit the list :" <<endl;
- int count = 0, reply;
- string nam;
- for (;;)//loops until break
- {
- cout << "Name :";
- getline(cin,nam);
- if (nam == "")
- {
- break;
- }
- //create and add the record to the end of the list
- database.push_back(record(nam));
- cout << "Record added " << endl;
- }
- return count;
- }