Codechange: Replaced SmallVector::[Begin|End]() with std alternatives

This commit is contained in:
Henry Wilson
2019-02-17 11:20:52 +00:00
committed by PeterN
parent 297fd3dda3
commit ab711e6942
75 changed files with 464 additions and 555 deletions

View File

@@ -31,10 +31,7 @@
*/
/* static */ void PoolBase::Clean(PoolType pt)
{
PoolVector *pools = PoolBase::GetPools();
PoolBase **end = pools->End();
for (PoolBase **ppool = pools->Begin(); ppool != end; ppool++) {
PoolBase *pool = *ppool;
for (PoolBase *pool : *PoolBase::GetPools()) {
if (pool->type & pt) pool->CleanPool();
}
}

View File

@@ -55,12 +55,13 @@ struct SmallMap : SmallVector<SmallPair<T, U>, S> {
* @param key key to find
* @return &Pair(key, data) if found, this->End() if not
*/
inline const Pair *Find(const T &key) const
inline typename std::vector<Pair>::const_iterator Find(const T &key) const
{
for (uint i = 0; i < std::vector<Pair>::size(); i++) {
if (key == std::vector<Pair>::operator[](i).first) return &std::vector<Pair>::operator[](i);
typename std::vector<Pair>::const_iterator it;
for (it = std::vector<Pair>::begin(); it != std::vector<Pair>::end(); it++) {
if (key == it->first) return it;
}
return this->End();
return it;
}
/**
@@ -114,7 +115,7 @@ struct SmallMap : SmallVector<SmallPair<T, U>, S> {
*/
inline void Erase(Pair *pair)
{
assert(pair >= this->Begin() && pair < this->End());
assert(pair >= std::vector<Pair>::data() && pair < this->End());
auto distance = pair - std::vector<Pair>::data();
std::vector<Pair>::erase(std::vector<Pair>::begin() + distance);
}
@@ -166,7 +167,7 @@ struct SmallMap : SmallVector<SmallPair<T, U>, S> {
inline void SortByKey()
{
QSortT(this->Begin(), std::vector<Pair>::size(), KeySorter);
QSortT(std::vector<Pair>::data(), std::vector<Pair>::size(), KeySorter);
}
static int CDECL KeySorter(const Pair *a, const Pair *b)

View File

@@ -83,46 +83,6 @@ public:
}
~SmallVector() = default;
/**
* Get the pointer to the first item (const)
*
* @return the pointer to the first item
*/
inline const T *Begin() const
{
return std::vector<T>::data();
}
/**
* Get the pointer to the first item
*
* @return the pointer to the first item
*/
inline T *Begin()
{
return std::vector<T>::data();
}
/**
* Get the pointer behind the last valid item (const)
*
* @return the pointer behind the last valid item
*/
inline const T *End() const
{
return std::vector<T>::data() + std::vector<T>::size();
}
/**
* Get the pointer behind the last valid item
*
* @return the pointer behind the last valid item
*/
inline T *End()
{
return std::vector<T>::data() + std::vector<T>::size();
}
};
/**