954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Structure members resetting

I want recursively fill members of one structure, it looks like this:

struct OPTIONS{
string sDirectoryName;
vector<string> vExtensions;
int uOperationId;
} structCurrentDir;


after filling all members I need to push this structure to another vector: vDirectories.push_back(structCurrentDir);

But then I need reset all members and I have problem. structCurrentDir = {"", NULL, 0}; not working (syntax error).
Any ideas how should it be done?

Cybulski
Light Poster
47 posts since Apr 2008
Reputation Points: 15
Solved Threads: 3
 

Add e.g. a Reset() member function in which you reset the member variables to desired values.

mitrmkar
Posting Virtuoso
1,809 posts since Nov 2007
Reputation Points: 1,105
Solved Threads: 395
 

The problem is with types and initializer syntax.

Make sure that an empty OPTIONS is
{ string(), vector<string>(), 0 }

NULL is not a valid vector<>.

Hope this helps.

Duoas
Postaholic
2,043 posts since Oct 2007
Reputation Points: 1,140
Solved Threads: 229
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You