0

comment should explain what im trying to accomplish...not sure how i should approach this problem tho

fileWork::fileWork(const std::wstring& processName,const std::wstring& fileName) // i want to use initializer list, but how can i do so if i want the function arguments to be checked first...before any class members are initialized? is this not possible or any ideas?
{
	isValidProcess(processName); 
	isValidfile(fileName);

	this->fileName = fileName;                                     
	this->processName = processName;
	memoryAddress = NULL;
	
	
}
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by dwks
1

Do the functions isValidProcess() and isValidfile() throw exceptions if they find something amiss?

It should do no harm to set this->fileName, which is just a string, to fileName, and then do the check afterwards. If the check fails you can always reset the variable.

Why do you want to use an initializer list? Your code presumably already works, and since you're trying to do something fairly complicated with logic involved, the code would probably be more understandable as it is.

(Initializer lists can be slightly more efficient, yes, but the difference is so small that you shouldn't worry about it.)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.