Merge branch 'develop'

This commit is contained in:
Daniel James
2014-03-25 22:05:25 +00:00
5 changed files with 63 additions and 6 deletions

View File

@ -54,14 +54,14 @@ order to work with non-C++11 compilers and libraries.
class Key, class Mapped,
class Hash = ``[classref boost::hash]``<Key>,
class Pred = std::equal_to<Key>,
class Alloc = std::allocator<Key> >
class Alloc = std::allocator<std::pair<Key const, Mapped> > >
class ``[classref boost::unordered_map unordered_map]``;
template<
class Key, class Mapped,
class Hash = ``[classref boost::hash]``<Key>,
class Pred = std::equal_to<Key>,
class Alloc = std::allocator<Key> >
class Alloc = std::allocator<std::pair<Key const, Mapped> > >
class ``[classref boost::unordered_multimap unordered_multimap]``;
}

View File

@ -666,11 +666,51 @@ namespace boost { namespace unordered { namespace detail {
typedef mix64_policy<std::size_t> type;
};
template <typename T>
struct pick_policy :
pick_policy_impl<
std::numeric_limits<std::size_t>::digits,
std::numeric_limits<std::size_t>::radix> {};
// While the mix policy is generally faster, the prime policy is a lot
// faster when a large number consecutive integers are used, because
// there are no collisions. Since that is probably quite common, use
// prime policy for integeral types. But not the smaller ones, as they
// don't have enough unique values for this to be an issue.
template <>
struct pick_policy<int> {
typedef prime_policy<std::size_t> type;
};
template <>
struct pick_policy<unsigned int> {
typedef prime_policy<std::size_t> type;
};
template <>
struct pick_policy<long> {
typedef prime_policy<std::size_t> type;
};
template <>
struct pick_policy<unsigned long> {
typedef prime_policy<std::size_t> type;
};
// TODO: Maybe not if std::size_t is smaller than long long.
#if !defined(BOOST_NO_LONG_LONG)
template <>
struct pick_policy<long long> {
typedef prime_policy<std::size_t> type;
};
template <>
struct pick_policy<unsigned long long> {
typedef prime_policy<std::size_t> type;
};
#endif
////////////////////////////////////////////////////////////////////////////
// Functions

View File

@ -146,7 +146,7 @@ namespace boost { namespace unordered { namespace detail {
typedef boost::unordered::detail::grouped_table_impl<types> table;
typedef boost::unordered::detail::set_extractor<value_type> extractor;
typedef boost::unordered::detail::pick_policy::type policy;
typedef typename boost::unordered::detail::pick_policy<T>::type policy;
};
template <typename A, typename K, typename M, typename H, typename P>
@ -171,7 +171,7 @@ namespace boost { namespace unordered { namespace detail {
typedef boost::unordered::detail::map_extractor<key_type, value_type>
extractor;
typedef boost::unordered::detail::pick_policy::type policy;
typedef typename boost::unordered::detail::pick_policy<K>::type policy;
};
template <typename Types>

View File

@ -139,7 +139,7 @@ namespace boost { namespace unordered { namespace detail {
typedef boost::unordered::detail::table_impl<types> table;
typedef boost::unordered::detail::set_extractor<value_type> extractor;
typedef boost::unordered::detail::pick_policy::type policy;
typedef typename boost::unordered::detail::pick_policy<T>::type policy;
};
template <typename A, typename K, typename M, typename H, typename P>
@ -164,7 +164,7 @@ namespace boost { namespace unordered { namespace detail {
typedef boost::unordered::detail::map_extractor<key_type, value_type>
extractor;
typedef boost::unordered::detail::pick_policy::type policy;
typedef typename boost::unordered::detail::pick_policy<K>::type policy;
};
template <typename Types>

17
meta/libraries.json Normal file
View File

@ -0,0 +1,17 @@
{
"key": "unordered",
"boost-version": "1.36.0",
"name": "Unordered",
"authors": [
"Daniel James"
],
"maintainers": [
"Daniel James <dnljms -at- gmail.com>"
],
"description": "Unordered associative containers.",
"std-proposal": false,
"std-tr1": true,
"category": [
"Containers"
]
}