Skip to content

Commit 24ffd62

Browse files
author
Your Name
committed
Remove static_cast
1 parent d14c231 commit 24ffd62

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

lib/templatesimplifier.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ static ParameterShape parseParameterShape(const Token* start, const std::vector<
864864
return typeParameter->str() == shape.typeTok->str();
865865
});
866866
if (it != typeParameters.cend())
867-
shape.templateParameterIndex = static_cast<int>(it - typeParameters.cbegin());
867+
shape.templateParameterIndex = it - typeParameters.cbegin();
868868
return shape;
869869
}
870870

@@ -1186,7 +1186,9 @@ std::string TemplateSimplifier::deduceFunctionTemplateArguments(Token* tok,
11861186
if (it != parameterCountCache.cend())
11871187
return it->second;
11881188
const DeductionCandidate parsed = parseDeductionCandidate(candidate);
1189-
const int count = parsed.typeParameters.empty() ? -1 : static_cast<int>(parsed.parameterShapes.size());
1189+
int count = -1;
1190+
if (!parsed.typeParameters.empty())
1191+
count = parsed.parameterShapes.size();
11901192
parameterCountCache[&candidate] = count;
11911193
return count;
11921194
};
@@ -1196,7 +1198,7 @@ std::string TemplateSimplifier::deduceFunctionTemplateArguments(Token* tok,
11961198
// matching is not possible yet - the declaration may be in a base class - so
11971199
// consider all declarations with this name.
11981200
for (auto pos = range.first; pos != range.second; ++pos) {
1199-
if (supportedParameterCount(*pos->second) == static_cast<int>(instantiationArgs.size())) {
1201+
if (supportedParameterCount(*pos->second) == instantiationArgs.size()) {
12001202
mPendingTypeDeductions = true;
12011203
return qualification;
12021204
}
@@ -1280,7 +1282,7 @@ std::string TemplateSimplifier::deduceFunctionTemplateArguments(Token* tok,
12801282
const TokenAndName* declaration = nullptr;
12811283
DeductionCandidate parsedDeclaration;
12821284
for (const TokenAndName* candidate : candidates) {
1283-
if (supportedParameterCount(*candidate) != static_cast<int>(instantiationArgs.size()))
1285+
if (supportedParameterCount(*candidate) != instantiationArgs.size())
12841286
continue;
12851287
DeductionCandidate parsed = parseDeductionCandidate(*candidate);
12861288

0 commit comments

Comments
 (0)