From af4a77fa746ff9ab6bb69d2fccc914b157ef57ed Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 14 Feb 2016 14:44:39 +0000 Subject: [PATCH 1/4] Added test for finding a key less than existing keys. --- test/test_map.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/test_map.cpp b/test/test_map.cpp index c18a2351..51abfaa4 100644 --- a/test/test_map.cpp +++ b/test/test_map.cpp @@ -807,6 +807,9 @@ namespace it = data.find("A"); CHECK_EQUAL(data.end(), it); + + it = data.find("!"); + CHECK_EQUAL(data.end(), it); } //************************************************************************* @@ -819,6 +822,9 @@ namespace it = data.find("A"); CHECK_EQUAL(data.end(), it); + + it = data.find("!"); + CHECK_EQUAL(data.end(), it); } //************************************************************************* From 5cc23a6fcbec48c3409d6fb897756074cbf2f747 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 14 Feb 2016 15:02:03 +0000 Subject: [PATCH 2/4] Change key compare to use key_compare and not == --- iflat_map.h | 4 ++-- iflat_multimap.h | 4 ++-- iflat_multiset.h | 12 ++++++------ iflat_set.h | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/iflat_map.h b/iflat_map.h index 8b55541e..5a1bc337 100644 --- a/iflat_map.h +++ b/iflat_map.h @@ -409,7 +409,7 @@ namespace etl if (itr != end()) { - if (itr->first == key) + if (!key_compare()(itr->first, key) && !key_compare()(key, itr->first)) { return itr; } @@ -433,7 +433,7 @@ namespace etl if (itr != end()) { - if (itr->first == key) + if (!key_compare()(itr->first, key) && !key_compare()(key, itr->first)) { return itr; } diff --git a/iflat_multimap.h b/iflat_multimap.h index b7a18016..644f505b 100644 --- a/iflat_multimap.h +++ b/iflat_multimap.h @@ -354,7 +354,7 @@ namespace etl if (itr != end()) { - if (itr->first == key) + if (!key_compare()(itr->first, key) && !key_compare()(key, itr->first)) { return itr; } @@ -378,7 +378,7 @@ namespace etl if (itr != end()) { - if (itr->first == key) + if (!key_compare()(itr->first, key) && !key_compare()(key, itr->first)) { return itr; } diff --git a/iflat_multiset.h b/iflat_multiset.h index 5760583d..0f4f7efa 100644 --- a/iflat_multiset.h +++ b/iflat_multiset.h @@ -331,13 +331,13 @@ namespace etl if (itr != end()) { - if (*itr != key) + if (!key_compare()(*itr, key) && !key_compare()(key, *itr)) { - return end(); + return itr; } else { - return itr; + return end(); } } @@ -355,13 +355,13 @@ namespace etl if (itr != end()) { - if (*itr != key) + if (!key_compare()(*itr, key) && !key_compare()(key, *itr)) { - return end(); + return itr; } else { - return itr; + return end(); } } diff --git a/iflat_set.h b/iflat_set.h index b656eb33..b39d5ab9 100644 --- a/iflat_set.h +++ b/iflat_set.h @@ -338,7 +338,7 @@ namespace etl if (itr != end()) { - if (*itr == key) + if (!key_compare()(*itr, key) && !key_compare()(key, *itr)) { return itr; } @@ -362,7 +362,7 @@ namespace etl if (itr != end()) { - if (*itr == key) + if (!key_compare()(*itr, key) && !key_compare()(key, *itr)) { return itr; } From 6a9f10b0146b3192cd3e62e3309b17fc1d5d42f8 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 14 Feb 2016 15:02:32 +0000 Subject: [PATCH 3/4] Modified ETL_FILE number from 21 to 22 --- intrusive_links.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intrusive_links.h b/intrusive_links.h index d59d81fe..2f4f4e5f 100644 --- a/intrusive_links.h +++ b/intrusive_links.h @@ -39,7 +39,7 @@ SOFTWARE. #include "error_handler.h" #undef ETL_FILE -#define ETL_FILE "21" +#define ETL_FILE "22" //***************************************************************************** // Note: From a77950fb6dfd08541a1e043124339a71369a57f4 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Mon, 15 Feb 2016 21:25:39 +0000 Subject: [PATCH 4/4] Fixed issue where begin returned a malformed iterator. --- iunordered_map.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/iunordered_map.h b/iunordered_map.h index 09d0496f..b2a9e0d4 100644 --- a/iunordered_map.h +++ b/iunordered_map.h @@ -480,7 +480,7 @@ namespace etl //********************************************************************* iterator begin() { - return iterator(pbuckets->end(), first, last->begin()); + return iterator(pbuckets->end(), first, first->begin()); } //********************************************************************* @@ -489,7 +489,7 @@ namespace etl //********************************************************************* const_iterator begin() const { - return const_iterator(pbuckets->end(), first, last->begin()); + return const_iterator(pbuckets->end(), first, first->begin()); } //********************************************************************* @@ -498,7 +498,7 @@ namespace etl //********************************************************************* const_iterator cbegin() const { - return const_iterator(pbuckets->end(), first, last->begin()); + return const_iterator(pbuckets->end(), first, first->begin()); } //*********************************************************************