forked from qt-creator/qt-creator
Use std::unordered_map instead of std::map
In theory it should be faster. Change-Id: Ibf6ce8c5dced5a075b57f89ce6e2d5ed1c5d6be7 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
12
src/libs/3rdparty/cplusplus/Names.h
vendored
12
src/libs/3rdparty/cplusplus/Names.h
vendored
@@ -113,6 +113,11 @@ public:
|
||||
|
||||
bool match(const TemplateArgument &otherTy, Matcher *matcher = nullptr) const;
|
||||
|
||||
size_t hash() const
|
||||
{
|
||||
return _expressionTy.hash() ^ std::hash<const NumericLiteral *>()(_numericLiteral);
|
||||
}
|
||||
|
||||
private:
|
||||
FullySpecifiedType _expressionTy;
|
||||
const NumericLiteral *_numericLiteral = nullptr;
|
||||
@@ -145,10 +150,13 @@ public:
|
||||
TemplateArgumentIterator lastTemplateArgument() const { return _templateArguments.end(); }
|
||||
bool isSpecialization() const { return _isSpecialization; }
|
||||
|
||||
// Comparator needed to distinguish between two different TemplateNameId(e.g.:used in std::map)
|
||||
struct Compare {
|
||||
// Comparator needed to distinguish between two different TemplateNameId(e.g.:used in std::unordered_map)
|
||||
struct Equals {
|
||||
bool operator()(const TemplateNameId *name, const TemplateNameId *other) const;
|
||||
};
|
||||
struct Hash {
|
||||
size_t operator()(const TemplateNameId *name) const;
|
||||
};
|
||||
|
||||
protected:
|
||||
void accept0(NameVisitor *visitor) const override;
|
||||
|
||||
Reference in New Issue
Block a user