Permalink
Browse files

Tolerate argc being zero.

Patch from C. K. Jester-Young.


[SVN r43207]
  • Loading branch information...
1 parent 152fbd8 commit 316e2fabe41203777b46ddbcb4b401c78114d8d0 @vprus vprus committed Feb 10, 2008
Showing with 3 additions and 3 deletions.
  1. +1 −1 include/boost/program_options/detail/parsers.hpp
  2. +2 −2 src/cmdline.cpp
@@ -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
@@ -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
}

0 comments on commit 316e2fa

Please sign in to comment.