8000 explicitly including stddef for ptrdiff. Adding ptrdiff namespace. · lineCode/docopt.cpp@b6ba473 · GitHub
[go: up one dir, main page]

Skip to content

Commit b6ba473

Browse files
committed
explicitly including stddef for ptrdiff. Adding ptrdiff namespace.
1 parent 3401d0a commit b6ba473

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

docopt.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <regex>
2121
#include <iostream>
2222
#include <cassert>
23+
#include <cstddef>
2324

2425
using namespace docopt;
2526

@@ -119,7 +120,7 @@ bool LeafPattern::match(PatternList& left, std::vector<std::shared_ptr<LeafPatte
119120
return false;
120121
}
121122

122-
left.erase(left.begin()+static_cast<ptrdiff_t>(match.first));
123+
left.erase(left.begin()+static_cast<std::ptrdiff_t>(match.first));
123124

124125
auto same_name = std::find_if(collected.begin(), collected.end(), [&](std::shared_ptr<LeafPattern> const& p) {
125126
return p->name()==name();
@@ -170,7 +171,7 @@ Option Option::parse(std::string const& option_description)
170171
auto double_space = option_description.find(" ");
171172
auto options_end = option_description.end();
172173
if (double_space != std::string::npos) {
173-
options_end = option_description.begin() + static_cast<ptrdiff_t>(double_space);
174+
options_end = option_description.begin() + static_cast<std::ptrdiff_t>(double_space);
174175
}
175176

176177
static const std::regex pattern {"(-{1,2})?(.*?)([,= ]|$)"};
@@ -512,7 +513,7 @@ class Tokens {
512513
std::string the_rest() const {
513514
if (!*this)
514515
return {};
515-
return join(fTokens.begin()+static_cast<ptrdiff_t>(fIndex),
516+
return join(fTokens.begin()+static_cast<std::ptrdiff_t>(fIndex),
516517
fTokens.end(),
517518
" ");
518519
}
@@ -920,7 +921,7 @@ static std::vector<Option> parse_defaults(std::string const& doc) {
920921
std::vector<Option> defaults;
921922

922923
for(auto s : parse_section("options:", doc)) {
923-
s.erase(s.begin(), s.begin()+static_cast<ptrdiff_t>(s.find(':'))+1); // get rid of "options:"
924+
s.erase(s.begin(), s.begin()+static_cast<std::ptrdiff_t>(s.find(':'))+1); // get rid of "options:"
924925

925926
std::for_each(std::sregex_iterator{ s.begin(), s.end(), pattern },
926927
std::sregex_iterator{},

0 commit comments

Comments
 (0)
0