diff --git a/libs/program_options/src/options_description.cpp b/libs/program_options/src/options_description.cpp
index 343bd30..22aaeb3 100644
|
a
|
b
|
namespace boost { namespace program_options {
|
| 419 | 419 | else |
| 420 | 420 | { |
| 421 | 421 | // only one tab per paragraph allowed |
| 422 | | if (count(par.begin(), par.end(), '\t') > 1) |
| | 422 | if (par.find('\t', par_indent+1) != string::npos) |
| 423 | 423 | { |
| 424 | 424 | boost::throw_exception(program_options::error( |
| 425 | 425 | "Only one tab per paragraph is allowed in the options description")); |
| … |
… |
namespace boost { namespace program_options {
|
| 469 | 469 | // Take care to never increment the iterator past |
| 470 | 470 | // the end, since MSVC 8.0 (brokenly), assumes that |
| 471 | 471 | // doing that, even if no access happens, is a bug. |
| 472 | | unsigned remaining = static_cast<unsigned>(std::distance(line_begin, par_end)); |
| | 472 | unsigned remaining = static_cast<unsigned>(par_end - line_begin); |
| 473 | 473 | string::const_iterator line_end = line_begin + |
| 474 | 474 | ((remaining < line_length) ? remaining : line_length); |
| 475 | 475 | |
| … |
… |
namespace boost { namespace program_options {
|
| 479 | 479 | ((line_end < par_end) && (*line_end != ' '))) |
| 480 | 480 | { |
| 481 | 481 | // find last ' ' in the second half of the current paragraph line |
| 482 | | string::const_iterator last_space = |
| 483 | | find(reverse_iterator<string::const_iterator>(line_end), |
| 484 | | reverse_iterator<string::const_iterator>(line_begin), |
| 485 | | ' ') |
| 486 | | .base(); |
| | 482 | string::size_type last_space_pos = par.find(' ', line_end - par.begin()); |
| 487 | 483 | |
| 488 | | if (last_space != line_begin) |
| | 484 | if (last_space_pos != string::npos && |
| | 485 | last_space_pos > (line_begin - par.begin())) |
| 489 | 486 | { |
| 490 | | // is last_space within the second half ot the |
| | 487 | // is last space within the second half of the |
| 491 | 488 | // current line |
| 492 | | if (static_cast<unsigned>(std::distance(last_space, line_end)) < |
| | 489 | if (static_cast<unsigned>(par.length() - last_space_pos) < |
| 493 | 490 | (line_length / 2)) |
| 494 | 491 | { |
| 495 | | line_end = last_space; |
| | 492 | line_end = par.begin() + last_space_pos; |
| 496 | 493 | } |
| 497 | 494 | } |
| 498 | 495 | } // prevent chopped words |
diff --git a/libs/program_options/src/value_semantic.cpp b/libs/program_options/src/value_semantic.cpp
index 5314029..647550e 100644
|
a
|
b
|
namespace boost { namespace program_options {
|
| 368 | 368 | string error_template = original_error_template; |
| 369 | 369 | // remove duplicates using std::set |
| 370 | 370 | std::set<std::string> alternatives_set (m_alternatives.begin(), m_alternatives.end()); |
| 371 | | std::vector<std::string> alternatives_vec (alternatives_set.begin(), alternatives_set.end()); |
| | 371 | std::vector<std::string> alternatives_vec; |
| | 372 | copy(alternatives_set.begin(), alternatives_set.end(), back_inserter(alternatives_vec)); |
| 372 | 373 | |
| 373 | 374 | error_template += " and matches "; |
| 374 | 375 | // Being very cautious: should be > 1 alternative! |