Merge pull request #15 from Jackojc/fix_warnings

Fix warning shown with -Wsign-conversion.
This commit is contained in:
Pranav Srinivas Kumar 2019-05-12 13:15:54 -04:00 committed by GitHub
commit 6ed4a5157e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -626,7 +626,7 @@ class ArgumentParser {
std::vector<size_t> argumentLengths(aArguments.size()); std::vector<size_t> argumentLengths(aArguments.size());
std::transform(std::begin(aArguments), std::end(aArguments), std::begin(argumentLengths), [](const auto& arg) { std::transform(std::begin(aArguments), std::end(aArguments), std::begin(argumentLengths), [](const auto& arg) {
const auto& names = arg->mNames; const auto& names = arg->mNames;
auto maxLength = std::accumulate(std::begin(names), std::end(names), 0, [](const auto& sum, const auto& s) { auto maxLength = std::accumulate(std::begin(names), std::end(names), std::string::size_type{0}, [](const auto& sum, const auto& s) {
return sum + s.size() + 2; // +2 for ", " return sum + s.size() + 2; // +2 for ", "
}); });
return maxLength - 2; // -2 since the last one doesn't need ", " return maxLength - 2; // -2 since the last one doesn't need ", "