Boost logo

Boost Users :

From: Michiel Helvensteijn (m.helvensteijn_at_[hidden])
Date: 2008-07-16 12:49:06


Aljaz wrote:

> I've been wondering if there is no-throw version of
> boost::program_options::store , command_line_parser and basic_line_parser

I don't believe store() throws any exception. I don't think the
basic_line_parser symbol exists in boost.program_options.

As for boost::program_options::basic_command_line_parser<T>.. The run()
function of that class must throw an exception in case of parse errors that
you need to know about.

If you would like no stack unrolling to take place on error, you just need
to surround the call with a try/catch block. If you really don't care about
what sort of error it is, you can catch boost::program_options::error.

try {
    // the function call
} catch (boost::program_options::error& e) {
    // handle error... or don't
}

-- 
Michiel Helvensteijn

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net