8000 Making things easier to read by casting to ssize_t. · rmpowell77/docopt.cpp@a8f12fe · GitHub
[go: up one dir, main page]

Skip to content

Commit a8f12fe

Browse files
committed
Making things easier to read by casting to ssize_t.
1 parent c509100 commit a8f12fe

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docopt.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ bool LeafPattern::match(PatternList& left, std::vector<std::shared_ptr<LeafPatte
119119
return false;
120120
}
121121

122-
left.erase(left.begin()+static_cast<decltype(left.begin())::difference_type>(match.first));
122+
left.erase(left.begin()+static_cast<ssize_t>(match.first));
123123

124124
auto same_name = std::find_if(collected.begin(), collected.end(), [&](std::shared_ptr<LeafPattern> const& p) {
125125
return p->name()==name();
@@ -170,7 +170,7 @@ Option Option::parse(std::string const& option_description)
170170
auto double_space = option_description.find(" ");
171171
auto options_end = option_description.end();
172172
if (double_space != std::string::npos) {
173-
options_end = option_description.begin() + static_cast<decltype(option_description.begin())::difference_type>(double_space);
173+
options_end = option_description.begin() + static_cast<ssize_t>(double_space);
174174
}
175175

176176
static const std::regex pattern {"(--|-)?(.*?)([,= ]|$)"};
@@ -512,7 +512,7 @@ class Tokens {
512512
std::string the_rest() const {
513513
if (!*this)
514514
return {};
515-
return join(fTokens.begin()+static_cast<decltype(fTokens.begin())::difference_type>(fIndex),
515+
return join(fTokens.begin()+static_cast<ssize_t>(fIndex),
516516
fTokens.end(),
517517
" ");
518518
}
@@ -920,7 +920,7 @@ static std::vector<Option> parse_defaults(std::string const& doc) {
920920
std::vector<Option> defaults;
921921

922922
for(auto s : parse_section("options:", doc)) {
923-
s.erase(s.begin(), s.begin()+static_cast<decltype(s.begin())::difference_type>(s.find(':'))+1); // get rid of "options:"
923+
s.erase(s.begin(), s.begin()+static_cast<ssize_t>(s.find(':'))+1); // get rid of "options:"
924924

925925
std::for_each(std::sregex_iterator{ s.begin(), s.end(), pattern },
926926
std::sregex_iterator{},

0 commit comments

Comments
 (0)
0