Boost logo

Boost :

From: Davlet Panech (dp1978x_lists_at_[hidden])
Date: 2005-12-05 12:59:51


Hello,

The attached patches fix some problems with program_options:

* options_description.hpp
changed "static const ..." to BOOST_STATIC_CONSTANT

* options_description.cpp
changed "std::reverse_iterator" to "boost::reverse_iterator" (the std::
version is broken in MSVC6)

* variables_map.cpp
fixed scope problem in "for (int i...", etc. by moving the var. declaration
outside the loop.

D.

        

        
                
__________________________________________________________
Find your next car at http://autos.yahoo.ca

Index: options_description.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/program_options/src/options_description.cpp,v
retrieving revision 1.14
diff -d -u -r1.14 options_description.cpp
--- options_description.cpp 13 Jul 2005 16:32:40 -0000 1.14
+++ options_description.cpp 5 Dec 2005 17:47:31 -0000
@@ -12,7 +12,7 @@
 // should move that to a separate headers.
 #include <boost/program_options/parsers.hpp>
 
-
+#include <boost/iterator/reverse_iterator.hpp>
 #include <boost/lexical_cast.hpp>
 #include <boost/tokenizer.hpp>
 #include <boost/detail/workaround.hpp>
@@ -375,8 +375,8 @@
                     {
                         // find last ' ' in the second half of the current paragraph line
                         string::const_iterator last_space =
- find(reverse_iterator<string::const_iterator>(line_end - 1),
- reverse_iterator<string::const_iterator>(line_begin - 1),
+ find(boost::reverse_iterator<string::const_iterator>(line_end - 1),
+ boost::reverse_iterator<string::const_iterator>(line_begin - 1),
                                  ' ')
                             .base();
                 

Index: options_description.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/program_options/options_description.hpp,v
retrieving revision 1.9
diff -u -d -r1.9 options_description.hpp
--- options_description.hpp 22 Apr 2005 13:35:43 -0000 1.9
+++ options_description.hpp 5 Dec 2005 17:37:44 -0000
@@ -153,7 +153,7 @@
     */
     class BOOST_PROGRAM_OPTIONS_DECL options_description {
     public:
- static const unsigned m_default_line_length = 80;
+ BOOST_STATIC_CONSTANT (unsigned, m_default_line_length = 80);
         
         /** Creates the instance. */
         options_description(unsigned line_length = m_default_line_length);

Index: variables_map.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/program_options/src/variables_map.cpp,v
retrieving revision 1.5
diff -d -u -r1.5 variables_map.cpp
--- variables_map.cpp 6 May 2005 06:40:39 -0000 1.5
+++ variables_map.cpp 5 Dec 2005 17:49:36 -0000
@@ -34,9 +34,10 @@
         std::map<std::string, variable_value>& m = xm;
 
         std::set<std::string> new_final;
+ size_t i;
 
         // First, convert/store all given options
- for (size_t i = 0; i < options.options.size(); ++i) {
+ for (i = 0; i < options.options.size(); ++i) {
 
             const string& name = options.options[i].string_key;
             // Skip positional options without name
@@ -84,7 +85,7 @@
         
         // Second, apply default values.
         const vector<shared_ptr<option_description> >& all = desc.options();
- for(unsigned i = 0; i < all.size(); ++i)
+ for(i = 0; i < all.size(); ++i)
         {
             const option_description& d = *all[i];
             string key = d.key("");


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk