1.1 --- a/demo/arg_parser_demo.cc Fri Aug 09 11:07:27 2013 +0200
1.2 +++ b/demo/arg_parser_demo.cc Sun Aug 11 15:28:12 2013 +0200
1.3 @@ -2,7 +2,7 @@
1.4 *
1.5 * This file is a part of LEMON, a generic C++ optimization library.
1.6 *
1.7 - * Copyright (C) 2003-2009
1.8 + * Copyright (C) 2003-2010
1.9 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
1.10 * (Egervary Research Group on Combinatorial Optimization, EGRES).
1.11 *
1.12 @@ -65,9 +65,18 @@
1.13 ap.other("infile", "The input file.")
1.14 .other("...");
1.15
1.16 + // Throw an exception when problems occurs. The default behavior is to
1.17 + // exit(1) on these cases, but this makes Valgrind falsely warn
1.18 + // about memory leaks.
1.19 + ap.throwOnProblems();
1.20 +
1.21 // Perform the parsing process
1.22 // (in case of any error it terminates the program)
1.23 - ap.parse();
1.24 + // The try {} construct is necessary only if the ap.trowOnProblems()
1.25 + // setting is in use.
1.26 + try {
1.27 + ap.parse();
1.28 + } catch (ArgParserException &) { return 1; }
1.29
1.30 // Check each option if it has been given and print its value
1.31 std::cout << "Parameters of '" << ap.commandName() << "':\n";