Merge from trunk:

Tolerate argc being zero.

Patch from C. K. Jester-Young.


[SVN r43331]
This commit is contained in:
Vladimir Prus 2008-02-20 14:55:25 +00:00
parent b2a01d9405
commit f0eae2ccfe
2 changed files with 3 additions and 3 deletions

View File

@ -38,7 +38,7 @@ namespace boost { namespace program_options {
: detail::cmdline(
// Explicit template arguments are required by gcc 3.3.1
// (at least mingw version), and do no harm on other compilers.
to_internal(detail::make_vector<charT, charT**>(argv+1, argv+argc)))
to_internal(detail::make_vector<charT, charT**>(argv+1, argv+argc+!argc)))
{}

View File

@ -98,10 +98,10 @@ namespace boost { namespace program_options { namespace detail {
{
#if defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
vector<string> args;
copy(argv+1, argv+argc, inserter(args, args.end()));
copy(argv+1, argv+argc+!argc, inserter(args, args.end()));
init(args);
#else
init(vector<string>(argv+1, argv+argc));
init(vector<string>(argv+1, argv+argc+!argc));
#endif
}