diff --git a/include/tclap/CommandLine.h b/include/tclap/CommandLine.h index 45660ea..1a2a8cc 100644 --- a/include/tclap/CommandLine.h +++ b/include/tclap/CommandLine.h @@ -93,6 +93,9 @@ class CmdLine */ XorHandler _xorHandler; + std::list _argDeleteOnExitList; + std::list _visitorDeleteOnExitList; + /** * Checks whether a name/flag string matches entirely matches * the Arg::blankChar. Used when multiple switches are combined @@ -122,6 +125,16 @@ class CmdLine */ void _constructor(); + /** + * Perform a delete ptr; operation on ptr when this object is deleted. + */ + void deleteOnExit(Arg* ptr); + + /** + * Perform a delete ptr; operation on ptr when this object is deleted. + */ + void deleteOnExit(Visitor* ptr); + public: /** @@ -151,6 +164,9 @@ class CmdLine CmdLine(const std::string& message, const char delimiter = ' ', const std::string& version = "none" ); + + ///Deletes any resources allocated by a CmdLine object + ~CmdLine(); /** * Adds an argument to the list of arguments to be parsed.