Workaround for vc6/vc7.

[SVN r23081]
This commit is contained in:
Vladimir Prus 2004-06-11 06:11:34 +00:00
parent c4f84e5111
commit b6f9e1f367
7 changed files with 14 additions and 10 deletions

View File

@ -15,7 +15,7 @@
#include <cwchar> #include <cwchar>
#include <stdexcept> #include <stdexcept>
#if BOOST_WORKAROUND(__ICL, <= 700) #if BOOST_WORKAROUND(__ICL, <= 700) || BOOST_WORKAROUND(_MSC_VER, <= 1200)
#include <wchar.h> #include <wchar.h>
namespace std namespace std
{ {

View File

@ -53,7 +53,7 @@
#include <boost/detail/workaround.hpp> #include <boost/detail/workaround.hpp>
#if BOOST_WORKAROUND(__ICL, <= 700) #if BOOST_WORKAROUND(__ICL, <= 700) || BOOST_WORKAROUND(_MSC_VER, <= 1200)
#include <wchar.h> #include <wchar.h>
namespace std namespace std
{ {

View File

@ -216,9 +216,6 @@ namespace program_options {
approximation_range find_approximation(const std::string& prefix) const; approximation_range find_approximation(const std::string& prefix) const;
template<typename Derived>
friend class option_description_easy_init;
std::string m_caption; std::string m_caption;
// Data organization is chosen since: // Data organization is chosen since:
// - there could be two names for one option // - there could be two names for one option

View File

@ -66,6 +66,10 @@ namespace boost { namespace program_options {
namespace boost { namespace program_options { namespace detail { namespace boost { namespace program_options { namespace detail {
// vc6 needs this.
using namespace std;
using namespace program_options;
cmdline::cmdline(const std::vector<std::string>& args, int style, cmdline::cmdline(const std::vector<std::string>& args, int style,
bool allow_unregistered) bool allow_unregistered)
{ {
@ -371,7 +375,7 @@ namespace boost { namespace program_options { namespace detail {
int (*cmp)(const char*, const char*, size_t); int (*cmp)(const char*, const char*, size_t);
cmp = (style & case_insentitive) cmp = (style & case_insentitive)
? detail::strncmp_nocase : detail::strncmp_case; ? detail::strncmp_nocase : detail::strncmp_case;
const option* result(0); const option* result = 0;
for (size_t i = 0; i < options.size(); ++i) { for (size_t i = 0; i < options.size(); ++i) {
const char* known_name = options[i].long_name.c_str(); const char* known_name = options[i].long_name.c_str();
bool prefix = (*options[i].long_name.rbegin() == '*'); bool prefix = (*options[i].long_name.rbegin() == '*');

View File

@ -84,7 +84,7 @@ namespace boost {
{ {
return detail::convert<wchar_t>( return detail::convert<wchar_t>(
s, s,
boost::bind(boost::mem_fn(&codecvt<wchar_t, char, mbstate_t>::in), boost::bind(&std::codecvt<wchar_t, char, mbstate_t>::in,
&cvt, &cvt,
_1, _2, _3, _4, _5, _6, _7)); _1, _2, _3, _4, _5, _6, _7));
} }
@ -95,7 +95,7 @@ namespace boost {
{ {
return detail::convert<char>( return detail::convert<char>(
s, s,
boost::bind(boost::mem_fn(&codecvt<wchar_t, char, mbstate_t>::out), boost::bind(&codecvt<wchar_t, char, mbstate_t>::out,
&cvt, &cvt,
_1, _2, _3, _4, _5, _6, _7)); _1, _2, _3, _4, _5, _6, _7));
} }

View File

@ -303,7 +303,8 @@ namespace boost { namespace program_options {
/* Find the maximum width of the option column */ /* Find the maximum width of the option column */
unsigned width(24); unsigned width(24);
for (unsigned i = 0; i < options.size(); ++i) unsigned i; // vc6 has broken for loop scoping
for (i = 0; i < options.size(); ++i)
{ {
const option_description& opt = *options[i]; const option_description& opt = *options[i];
stringstream ss; stringstream ss;
@ -312,7 +313,7 @@ namespace boost { namespace program_options {
} }
/* The options formatting style is stolen from Subversion. */ /* The options formatting style is stolen from Subversion. */
for (unsigned i = 0; i < options.size(); ++i) for (i = 0; i < options.size(); ++i)
{ {
if (belong_to_group[i]) if (belong_to_group[i])
continue; continue;

View File

@ -478,6 +478,7 @@ void test_style_errors()
int test_main(int ac, char* av[]) int test_main(int ac, char* av[])
{ {
// ### detail::test_cmdline_detail(); // ### detail::test_cmdline_detail();
cerr << "Checkpojnt 1\n";
test_long_options(); test_long_options();
test_short_options(); test_short_options();
@ -512,5 +513,6 @@ int test_main(int ac, char* av[])
cout << e.what() << "\n"; cout << e.what() << "\n";
} }
cerr << "Returning normally\n";
return 0; return 0;
} }