Merge unordered and hash.

Improved Codegear support in unordered.
Another warning suppression in hash.


[SVN r58223]
This commit is contained in:
Daniel James
2009-12-07 19:26:26 +00:00
parent 144d8963a3
commit 02bf8f288e
13 changed files with 265 additions and 86 deletions

View File

@@ -38,16 +38,16 @@
namespace boost
{
template <class Key, class T, class Hash, class Pred, class Alloc>
template <class K, class T, class H, class P, class A>
class unordered_map
{
public:
typedef Key key_type;
typedef std::pair<const Key, T> value_type;
typedef K key_type;
typedef std::pair<const K, T> value_type;
typedef T mapped_type;
typedef Hash hasher;
typedef Pred key_equal;
typedef Alloc allocator_type;
typedef H hasher;
typedef P key_equal;
typedef A allocator_type;
#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582)
private:
@@ -58,7 +58,7 @@ namespace boost
allocator_type, value_type>::type
value_allocator;
typedef boost::unordered_detail::map<Key, Hash, Pred,
typedef boost::unordered_detail::map<K, H, P,
value_allocator> types;
typedef BOOST_DEDUCED_TYPENAME types::impl table;
@@ -177,7 +177,7 @@ namespace boost
}
#else
unordered_map(boost::unordered_detail::move_from<
unordered_map<Key, T, Hash, Pred, Alloc>
unordered_map<K, T, H, P, A>
> other)
: table_(other.source.table_, boost::unordered_detail::move_tag())
{
@@ -284,6 +284,7 @@ namespace boost
}
#else
#if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x5100))
std::pair<iterator, bool> emplace(value_type const& v = value_type())
{
return boost::unordered_detail::pair_cast<iterator, bool>(
@@ -294,6 +295,7 @@ namespace boost
{
return iterator(table_.emplace(v).first);
}
#endif
#define BOOST_UNORDERED_EMPLACE(z, n, _) \
template < \
@@ -511,9 +513,9 @@ namespace boost
}
#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582)
friend bool operator==<Key, T, Hash, Pred, Alloc>(
friend bool operator==<K, T, H, P, A>(
unordered_map const&, unordered_map const&);
friend bool operator!=<Key, T, Hash, Pred, Alloc>(
friend bool operator!=<K, T, H, P, A>(
unordered_map const&, unordered_map const&);
#endif
}; // class template unordered_map
@@ -522,6 +524,9 @@ namespace boost
inline bool operator==(unordered_map<K, T, H, P, A> const& m1,
unordered_map<K, T, H, P, A> const& m2)
{
#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613))
struct dummy { unordered_map<K,T,H,P,A> x; };
#endif
return m1.table_.equals(m2.table_);
}
@@ -529,6 +534,9 @@ namespace boost
inline bool operator!=(unordered_map<K, T, H, P, A> const& m1,
unordered_map<K, T, H, P, A> const& m2)
{
#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613))
struct dummy { unordered_map<K,T,H,P,A> x; };
#endif
return !m1.table_.equals(m2.table_);
}
@@ -536,20 +544,23 @@ namespace boost
inline void swap(unordered_map<K, T, H, P, A> &m1,
unordered_map<K, T, H, P, A> &m2)
{
#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613))
struct dummy { unordered_map<K,T,H,P,A> x; };
#endif
m1.swap(m2);
}
template <class Key, class T, class Hash, class Pred, class Alloc>
template <class K, class T, class H, class P, class A>
class unordered_multimap
{
public:
typedef Key key_type;
typedef std::pair<const Key, T> value_type;
typedef K key_type;
typedef std::pair<const K, T> value_type;
typedef T mapped_type;
typedef Hash hasher;
typedef Pred key_equal;
typedef Alloc allocator_type;
typedef H hasher;
typedef P key_equal;
typedef A allocator_type;
#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582)
private:
@@ -560,7 +571,7 @@ namespace boost
allocator_type, value_type>::type
value_allocator;
typedef boost::unordered_detail::multimap<Key, Hash, Pred,
typedef boost::unordered_detail::multimap<K, H, P,
value_allocator> types;
typedef BOOST_DEDUCED_TYPENAME types::impl table;
@@ -680,7 +691,7 @@ namespace boost
}
#else
unordered_multimap(boost::unordered_detail::move_from<
unordered_multimap<Key, T, Hash, Pred, Alloc>
unordered_multimap<K, T, H, P, A>
> other)
: table_(other.source.table_, boost::unordered_detail::move_tag())
{
@@ -786,6 +797,7 @@ namespace boost
}
#else
#if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x5100))
iterator emplace(value_type const& v = value_type())
{
return iterator(table_.emplace(v));
@@ -796,7 +808,7 @@ namespace boost
{
return iterator(table_.emplace(v));
}
#endif
#define BOOST_UNORDERED_EMPLACE(z, n, _) \
template < \
@@ -999,9 +1011,9 @@ namespace boost
}
#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582)
friend bool operator==<Key, T, Hash, Pred, Alloc>(
friend bool operator==<K, T, H, P, A>(
unordered_multimap const&, unordered_multimap const&);
friend bool operator!=<Key, T, Hash, Pred, Alloc>(
friend bool operator!=<K, T, H, P, A>(
unordered_multimap const&, unordered_multimap const&);
#endif
}; // class template unordered_multimap
@@ -1010,6 +1022,9 @@ namespace boost
inline bool operator==(unordered_multimap<K, T, H, P, A> const& m1,
unordered_multimap<K, T, H, P, A> const& m2)
{
#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613))
struct dummy { unordered_multimap<K,T,H,P,A> x; };
#endif
return m1.table_.equals(m2.table_);
}
@@ -1017,6 +1032,9 @@ namespace boost
inline bool operator!=(unordered_multimap<K, T, H, P, A> const& m1,
unordered_multimap<K, T, H, P, A> const& m2)
{
#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613))
struct dummy { unordered_multimap<K,T,H,P,A> x; };
#endif
return !m1.table_.equals(m2.table_);
}
@@ -1024,6 +1042,9 @@ namespace boost
inline void swap(unordered_multimap<K, T, H, P, A> &m1,
unordered_multimap<K, T, H, P, A> &m2)
{
#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613))
struct dummy { unordered_multimap<K,T,H,P,A> x; };
#endif
m1.swap(m2);
}