vector of struct reference in class issue

Hello all,

I define a class as follow:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class ParamClass{
	struct FilterCtrlStruct {
		string Fldr;
		bool NeedChg;
		string FileSuf;
	};
	vector<FilterCtrlStruct> MMFilterCtrlA, MMFilterCtrlB;


	void MMFilterCtrlRead(const string& inFName,vector<FilterCtrlStruct>& WorkVect) {
		ifstream in(inFName);
		string line;
		vector<string> wStr;
		while (getline(in, line,'\n'))
		{
			split(wStr, line, ',');
			WorkVect.push_back(FilterCtrlStruct());
			WorkVect.Fldr = wStr[0];
			WorkVect.NeedChg = (bool)wStr[1];
			WorkVect.FileSuf = wStr[2];
		}
		in.close();
	};
};

When compile, it complain that Fldr is not a member of <vectot>FilterCtrlStruct as below:

error C2039: 'Fldr': is not a member of 
'std::vector<ParamClass::FilterCtrlStruct,std::allocator<_Ty>>'

so as for NeedChg and FileSuf...

I already define the struct and as I pass the vector<FilterCtrlStruct> as refrence,
it should able to access the Fldr, NeedChg etc. Why I can't access them now? Thx a lot.

Regds
LAM Chi-fung
Last edited on
Its late night on my side, I better go to sleep Zzzzzzz
I find the problem now:
WorkVect[WorkVect.size()-1].Fldr
solve the problem.
Topic archived. No new replies allowed.