Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
virtual ~WholeSpaceMemIterator() { }
int seek_to_first() {
- if (db->db.size() == 0) {
+ if (db->db.empty()) {
it = db->db.end();
ready = false;
return 0;
int seek_to_first(const string &prefix) {
it = db->db.lower_bound(make_pair(prefix, ""));
- if ((db->db.size() == 0) || (it == db->db.end())) {
+ if (db->db.empty() || (it == db->db.end())) {
it = db->db.end();
ready = false;
return 0;
int seek_to_last() {
it = db->db.end();
- if (db->db.size() == 0) {
+ if (db->db.empty()) {
ready = false;
return 0;
}
tmp.append(1, (char) 0);
it = db->db.upper_bound(make_pair(tmp,""));
- if ((db->db.size() == 0) || (it == db->db.end())) {
+ if (db->db.empty() || (it == db->db.end())) {
seek_to_last();
}
else {