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?

Recommended Answers

All 2 Replies

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.