A couple of bug fixes for unordered containers.

Merged revisions 57005-57006 via svnmerge from 
https://svn.boost.org/svn/boost/trunk

........
  r57005 | danieljames | 2009-10-19 20:24:33 +0100 (Mon, 19 Oct 2009) | 6 lines
  
  Use normal emplace implementation for emplace_hint and insert with hint.
  
  There's a bug in the emplace_hint implementation for unordered
  containers with equivalent keys. Since my tests missed it, I'm just
  going to use the normal emplace implementation until I write better
  tests.
........
  r57006 | danieljames | 2009-10-19 20:32:09 +0100 (Mon, 19 Oct 2009) | 1 line
  
  Fix allocator for construct from initializer list.
........


[SVN r57027]
This commit is contained in:
Daniel James
2009-10-20 23:05:28 +00:00
parent 14e09a5456
commit 584eaad67a
5 changed files with 77 additions and 95 deletions

View File

@@ -199,7 +199,7 @@ namespace boost
const allocator_type &a = allocator_type())
: table_(boost::unordered_detail::initial_size(
list.begin(), list.end(), n),
hf, eql, allocator_type())
hf, eql, a)
{
table_.insert_range(list.begin(), list.end());
}
@@ -311,7 +311,7 @@ namespace boost
template < \
BOOST_UNORDERED_TEMPLATE_ARGS(z, n) \
> \
iterator emplace_hint(const_iterator hint, \
iterator emplace_hint(const_iterator, \
BOOST_UNORDERED_FUNCTION_PARAMS(z, n) \
) \
{ \
@@ -332,7 +332,7 @@ namespace boost
table_.emplace(obj));
}
iterator insert(const_iterator hint, const value_type& obj)
iterator insert(const_iterator, const value_type& obj)
{
return iterator(table_.emplace(obj).first);
}
@@ -699,7 +699,7 @@ namespace boost
const allocator_type &a = allocator_type())
: table_(boost::unordered_detail::initial_size(
list.begin(), list.end(), n),
hf, eql, allocator_type())
hf, eql, a)
{
table_.insert_range(list.begin(), list.end());
}
@@ -776,10 +776,9 @@ namespace boost
}
template <class... Args>
iterator emplace_hint(const_iterator hint, Args&&... args)
iterator emplace_hint(const_iterator, Args&&... args)
{
return iterator(table_.emplace_hint(get(hint),
std::forward<Args>(args)...));
return iterator(table_.emplace(std::forward<Args>(args)...));
}
#else
@@ -788,10 +787,10 @@ namespace boost
return iterator(table_.emplace(v));
}
iterator emplace_hint(const_iterator hint,
iterator emplace_hint(const_iterator,
value_type const& v = value_type())
{
return iterator(table_.emplace_hint(get(hint), v));
return iterator(table_.emplace(v));
}
@@ -812,11 +811,11 @@ namespace boost
template < \
BOOST_UNORDERED_TEMPLATE_ARGS(z, n) \
> \
iterator emplace_hint(const_iterator hint, \
iterator emplace_hint(const_iterator, \
BOOST_UNORDERED_FUNCTION_PARAMS(z, n) \
) \
{ \
return iterator(table_.emplace_hint(get(hint), \
return iterator(table_.emplace( \
BOOST_UNORDERED_CALL_PARAMS(z, n) \
)); \
}
@@ -833,9 +832,9 @@ namespace boost
return iterator(table_.emplace(obj));
}
iterator insert(const_iterator hint, const value_type& obj)
iterator insert(const_iterator, const value_type& obj)
{
return iterator(table_.emplace_hint(get(hint), obj));
return iterator(table_.emplace(obj));
}
template <class InputIt>