diff --git a/include/tsl/robin_hash.h b/include/tsl/robin_hash.h index 9dccd74..85b3e2a 100644 --- a/include/tsl/robin_hash.h +++ b/include/tsl/robin_hash.h @@ -667,7 +667,7 @@ class robin_hash: private Hash, private KeyEqual, private GrowthPolicy { } template - iterator insert(const_iterator hint, P&& value) { + iterator insert_hint(const_iterator hint, P&& value) { if(hint != cend() && compare_keys(KeySelect()(*hint), KeySelect()(value))) { return mutable_iterator(hint); } @@ -726,7 +726,7 @@ class robin_hash: private Hash, private KeyEqual, private GrowthPolicy { template iterator emplace_hint(const_iterator hint, Args&&... args) { - return insert(hint, value_type(std::forward(args)...)); + return insert_hint(hint, value_type(std::forward(args)...)); } @@ -739,7 +739,7 @@ class robin_hash: private Hash, private KeyEqual, private GrowthPolicy { } template - iterator try_emplace(const_iterator hint, K&& key, Args&&... args) { + iterator try_emplace_hint(const_iterator hint, K&& key, Args&&... args) { if(hint != cend() && compare_keys(KeySelect()(*hint), key)) { return mutable_iterator(hint); } diff --git a/include/tsl/robin_map.h b/include/tsl/robin_map.h index 5958e70..05c6dce 100644 --- a/include/tsl/robin_map.h +++ b/include/tsl/robin_map.h @@ -260,7 +260,7 @@ class robin_map { iterator insert(const_iterator hint, const value_type& value) { - return m_ht.insert(hint, value); + return m_ht.insert_hint(hint, value); } template::value>::type* = nullptr> @@ -269,7 +269,7 @@ class robin_map { } iterator insert(const_iterator hint, value_type&& value) { - return m_ht.insert(hint, std::move(value)); + return m_ht.insert_hint(hint, std::move(value)); } @@ -346,12 +346,12 @@ class robin_map { template iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args) { - return m_ht.try_emplace(hint, k, std::forward(args)...); + return m_ht.try_emplace_hint(hint, k, std::forward(args)...); } template iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args) { - return m_ht.try_emplace(hint, std::move(k), std::forward(args)...); + return m_ht.try_emplace_hint(hint, std::move(k), std::forward(args)...); } diff --git a/include/tsl/robin_set.h b/include/tsl/robin_set.h index 4e4667e..219a33e 100644 --- a/include/tsl/robin_set.h +++ b/include/tsl/robin_set.h @@ -240,11 +240,11 @@ class robin_set { } iterator insert(const_iterator hint, const value_type& value) { - return m_ht.insert(hint, value); + return m_ht.insert_hint(hint, value); } iterator insert(const_iterator hint, value_type&& value) { - return m_ht.insert(hint, std::move(value)); + return m_ht.insert_hint(hint, std::move(value)); } template diff --git a/tests/robin_map_tests.cpp b/tests/robin_map_tests.cpp index e5ba57e..6367b6c 100644 --- a/tests/robin_map_tests.cpp +++ b/tests/robin_map_tests.cpp @@ -641,6 +641,13 @@ BOOST_AUTO_TEST_CASE(test_extreme_bucket_count_value_construction) { (std::numeric_limits::max())), std::length_error); } +BOOST_AUTO_TEST_CASE(test_range_construct) { + tsl::robin_map map = {{2, 1}, {1, 0}, {3, 2}}; + + tsl::robin_map map2(map.begin(), map.end()); + tsl::robin_map map3(map.cbegin(), map.cend()); +} + /** * operator=(std::initializer_list)