summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/pool_func.cpp5
-rw-r--r--src/core/smallmap_type.hpp13
-rw-r--r--src/core/smallvec_type.hpp40
3 files changed, 8 insertions, 50 deletions
diff --git a/src/core/pool_func.cpp b/src/core/pool_func.cpp
index 97f9ad1c7..7a65bf77a 100644
--- a/src/core/pool_func.cpp
+++ b/src/core/pool_func.cpp
@@ -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();
}
}
diff --git a/src/core/smallmap_type.hpp b/src/core/smallmap_type.hpp
index 0917c5423..8cc96302f 100644
--- a/src/core/smallmap_type.hpp
+++ b/src/core/smallmap_type.hpp
@@ -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)
diff --git a/src/core/smallvec_type.hpp b/src/core/smallvec_type.hpp
index 9162c17b9..5ec07f2f0 100644
--- a/src/core/smallvec_type.hpp
+++ b/src/core/smallvec_type.hpp
@@ -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();
- }
};
/**