|
Boost : |
From: François Dumont (francois.cppdevs_at_[hidden])
Date: 2005-08-30 15:39:18
Here are several patches to improve portability for this library:
- options_description.hpp: The m_default_line_length is for me an
implementation detail. As static constant are well known as not being
portable I propose to use the dedicated BOOST_STATIC_CONSTANT macro in
this case. I also move it to the private section as I think it is the
place it must be but of course it do not change the portability aspect
if it is retore back to the public section.
- options_description.cpp: C++ Standard library implementors needs
compiler partial template specialization support in order to offer the
Standard reverse_iterator definition. Using reverse_iterator in this
source introduce a major limitation in terms of compilers able to
support it. As the only thing you need is a reverse_iterator on
string::const_iterator the simplest solution is to use the
string::const_reverse_iterator typedef. This way you simply rely on
Standard library quality, I expect that all compilers with partial
template specialization have a Standard string coming with a
const_reverse_iterator typedef.
- variables_map.cpp: A classic for loop internal variable problem, i is
defined 2 times with a different type in 2 different for loop. I fix it
by using an iterator approach to enumerate the desc.options() container.
Thanks to those patches I build the lib with the msvc-stlport toolset
with no problem.
Bests
*** options_description.hpp.orig Tue Aug 30 07:34:41 2005
--- options_description.hpp Tue Aug 30 21:05:22 2005
***************
*** 152,160 ****
@sa option_description
*/
class BOOST_PROGRAM_OPTIONS_DECL options_description {
public:
- static const unsigned m_default_line_length = 80;
-
/** Creates the instance. */
options_description(unsigned line_length = m_default_line_length);
/** Creates the instance. The 'caption' parameter gives the name of
--- 152,159 ----
@sa option_description
*/
class BOOST_PROGRAM_OPTIONS_DECL options_description {
+ BOOST_STATIC_CONSTANT(unsigned, m_default_line_length = 80);
public:
/** Creates the instance. */
options_description(unsigned line_length = m_default_line_length);
/** Creates the instance. The 'caption' parameter gives the name of
*** options_description.cpp.orig Tue Aug 30 07:42:10 2005
--- options_description.cpp Tue Aug 30 07:43:28 2005
***************
*** 375,382 ****
{
// 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),
' ')
.base();
--- 375,382 ----
{
// find last ' ' in the second half of the current paragraph line
string::const_iterator last_space =
! find(string::const_reverse_iterator(line_end - 1),
! string::const_reverse_iterator(line_begin - 1),
' ')
.base();
*** variables_map.cpp.orig Tue Aug 30 07:46:25 2005
--- variables_map.cpp Tue Aug 30 07:48:48 2005
***************
*** 80,92 ****
}
xm.m_final.insert(new_final.begin(), new_final.end());
-
-
// Second, apply default values.
! const vector<shared_ptr<option_description> >& all = desc.options();
! for(unsigned i = 0; i < all.size(); ++i)
{
! const option_description& d = *all[i];
string key = d.key("");
// FIXME: this logic relies on knowledge of option_description
// internals.
--- 80,91 ----
}
xm.m_final.insert(new_final.begin(), new_final.end());
// Second, apply default values.
! vector<shared_ptr<option_description> >::const_iterator optIt(desc.options().begin()),
! optItEnd(desc.options().end());
! for (; optIt != optItEnd; ++optIt)
{
! const option_description& d = *(*optIt);
string key = d.key("");
// FIXME: this logic relies on knowledge of option_description
// internals.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk