Boost logo

Boost Users :

From: Edward Z. Yang (edwardzyang_at_[hidden])
Date: 2006-12-12 21:52:56


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm using program_options in a few programs that I'm doing, and I'd like
to clarify what's going on at certain points.

vm.count("key") appears to tell us the number of times a flag is
specified, but the documentation here:
<http://www.boost.org/doc/html/variables_map.html> doesn't seem to say
anything about it. Where is it specified? Does abstract_variables_map
actually inherit off of std map? Why don't we use !vm["key"].empty()
instead? (slightly more verbose, but it's clearer about what it's doing).

The vm["term"].as<int>() template seems to combust spectacularly (as in
cause a stack dump) when it turns out that vm["term"] doesn't actually
exist. This doesn't seem very robust, and according to the
documentation, an exception ought to be thrown. Am I just
misunderstanding the docs?

What is the preferred method determining that no parameters were passed?
I'm currently using argc == 1, which seems a bit hacky, and doesn't
catch errant parameters.

Thanks. This might seem a little pedantic, but I'm trying to do things
right. :-)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFf2sIqTO+fYacSNoRAqz5AJ9nBOEz87v8H4HjRB6mM2NSvNSllQCaA+SE
s0kcqXiQXy7+ID7ugotbDKc=
=NvIj
-----END PGP SIGNATURE-----


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