add PISet::const_iterator, now can iterate ranged-for PISet by T, not by PIPair<T, bool>

This commit is contained in:
2024-04-05 17:13:18 +03:00
parent 9283c88b4e
commit ee4d78d2e1
3 changed files with 95 additions and 11 deletions

View File

@@ -610,7 +610,7 @@ public:
return ret;
}
private:
protected:
struct MapIndex {
MapIndex(const Key & k = Key(), size_t i = 0): key(k), index(i) {}
MapIndex(Key && k, size_t i = 0): key(std::move(k)), index(i) {}
@@ -627,6 +627,10 @@ private:
template<typename P, typename Key1, typename T1>
friend PIBinaryStream<P> & operator<<(PIBinaryStream<P> & s, const PIDeque<typename PIMap<Key1, T1>::MapIndex> & v);
PIVector<T> pim_content;
PIDeque<MapIndex> pim_index;
private:
inline ssize_t _binarySearch(ssize_t first, ssize_t last, const Key & key, bool & found) const {
ssize_t mid = 0;
while (first <= last) {
@@ -678,10 +682,6 @@ private:
inline T & _value(ssize_t index) { return pim_content[pim_index[index].index]; }
inline const T & _value(ssize_t index) const { return pim_content[pim_index[index].index]; }
PIVector<T> pim_content;
PIDeque<MapIndex> pim_index;
};