Implemented unique associative containers' equal_range using lower_bound_range which is more efficient with heavy comparison functions.

Updated benchmark to avoid measuring redundant operations in searches.
This commit is contained in:
Ion Gaztañaga
2014-01-20 13:20:02 +01:00
parent abc50c7275
commit a4b839628a
6 changed files with 90 additions and 36 deletions
+2 -2
View File
@@ -857,13 +857,13 @@ class flat_map
//!
//! <b>Complexity</b>: Logarithmic
std::pair<iterator,iterator> equal_range(const key_type& x)
{ return container_detail::force_copy<std::pair<iterator,iterator> >(m_flat_tree.equal_range(x)); }
{ return container_detail::force_copy<std::pair<iterator,iterator> >(m_flat_tree.lower_bound_range(x)); }
//! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
//!
//! <b>Complexity</b>: Logarithmic
std::pair<const_iterator,const_iterator> equal_range(const key_type& x) const
{ return container_detail::force_copy<std::pair<const_iterator,const_iterator> >(m_flat_tree.equal_range(x)); }
{ return container_detail::force_copy<std::pair<const_iterator,const_iterator> >(m_flat_tree.lower_bound_range(x)); }
//! <b>Effects</b>: Returns true if x and y are equal
//!