Unlike the parser that is instanced with the input string and tokens are repeatedly obtained using the function operator function until either an error (exception) occurs or an end-of-line token is returned, the recreator is single use and its function operator function will only be called once for a given RPN list. Therefore, only a temporary instance is needed - no member or local instance is required.
The users of the recreator, the tester and program model classes, previously contained a pointer to a recreator instance, which was created by their constructors. The recreator instance was deleted automatically when these class instances were deleted because a standard unique pointer was used. Since the recreator is single use, only a local instance is required and these members were removed. Instead of creating a local variable instance, a temporary instance is used (the instance is created and deleted during the statement):
Recreator recreator; → string = Recreator{}(rpnList);
string = recreator(rpnList);
Since this is the last change to be made to the recreator class, the redundant 'void' keywords were removed from several of the recreator function definitions, and the use of Q_UNUSED macro was replaced with the '(void)' syntax on unused variables in the various recreate functions. This concludes work on the recreator class, so the recreator branch was merged to the develop branch and deleted.
[branch recreator commit a0e99f6dcf]
[branch develop merge commit dc4dd26876]
No comments:
Post a Comment
All comments and feedback welcomed, whether positive or negative.
(Anonymous comments are allowed, but comments with URL links or unrelated comments will be removed.)