PICout fix
This commit is contained in:
@@ -85,7 +85,7 @@ public:
|
||||
const PIMap<Key, T> * parent;
|
||||
ssize_t pos;
|
||||
public:
|
||||
iterator(): parent(0), pos(0) {}
|
||||
iterator(): parent(nullptr), pos(0) {}
|
||||
const Key & key() const {return const_cast<PIMap<Key, T> * >(parent)->_key(pos);}
|
||||
T & value() {return const_cast<PIMap<Key, T> * >(parent)->_value(pos);}
|
||||
inline PIPair<Key, T> operator *() const {return PIPair<Key, T>(const_cast<PIMap<Key, T> * >(parent)->_key(pos), const_cast<PIMap<Key, T> * >(parent)->_value(pos));}
|
||||
@@ -104,7 +104,7 @@ public:
|
||||
const PIMap<Key, T> * parent;
|
||||
ssize_t pos;
|
||||
public:
|
||||
reverse_iterator(): parent(0), pos(0) {}
|
||||
reverse_iterator(): parent(nullptr), pos(0) {}
|
||||
const Key & key() const {return const_cast<PIMap<Key, T> * >(parent)->_key(pos);}
|
||||
T & value() const {return const_cast<PIMap<Key, T> * >(parent)->_value(pos);}
|
||||
inline PIPair<Key, T> operator *() const {return PIPair<Key, T>(const_cast<PIMap<Key, T> * >(parent)->_key(pos), const_cast<PIMap<Key, T> * >(parent)->_value(pos));}
|
||||
@@ -123,9 +123,8 @@ public:
|
||||
const PIMap<Key, T> * parent;
|
||||
ssize_t pos;
|
||||
public:
|
||||
const_iterator(): parent(0), pos(0) {}
|
||||
const_iterator(): parent(nullptr), pos(0) {}
|
||||
const value_type operator *() const {return parent->_pair(pos);}
|
||||
//const value_type* operator ->() const {cval = parent->_pair(pos); return &cval;}
|
||||
const Key & key() const {return const_cast<PIMap<Key, T> * >(parent)->_key(pos);}
|
||||
const T & value() const {return const_cast<PIMap<Key, T> * >(parent)->_value(pos);}
|
||||
void operator ++() {++pos;}
|
||||
@@ -134,7 +133,6 @@ public:
|
||||
void operator --(int) {--pos;}
|
||||
bool operator ==(const const_iterator & it) const {return (pos == it.pos);}
|
||||
bool operator !=(const const_iterator & it) const {return (pos != it.pos);}
|
||||
//mutable value_type cval;
|
||||
};
|
||||
|
||||
class const_reverse_iterator {
|
||||
@@ -144,16 +142,14 @@ public:
|
||||
const PIMap<Key, T> * parent;
|
||||
ssize_t pos;
|
||||
public:
|
||||
const_reverse_iterator(): parent(0), pos(0) {}
|
||||
const_reverse_iterator(): parent(nullptr), pos(0) {}
|
||||
const value_type operator *() const {return parent->_pair(pos);}
|
||||
//const value_type* operator ->() const {cval = parent->_pair(pos); return &cval;}
|
||||
void operator ++() {--pos;}
|
||||
void operator ++(int) {--pos;}
|
||||
void operator --() {++pos;}
|
||||
void operator --(int) {++pos;}
|
||||
bool operator ==(const const_reverse_iterator & it) const {return (pos == it.pos);}
|
||||
bool operator !=(const const_reverse_iterator & it) const {return (pos != it.pos);}
|
||||
//mutable value_type cval;
|
||||
};
|
||||
|
||||
iterator begin() {return iterator(this, 0);}
|
||||
@@ -198,8 +194,9 @@ public:
|
||||
if (other.isEmpty()) return *this;
|
||||
if (other.size() == 1) {insert(other.pim_index[0].key, other.pim_content[0]); return *this;}
|
||||
if (other.size() == 2) {insert(other.pim_index[0].key, other.pim_content[0]); insert(other.pim_index[1].key, other.pim_content[1]); return *this;}
|
||||
for (int i = 0; i < other.pim_index.size_s(); ++i)
|
||||
for (int i = 0; i < other.pim_index.size_s(); ++i) {
|
||||
insert(other.pim_index[i].key, other.pim_content[other.pim_index[i].index]);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user