forked from qt-creator/qt-creator
C++: Fix code compl. for instantiation of template specialization
It works for full specialization. Instantiate of the partial specialization has to be implemented(finding appropriate partial specialization-on going) Added unit test. Change-Id: I8ef5ea963e7c665e0d67d390b3a833486773dab0 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
21
src/libs/3rdparty/cplusplus/Names.cpp
vendored
21
src/libs/3rdparty/cplusplus/Names.cpp
vendored
@@ -128,6 +128,27 @@ bool TemplateNameId::isEqualTo(const Name *other) const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TemplateNameId::Compare::operator()(const TemplateNameId *name,
|
||||
const TemplateNameId *other) const
|
||||
{
|
||||
const Identifier *id = name->identifier();
|
||||
const Identifier *otherId = other->identifier();
|
||||
|
||||
if (id == otherId) {
|
||||
// we have to differentiate TemplateNameId with respect to specialization or instantiation
|
||||
if (name->isSpecialization() == other->isSpecialization()) {
|
||||
return std::lexicographical_compare(name->firstTemplateArgument(),
|
||||
name->lastTemplateArgument(),
|
||||
other->firstTemplateArgument(),
|
||||
other->lastTemplateArgument());
|
||||
} else {
|
||||
return name->isSpecialization();
|
||||
}
|
||||
}
|
||||
|
||||
return id < otherId;
|
||||
}
|
||||
|
||||
OperatorNameId::OperatorNameId(Kind kind)
|
||||
: _kind(kind)
|
||||
{ }
|
||||
|
||||
Reference in New Issue
Block a user