expected unqualified-id before

The goal of the function is to create a map and with pmeter and value, where pmeter is the index and value will be pmeter's value(there will be multiple values to each pmeter).

And if the function gets a pmeter that already exists in the map it is supposed to take that pmeter's value and add it to the pre-existing values for that pmeter. And if pmeter does not already exist in the map it just creates a new pmeter and puts that value in it.

understand?? lol.

Here is my problem right now... i have tried many things and this is one way that i have tried that returned the least amount of errors, thanks in advance for the help!!!

This function keeps returning these errors when compiled...
In function 'void mapping(char*, char*, pvMap&)':
expected unqualified-id before '=' token
expected primary-expression before '->' token
expected primary-expression before '->' token
expected unqualified-id before '->' token


Here is the header file...
1
2
3
4
5
6
7
8
9
10
11
12
13
#ifndef MAIN_H_
#define MAIN_H_
#include<map>
#include<string>
#include<vector>

using namespace std;

typedef map< string, vector<string> > pvMap;
typedef map< string, vector<string> >::iterator pviter;
typedef pair<map<string,vector<string> >,bool> insiter;

#endif /* MAIN_H_ */ 


Here is the function...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
void mapping(char *pmeter, char *value, pvMap &themap)
{
	insiter = themap.insert(pmeter);
	bool vfound = false;//if value was found return true

	for (int i = 0; i < insiter->first.size(); i++)
	{
		if (insiter->second[i] == value)//did find pre-existing value
		{
			vfound = true;
		}
	}
	if (vfound == false)
	{
		insiter->first.push_back(value);
	}
}
I actually decided to go at this a different approach. But i am still curious as to some answers to this if anyone is willing to answer, but dont feel obligated. I am attempting something different with "find()".
insiter is a typedef, not a variable.
These errors relate to your use of the term insiter

because insiter is a type as defined by your typedef but you are trying to use it as a variable.
Topic archived. No new replies allowed.