Skip to content

Commit f0eae2c

Browse files
committed
Merge from trunk:
Tolerate argc being zero. Patch from C. K. Jester-Young. [SVN r43331]
1 parent b2a01d9 commit f0eae2c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

include/boost/program_options/detail/parsers.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace boost { namespace program_options {
3838
: detail::cmdline(
3939
// Explicit template arguments are required by gcc 3.3.1
4040
// (at least mingw version), and do no harm on other compilers.
41-
to_internal(detail::make_vector<charT, charT**>(argv+1, argv+argc)))
41+
to_internal(detail::make_vector<charT, charT**>(argv+1, argv+argc+!argc)))
4242
{}
4343

4444

src/cmdline.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ namespace boost { namespace program_options { namespace detail {
9898
{
9999
#if defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
100100
vector<string> args;
101-
copy(argv+1, argv+argc, inserter(args, args.end()));
101+
copy(argv+1, argv+argc+!argc, inserter(args, args.end()));
102102
init(args);
103103
#else
104-
init(vector<string>(argv+1, argv+argc));
104+
init(vector<string>(argv+1, argv+argc+!argc));
105105
#endif
106106
}
107107

0 commit comments

Comments
 (0)