diff options
author | Przemyslaw Gorszkowski <pgorszkowski@gmail.com> | 2013-01-12 22:05:41 +0100 |
---|---|---|
committer | Przemyslaw Gorszkowski <pgorszkowski@gmail.com> | 2013-01-30 18:49:25 +0100 |
commit | ffba28d26ab6aaf9a953f42d5fa15c55a85c75a7 (patch) | |
tree | 010c0eb03d5caf768b3206ee7b69fe68b93a333c /src/libs/3rdparty/cplusplus/Names.cpp | |
parent | 0135609973b8c8f9b380aefb618659f698c5c2c5 (diff) | |
download | qt-creator-ffba28d26ab6aaf9a953f42d5fa15c55a85c75a7.tar.gz |
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>
Diffstat (limited to 'src/libs/3rdparty/cplusplus/Names.cpp')
-rw-r--r-- | src/libs/3rdparty/cplusplus/Names.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/libs/3rdparty/cplusplus/Names.cpp b/src/libs/3rdparty/cplusplus/Names.cpp index 9024b65a91..4c5cb7db79 100644 --- a/src/libs/3rdparty/cplusplus/Names.cpp +++ b/src/libs/3rdparty/cplusplus/Names.cpp @@ -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) { } |