Boost logo

Boost-Commit :

From: ghost_at_[hidden]
Date: 2008-02-10 08:13:42


Author: vladimir_prus
Date: 2008-02-10 08:13:41 EST (Sun, 10 Feb 2008)
New Revision: 43207
URL: http://svn.boost.org/trac/boost/changeset/43207

Log:
Tolerate argc being zero.

Patch from C. K. Jester-Young.

Text files modified:
   trunk/boost/program_options/detail/parsers.hpp | 2 +-
   trunk/libs/program_options/src/cmdline.cpp | 4 ++--
   2 files changed, 3 insertions(+), 3 deletions(-)

Modified: trunk/boost/program_options/detail/parsers.hpp
==============================================================================
--- trunk/boost/program_options/detail/parsers.hpp (original)
+++ trunk/boost/program_options/detail/parsers.hpp 2008-02-10 08:13:41 EST (Sun, 10 Feb 2008)
@@ -38,7 +38,7 @@
     : 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)))
     {}
 
     

Modified: trunk/libs/program_options/src/cmdline.cpp
==============================================================================
--- trunk/libs/program_options/src/cmdline.cpp (original)
+++ trunk/libs/program_options/src/cmdline.cpp 2008-02-10 08:13:41 EST (Sun, 10 Feb 2008)
@@ -98,10 +98,10 @@
     {
 #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
     }
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk