mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-25 17:20:48 +00:00
Use CostPool::PoolRef typedef some more
Cleanup to 217563 suggested by Lang Hames in post-commit review. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217564 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -68,19 +68,17 @@ private:
|
|||||||
void removeEntry(PoolEntry *p) { entrySet.erase(p); }
|
void removeEntry(PoolEntry *p) { entrySet.erase(p); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
template <typename CostKeyT>
|
template <typename CostKeyT> PoolRef getCost(CostKeyT costKey) {
|
||||||
std::shared_ptr<CostT> getCost(CostKeyT costKey) {
|
|
||||||
typename EntrySet::iterator itr =
|
typename EntrySet::iterator itr =
|
||||||
std::lower_bound(entrySet.begin(), entrySet.end(), costKey,
|
std::lower_bound(entrySet.begin(), entrySet.end(), costKey,
|
||||||
EntryComparator());
|
EntryComparator());
|
||||||
|
|
||||||
if (itr != entrySet.end() && costKey == (*itr)->getCost())
|
if (itr != entrySet.end() && costKey == (*itr)->getCost())
|
||||||
return std::shared_ptr<CostT>((*itr)->shared_from_this(),
|
return PoolRef((*itr)->shared_from_this(), &(*itr)->getCost());
|
||||||
&(*itr)->getCost());
|
|
||||||
|
|
||||||
auto p = std::make_shared<PoolEntry>(*this, std::move(costKey));
|
auto p = std::make_shared<PoolEntry>(*this, std::move(costKey));
|
||||||
entrySet.insert(itr, p.get());
|
entrySet.insert(itr, p.get());
|
||||||
return std::shared_ptr<CostT>(std::move(p), &p->getCost());
|
return PoolRef(std::move(p), &p->getCost());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user