diff --git a/doc/intro.qbk b/doc/intro.qbk index 257b959a..72c93b66 100644 --- a/doc/intro.qbk +++ b/doc/intro.qbk @@ -54,14 +54,14 @@ order to work with non-C++11 compilers and libraries. class Key, class Mapped, class Hash = ``[classref boost::hash]``, class Pred = std::equal_to, - class Alloc = std::allocator > + class Alloc = std::allocator > > class ``[classref boost::unordered_map unordered_map]``; template< class Key, class Mapped, class Hash = ``[classref boost::hash]``, class Pred = std::equal_to, - class Alloc = std::allocator > + class Alloc = std::allocator > > class ``[classref boost::unordered_multimap unordered_multimap]``; } diff --git a/include/boost/unordered/detail/buckets.hpp b/include/boost/unordered/detail/buckets.hpp index 38c32f5a..6ad3808b 100644 --- a/include/boost/unordered/detail/buckets.hpp +++ b/include/boost/unordered/detail/buckets.hpp @@ -666,11 +666,51 @@ namespace boost { namespace unordered { namespace detail { typedef mix64_policy type; }; + template struct pick_policy : pick_policy_impl< std::numeric_limits::digits, std::numeric_limits::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 { + typedef prime_policy type; + }; + + template <> + struct pick_policy { + typedef prime_policy type; + }; + + template <> + struct pick_policy { + typedef prime_policy type; + }; + + template <> + struct pick_policy { + typedef prime_policy type; + }; + + // TODO: Maybe not if std::size_t is smaller than long long. +#if !defined(BOOST_NO_LONG_LONG) + template <> + struct pick_policy { + typedef prime_policy type; + }; + + template <> + struct pick_policy { + typedef prime_policy type; + }; +#endif + //////////////////////////////////////////////////////////////////////////// // Functions diff --git a/include/boost/unordered/detail/equivalent.hpp b/include/boost/unordered/detail/equivalent.hpp index ab175313..d5538d73 100644 --- a/include/boost/unordered/detail/equivalent.hpp +++ b/include/boost/unordered/detail/equivalent.hpp @@ -146,7 +146,7 @@ namespace boost { namespace unordered { namespace detail { typedef boost::unordered::detail::grouped_table_impl table; typedef boost::unordered::detail::set_extractor extractor; - typedef boost::unordered::detail::pick_policy::type policy; + typedef typename boost::unordered::detail::pick_policy::type policy; }; template @@ -171,7 +171,7 @@ namespace boost { namespace unordered { namespace detail { typedef boost::unordered::detail::map_extractor extractor; - typedef boost::unordered::detail::pick_policy::type policy; + typedef typename boost::unordered::detail::pick_policy::type policy; }; template diff --git a/include/boost/unordered/detail/unique.hpp b/include/boost/unordered/detail/unique.hpp index 88bbf0b6..5fd5a46d 100644 --- a/include/boost/unordered/detail/unique.hpp +++ b/include/boost/unordered/detail/unique.hpp @@ -139,7 +139,7 @@ namespace boost { namespace unordered { namespace detail { typedef boost::unordered::detail::table_impl table; typedef boost::unordered::detail::set_extractor extractor; - typedef boost::unordered::detail::pick_policy::type policy; + typedef typename boost::unordered::detail::pick_policy::type policy; }; template @@ -164,7 +164,7 @@ namespace boost { namespace unordered { namespace detail { typedef boost::unordered::detail::map_extractor extractor; - typedef boost::unordered::detail::pick_policy::type policy; + typedef typename boost::unordered::detail::pick_policy::type policy; }; template diff --git a/meta/libraries.json b/meta/libraries.json new file mode 100644 index 00000000..3e5f0bdc --- /dev/null +++ b/meta/libraries.json @@ -0,0 +1,17 @@ +{ + "key": "unordered", + "boost-version": "1.36.0", + "name": "Unordered", + "authors": [ + "Daniel James" + ], + "maintainers": [ + "Daniel James " + ], + "description": "Unordered associative containers.", + "std-proposal": false, + "std-tr1": true, + "category": [ + "Containers" + ] +} \ No newline at end of file