mirror of
https://github.com/boostorg/unordered.git
synced 2026-08-10 07:31:17 +02:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20c13e346e |
@@ -1,23 +0,0 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# This file was automatically generated from the original CMakeLists.txt file
|
||||
# Add a variable to hold the headers for the library
|
||||
set (lib_headers
|
||||
unordered_map.hpp
|
||||
unordered_set.hpp
|
||||
unordered
|
||||
)
|
||||
|
||||
# Add a library target to the build system
|
||||
boost_library_project(
|
||||
unordered
|
||||
# SRCDIRS
|
||||
# TESTDIRS
|
||||
HEADERS ${lib_headers}
|
||||
# DOCDIRS
|
||||
# DESCRIPTION
|
||||
MODULARIZED
|
||||
# AUTHORS
|
||||
# MAINTAINERS
|
||||
)
|
||||
|
||||
|
||||
+12
-4
@@ -8,11 +8,11 @@ path-constant admonishment_location : ../../../../doc/src/images ;
|
||||
|
||||
xml unordered : unordered.qbk ;
|
||||
boostbook standalone : unordered :
|
||||
<xsl:param>html.stylesheet=../../../../doc/html/boostbook.css
|
||||
<xsl:param>admon.graphics.path=images/
|
||||
<xsl:param>navig.graphics.path=images/
|
||||
<xsl:param>html.stylesheet=boostbook.css
|
||||
<xsl:param>boost.root=../../../..
|
||||
<xsl:param>boost.libraries=../../../libraries.htm
|
||||
<xsl:param>navig.graphics=1
|
||||
|
||||
<xsl:param>chunk.first.sections=1
|
||||
<xsl:param>chunk.section.depth=2
|
||||
<xsl:param>generate.section.toc.level=2
|
||||
@@ -23,6 +23,9 @@ boostbook standalone : unordered :
|
||||
<xsl:param>boost.compact.function=0
|
||||
<xsl:param>boost.compact.enum=0
|
||||
|
||||
<dependency>css
|
||||
<dependency>images
|
||||
|
||||
# PDF Options:
|
||||
# TOC Generation: this is needed for FOP-0.9 and later:
|
||||
<xsl:param>fop1.extensions=0
|
||||
@@ -48,6 +51,11 @@ boostbook standalone : unordered :
|
||||
<format>pdf:<xsl:param>img.src.path=$(images_location)/
|
||||
#<format>pdf:<xsl:param>admon.graphics.path=$(admonishment_location)
|
||||
<format>pdf:<xsl:param>draft.mode="no"
|
||||
<format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/libs/unordered/doc/html
|
||||
;
|
||||
|
||||
install css : [ glob $(BOOST_ROOT)/doc/src/*.css ]
|
||||
: <location>html ;
|
||||
install images : [ glob $(BOOST_ROOT)/doc/src/images/*.png ]
|
||||
: <location>html/images ;
|
||||
explicit css ;
|
||||
explicit images ;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Copyright Daniel James 2008-2009
|
||||
Copyright Daniel James 2008
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
-->
|
||||
|
||||
@@ -42,32 +42,4 @@ First official release.
|
||||
* Move all the implementation inside `boost/unordered`, to assist
|
||||
modularization and hopefully make it easier to track changes in subversion.
|
||||
|
||||
[h2 Boost 1.38.0]
|
||||
|
||||
* Use [@boost:/libs/utility/swap.html `boost::swap`].
|
||||
* [@https://svn.boost.org/trac/boost/ticket/2237 Ticket 2237]:
|
||||
Document that the equality and inequality operators are undefined for two
|
||||
objects if their equality predicates aren't equivalent. Thanks to Daniel
|
||||
Krügler.
|
||||
* [@https://svn.boost.org/trac/boost/ticket/1710 Ticket 1710]:
|
||||
Use a larger prime number list. Thanks to Thorsten Ottosen and Hervé
|
||||
Brönnimann.
|
||||
* Use
|
||||
[@boost:/libs/type_traits/doc/html/boost_typetraits/category/alignment.html
|
||||
aligned storage] to store the types. This changes the way the allocator is
|
||||
used to construct nodes. It used to construct the node with two calls to
|
||||
the allocator's `construct` method - once for the pointers and once for the
|
||||
value. It now constructs the node with a single call to construct and
|
||||
then constructs the value using in place construction.
|
||||
* Add support for C++0x initializer lists where they're available (currently
|
||||
only g++ 4.4 in C++0x mode).
|
||||
|
||||
[h2 Boost 1.39.0]
|
||||
|
||||
* [@https://svn.boost.org/trac/boost/ticket/2756 Ticket 2756]: Avoid a warning
|
||||
on Visual C++ 2009.
|
||||
* Some other minor internal changes to the implementation, tests and
|
||||
documentation.
|
||||
* Avoid an unnecessary copy in `operator[]`.
|
||||
|
||||
[endsect]
|
||||
|
||||
+2
-12
@@ -23,7 +23,7 @@ but not the equality predicate. For example, if you wanted to use the
|
||||
[import src_code/dictionary.cpp]
|
||||
[case_sensitive_dictionary_fnv]
|
||||
|
||||
There is an [@boost:/libs/unordered/examples/fnv1.hpp implementation
|
||||
There is an [@../../libs/unordered/examples/fnv1.hpp implementation
|
||||
of FNV-1] in the examples directory.
|
||||
|
||||
If you wish to use a different equality function,
|
||||
@@ -38,19 +38,9 @@ Which you can then use in a case insensitive dictionary:
|
||||
[case_insensitive_dictionary]
|
||||
|
||||
This is a simplified version of the example at
|
||||
[@boost:/libs/unordered/examples/case_insensitive.hpp /libs/unordered/examples/case_insensitive.hpp]
|
||||
[@../../libs/unordered/examples/case_insensitive.hpp /libs/unordered/examples/case_insensitive.hpp]
|
||||
which supports other locales and string types.
|
||||
|
||||
[caution
|
||||
Be careful when using the equality (`==`) operator with custom equality
|
||||
predicates, especially if you're using a function pointer. If you compare two
|
||||
containers with different equality predicates then the result is undefined.
|
||||
For most stateless function objects this is impossible - since you can only
|
||||
compare objects with the same equality predicate you know the equality
|
||||
predicates must be equal. But if you're using function pointers or a stateful
|
||||
equality predicate (e.g. boost::function) then you can get into trouble.
|
||||
]
|
||||
|
||||
[h2 Custom Types]
|
||||
|
||||
Similarly, a custom hash function can be used for custom types:
|
||||
|
||||
+21
-37
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Copyright Daniel James 2006-2009
|
||||
Copyright Daniel James 2006-2008
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
--><library-reference>
|
||||
@@ -19,12 +19,12 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
<default><type>std::allocator<Value></type></default>
|
||||
</template-type-parameter>
|
||||
</template>
|
||||
<purpose><simpara>
|
||||
<purpose>
|
||||
An unordered associative container that stores unique values.
|
||||
</simpara></purpose>
|
||||
</purpose>
|
||||
<description>
|
||||
<para>For the normative reference see chapter 23 of
|
||||
<ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008-2009/n2691.pdf">the working draft of the C++ standard [n2691].</ulink></para>
|
||||
<ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2691.pdf">the working draft of the C++ standard [n2691].</ulink></para>
|
||||
<para><emphasis role="bold">Template Parameters</emphasis>
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
@@ -69,11 +69,11 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
</typedef>
|
||||
<typedef name="reference">
|
||||
<type>typename allocator_type::reference</type>
|
||||
<purpose><simpara>lvalue of <type>value_type</type>.</simpara></purpose>
|
||||
<purpose>lvalue of <type>value_type</type>.</purpose>
|
||||
</typedef>
|
||||
<typedef name="const_reference">
|
||||
<type>typename allocator_type::const_reference</type>
|
||||
<purpose><simpara>const lvalue of <type>value_type</type>.</simpara></purpose>
|
||||
<purpose>const lvalue of <type>value_type</type>.</purpose>
|
||||
</typedef>
|
||||
<typedef name="size_type">
|
||||
<type><emphasis>implementation-defined</emphasis></type>
|
||||
@@ -678,8 +678,6 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
<type>bool</type>
|
||||
<notes>
|
||||
<para>This is a boost extension.</para>
|
||||
<para>Behavior is undefined if the two containers don't have
|
||||
equivalent equality predicates.</para>
|
||||
</notes>
|
||||
</function>
|
||||
<function name="operator!=">
|
||||
@@ -702,8 +700,6 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
<type>bool</type>
|
||||
<notes>
|
||||
<para>This is a boost extension.</para>
|
||||
<para>Behavior is undefined if the two containers don't have
|
||||
equivalent equality predicates.</para>
|
||||
</notes>
|
||||
</function>
|
||||
</free-function-group>
|
||||
@@ -753,12 +749,12 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
<default><type>std::allocator<Value></type></default>
|
||||
</template-type-parameter>
|
||||
</template>
|
||||
<purpose><simpara>
|
||||
<purpose>
|
||||
An unordered associative container that stores values. The same key can be stored multiple times.
|
||||
</simpara></purpose>
|
||||
</purpose>
|
||||
<description>
|
||||
<para>For the normative reference see chapter 23 of
|
||||
<ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008-2009/n2691.pdf">the working draft of the C++ standard [n2691].</ulink></para>
|
||||
<ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2691.pdf">the working draft of the C++ standard [n2691].</ulink></para>
|
||||
<para><emphasis role="bold">Template Parameters</emphasis>
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
@@ -803,11 +799,11 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
</typedef>
|
||||
<typedef name="reference">
|
||||
<type>typename allocator_type::reference</type>
|
||||
<purpose><simpara>lvalue of <type>value_type</type>.</simpara></purpose>
|
||||
<purpose>lvalue of <type>value_type</type>.</purpose>
|
||||
</typedef>
|
||||
<typedef name="const_reference">
|
||||
<type>typename allocator_type::const_reference</type>
|
||||
<purpose><simpara>const lvalue of <type>value_type</type>.</simpara></purpose>
|
||||
<purpose>const lvalue of <type>value_type</type>.</purpose>
|
||||
</typedef>
|
||||
<typedef name="size_type">
|
||||
<type><emphasis>implementation-defined</emphasis></type>
|
||||
@@ -1410,8 +1406,6 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
<type>bool</type>
|
||||
<notes>
|
||||
<para>This is a boost extension.</para>
|
||||
<para>Behavior is undefined if the two containers don't have
|
||||
equivalent equality predicates.</para>
|
||||
</notes>
|
||||
</function>
|
||||
<function name="operator!=">
|
||||
@@ -1434,8 +1428,6 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
<type>bool</type>
|
||||
<notes>
|
||||
<para>This is a boost extension.</para>
|
||||
<para>Behavior is undefined if the two containers don't have
|
||||
equivalent equality predicates.</para>
|
||||
</notes>
|
||||
</function>
|
||||
</free-function-group>
|
||||
@@ -1491,12 +1483,12 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
<default><type>std::allocator<std::pair<Key const, Mapped> ></type></default>
|
||||
</template-type-parameter>
|
||||
</template>
|
||||
<purpose><simpara>
|
||||
<purpose>
|
||||
An unordered associative container that associates unique keys with another value.
|
||||
</simpara></purpose>
|
||||
</purpose>
|
||||
<description>
|
||||
<para>For the normative reference see chapter 23 of
|
||||
<ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008-2009/n2691.pdf">the working draft of the C++ standard [n2691].</ulink></para>
|
||||
<ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2691.pdf">the working draft of the C++ standard [n2691].</ulink></para>
|
||||
<para><emphasis role="bold">Template Parameters</emphasis>
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
@@ -1547,11 +1539,11 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
</typedef>
|
||||
<typedef name="reference">
|
||||
<type>typename allocator_type::reference</type>
|
||||
<purpose><simpara>lvalue of <type>value_type</type>.</simpara></purpose>
|
||||
<purpose>lvalue of <type>value_type</type>.</purpose>
|
||||
</typedef>
|
||||
<typedef name="const_reference">
|
||||
<type>typename allocator_type::const_reference</type>
|
||||
<purpose><simpara>const lvalue of <type>value_type</type>.</simpara></purpose>
|
||||
<purpose>const lvalue of <type>value_type</type>.</purpose>
|
||||
</typedef>
|
||||
<typedef name="size_type">
|
||||
<type><emphasis>implementation-defined</emphasis></type>
|
||||
@@ -2193,8 +2185,6 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
<type>bool</type>
|
||||
<notes>
|
||||
<para>This is a boost extension.</para>
|
||||
<para>Behavior is undefined if the two containers don't have
|
||||
equivalent equality predicates.</para>
|
||||
</notes>
|
||||
</function>
|
||||
<function name="operator!=">
|
||||
@@ -2219,8 +2209,6 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
<type>bool</type>
|
||||
<notes>
|
||||
<para>This is a boost extension.</para>
|
||||
<para>Behavior is undefined if the two containers don't have
|
||||
equivalent equality predicates.</para>
|
||||
</notes>
|
||||
</function>
|
||||
</free-function-group>
|
||||
@@ -2274,12 +2262,12 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
<default><type>std::allocator<std::pair<Key const, Mapped> ></type></default>
|
||||
</template-type-parameter>
|
||||
</template>
|
||||
<purpose><simpara>
|
||||
<purpose>
|
||||
An unordered associative container that associates keys with another value. The same key can be stored multiple times.
|
||||
</simpara></purpose>
|
||||
</purpose>
|
||||
<description>
|
||||
<para>For the normative reference see chapter 23 of
|
||||
<ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008-2009/n2691.pdf">the working draft of the C++ standard [n2691].</ulink></para>
|
||||
<ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2691.pdf">the working draft of the C++ standard [n2691].</ulink></para>
|
||||
<para><emphasis role="bold">Template Parameters</emphasis>
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
@@ -2330,11 +2318,11 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
</typedef>
|
||||
<typedef name="reference">
|
||||
<type>typename allocator_type::reference</type>
|
||||
<purpose><simpara>lvalue of <type>value_type</type>.</simpara></purpose>
|
||||
<purpose>lvalue of <type>value_type</type>.</purpose>
|
||||
</typedef>
|
||||
<typedef name="const_reference">
|
||||
<type>typename allocator_type::const_reference</type>
|
||||
<purpose><simpara>const lvalue of <type>value_type</type>.</simpara></purpose>
|
||||
<purpose>const lvalue of <type>value_type</type>.</purpose>
|
||||
</typedef>
|
||||
<typedef name="size_type">
|
||||
<type><emphasis>implementation-defined</emphasis></type>
|
||||
@@ -2939,8 +2927,6 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
<type>bool</type>
|
||||
<notes>
|
||||
<para>This is a boost extension.</para>
|
||||
<para>Behavior is undefined if the two containers don't have
|
||||
equivalent equality predicates.</para>
|
||||
</notes>
|
||||
</function>
|
||||
<function name="operator!=">
|
||||
@@ -2965,8 +2951,6 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
<type>bool</type>
|
||||
<notes>
|
||||
<para>This is a boost extension.</para>
|
||||
<para>Behavior is undefined if the two containers don't have
|
||||
equivalent equality predicates.</para>
|
||||
</notes>
|
||||
</function>
|
||||
</free-function-group>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2008-2009 Daniel James.
|
||||
// Copyright 2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// Copyright 2005-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2008-2009 Daniel James.
|
||||
// Copyright 2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
// Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard.
|
||||
// Copyright (C) 2005-2009 Daniel James
|
||||
// Copyright (C) 2005-2008 Daniel James
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -26,12 +26,9 @@
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/unordered/detail/allocator_helpers.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/aligned_storage.hpp>
|
||||
#include <boost/type_traits/alignment_of.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/utility/swap.hpp>
|
||||
|
||||
#include <boost/mpl/aux_/config/eti.hpp>
|
||||
|
||||
@@ -61,6 +58,17 @@ namespace boost {
|
||||
static const std::size_t default_initial_bucket_count = 50;
|
||||
static const float minimum_max_load_factor = 1e-3f;
|
||||
|
||||
template <class T>
|
||||
inline void hash_swap(T& x, T& y)
|
||||
{
|
||||
#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
|
||||
std::swap(x,y);
|
||||
#else
|
||||
using std::swap;
|
||||
swap(x, y);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline std::size_t double_to_size_t(double f)
|
||||
{
|
||||
return f >= static_cast<double>((std::numeric_limits<std::size_t>::max)()) ?
|
||||
@@ -78,16 +86,15 @@ namespace boost {
|
||||
|
||||
template<typename T>
|
||||
std::size_t const prime_list_template<T>::value[] = {
|
||||
5ul, 11ul, 17ul, 29ul, 37ul, 53ul, 67ul, 79ul,
|
||||
97ul, 131ul, 193ul, 257ul, 389ul, 521ul, 769ul,
|
||||
1031ul, 1543ul, 2053ul, 3079ul, 6151ul, 12289ul, 24593ul,
|
||||
53ul, 97ul, 193ul, 389ul, 769ul,
|
||||
1543ul, 3079ul, 6151ul, 12289ul, 24593ul,
|
||||
49157ul, 98317ul, 196613ul, 393241ul, 786433ul,
|
||||
1572869ul, 3145739ul, 6291469ul, 12582917ul, 25165843ul,
|
||||
50331653ul, 100663319ul, 201326611ul, 402653189ul, 805306457ul,
|
||||
1610612741ul, 3221225473ul, 4294967291ul };
|
||||
|
||||
template<typename T>
|
||||
std::ptrdiff_t const prime_list_template<T>::length = 40;
|
||||
std::ptrdiff_t const prime_list_template<T>::length = 28;
|
||||
|
||||
typedef prime_list_template<std::size_t> prime_list;
|
||||
|
||||
@@ -223,16 +230,7 @@ namespace boost {
|
||||
functions func2_;
|
||||
functions_ptr func_; // The currently active functions.
|
||||
};
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# define BOOST_UNORDERED_DESTRUCT(x, type) (x)->~type();
|
||||
#else
|
||||
# define BOOST_UNORDERED_DESTRUCT(x, type) boost::unordered_detail::destroy(x)
|
||||
template <typename T>
|
||||
void destroy(T* x) {
|
||||
x->~T();
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
// Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard.
|
||||
// Copyright (C) 2005-2009 Daniel James
|
||||
// Copyright (C) 2005-2008 Daniel James
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -34,6 +34,7 @@ namespace boost {
|
||||
public:
|
||||
typedef BOOST_UNORDERED_TABLE_DATA data;
|
||||
|
||||
struct node_base;
|
||||
struct node;
|
||||
struct bucket;
|
||||
typedef std::size_t size_type;
|
||||
@@ -44,6 +45,9 @@ namespace boost {
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
boost::unordered_detail::rebind_wrap<Alloc, node>::type
|
||||
node_allocator;
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
boost::unordered_detail::rebind_wrap<Alloc, node_base>::type
|
||||
node_base_allocator;
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
boost::unordered_detail::rebind_wrap<Alloc, bucket>::type
|
||||
bucket_allocator;
|
||||
@@ -84,36 +88,39 @@ namespace boost {
|
||||
}
|
||||
};
|
||||
|
||||
// Value Base
|
||||
|
||||
struct value_base {
|
||||
typename boost::aligned_storage<
|
||||
sizeof(value_type),
|
||||
boost::alignment_of<value_type>::value>::type data_;
|
||||
|
||||
void* address() { return this; }
|
||||
};
|
||||
|
||||
// Hash Node
|
||||
//
|
||||
// all no throw
|
||||
|
||||
struct node : value_base, bucket {
|
||||
struct node_base : bucket
|
||||
{
|
||||
#if BOOST_UNORDERED_EQUIVALENT_KEYS
|
||||
public:
|
||||
node() : group_prev_()
|
||||
node_base() : group_prev_()
|
||||
{
|
||||
BOOST_UNORDERED_MSVC_RESET_PTR(group_prev_);
|
||||
}
|
||||
|
||||
link_ptr group_prev_;
|
||||
#endif
|
||||
|
||||
value_type& value() {
|
||||
return *static_cast<value_type*>(this->address());
|
||||
}
|
||||
};
|
||||
|
||||
struct node : node_base
|
||||
{
|
||||
public:
|
||||
#if defined(BOOST_HAS_RVALUE_REFS) && defined(BOOST_HAS_VARIADIC_TMPL)
|
||||
template <typename... Args>
|
||||
node(Args&&... args)
|
||||
: node_base(), value_(std::forward<Args>(args)...) {}
|
||||
#else
|
||||
node(value_type const& v) : node_base(), value_(v) {}
|
||||
#endif
|
||||
|
||||
value_type value_;
|
||||
};
|
||||
|
||||
#if defined(BOOST_HAS_RVALUE_REFS) && defined(BOOST_HAS_VARIADIC_TMPL)
|
||||
|
||||
// allocators
|
||||
//
|
||||
// Stores all the allocators that we're going to need.
|
||||
@@ -129,17 +136,15 @@ namespace boost {
|
||||
|
||||
void destroy(link_ptr ptr)
|
||||
{
|
||||
node* raw_ptr = static_cast<node*>(&*ptr);
|
||||
BOOST_UNORDERED_DESTRUCT(&raw_ptr->value(), value_type);
|
||||
node_ptr n(node_alloc_.address(*raw_ptr));
|
||||
node_ptr n(node_alloc_.address(*static_cast<node*>(&*ptr)));
|
||||
node_alloc_.destroy(n);
|
||||
node_alloc_.deallocate(n, 1);
|
||||
}
|
||||
|
||||
void swap(allocators& x)
|
||||
{
|
||||
boost::swap(node_alloc_, x.node_alloc_);
|
||||
boost::swap(bucket_alloc_, x.bucket_alloc_);
|
||||
unordered_detail::hash_swap(node_alloc_, x.node_alloc_);
|
||||
unordered_detail::hash_swap(bucket_alloc_, x.bucket_alloc_);
|
||||
}
|
||||
|
||||
bool operator==(allocators const& x)
|
||||
@@ -158,76 +163,144 @@ namespace boost {
|
||||
|
||||
node_ptr node_;
|
||||
bool node_constructed_;
|
||||
bool value_constructed_;
|
||||
|
||||
public:
|
||||
|
||||
node_constructor(allocators& a)
|
||||
: allocators_(a),
|
||||
node_(), node_constructed_(false), value_constructed_(false)
|
||||
node_(), node_constructed_(false)
|
||||
{
|
||||
}
|
||||
|
||||
~node_constructor()
|
||||
{
|
||||
if (node_) {
|
||||
if (value_constructed_) {
|
||||
BOOST_UNORDERED_DESTRUCT(&node_->value(), value_type);
|
||||
}
|
||||
|
||||
if (node_constructed_)
|
||||
allocators_.node_alloc_.destroy(node_);
|
||||
allocators_.node_alloc_.deallocate(node_, 1);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(BOOST_HAS_RVALUE_REFS) && defined(BOOST_HAS_VARIADIC_TMPL)
|
||||
template <typename... Args>
|
||||
void construct(Args&&... args)
|
||||
{
|
||||
BOOST_ASSERT(!node_);
|
||||
node_constructed_ = false;
|
||||
value_constructed_ = false;
|
||||
|
||||
node_ = allocators_.node_alloc_.allocate(1);
|
||||
|
||||
allocators_.node_alloc_.construct(node_, node());
|
||||
allocators_.node_alloc_.construct(node_, std::forward<Args>(args)...);
|
||||
node_constructed_ = true;
|
||||
|
||||
new(node_->address()) value_type(std::forward<Args>(args)...);
|
||||
value_constructed_ = true;
|
||||
}
|
||||
|
||||
node_ptr get() const
|
||||
{
|
||||
BOOST_ASSERT(node_);
|
||||
return node_;
|
||||
}
|
||||
|
||||
// no throw
|
||||
link_ptr release()
|
||||
{
|
||||
node_ptr p = node_;
|
||||
unordered_detail::reset(node_);
|
||||
return link_ptr(allocators_.bucket_alloc_.address(*p));
|
||||
}
|
||||
|
||||
private:
|
||||
node_constructor(node_constructor const&);
|
||||
node_constructor& operator=(node_constructor const&);
|
||||
};
|
||||
#else
|
||||
|
||||
// allocators
|
||||
//
|
||||
// Stores all the allocators that we're going to need.
|
||||
|
||||
struct allocators
|
||||
{
|
||||
node_allocator node_alloc_;
|
||||
bucket_allocator bucket_alloc_;
|
||||
value_allocator value_alloc_;
|
||||
node_base_allocator node_base_alloc_;
|
||||
|
||||
allocators(value_allocator const& a)
|
||||
: node_alloc_(a), bucket_alloc_(a),
|
||||
value_alloc_(a), node_base_alloc_(a)
|
||||
{}
|
||||
|
||||
void destroy(link_ptr ptr)
|
||||
{
|
||||
node_ptr n(node_alloc_.address(*static_cast<node*>(&*ptr)));
|
||||
value_alloc_.destroy(value_alloc_.address(n->value_));
|
||||
node_base_alloc_.destroy(node_base_alloc_.address(*n));
|
||||
node_alloc_.deallocate(n, 1);
|
||||
}
|
||||
|
||||
void swap(allocators& x)
|
||||
{
|
||||
unordered_detail::hash_swap(node_alloc_, x.node_alloc_);
|
||||
unordered_detail::hash_swap(bucket_alloc_, x.bucket_alloc_);
|
||||
unordered_detail::hash_swap(value_alloc_, x.value_alloc_);
|
||||
unordered_detail::hash_swap(node_base_alloc_, x.node_base_alloc_);
|
||||
}
|
||||
|
||||
bool operator==(allocators const& x)
|
||||
{
|
||||
return value_alloc_ == x.value_alloc_;
|
||||
}
|
||||
};
|
||||
|
||||
// node_constructor
|
||||
//
|
||||
// Used to construct nodes in an exception safe manner.
|
||||
|
||||
class node_constructor
|
||||
{
|
||||
allocators& allocators_;
|
||||
|
||||
node_ptr node_;
|
||||
bool value_constructed_;
|
||||
bool node_base_constructed_;
|
||||
|
||||
public:
|
||||
|
||||
node_constructor(allocators& a)
|
||||
: allocators_(a),
|
||||
node_(), value_constructed_(false), node_base_constructed_(false)
|
||||
{
|
||||
BOOST_UNORDERED_MSVC_RESET_PTR(node_);
|
||||
}
|
||||
|
||||
~node_constructor()
|
||||
{
|
||||
if (node_) {
|
||||
if (value_constructed_)
|
||||
allocators_.value_alloc_.destroy(
|
||||
allocators_.value_alloc_.address(node_->value_));
|
||||
if (node_base_constructed_)
|
||||
allocators_.node_base_alloc_.destroy(
|
||||
allocators_.node_base_alloc_.address(*node_));
|
||||
|
||||
allocators_.node_alloc_.deallocate(node_, 1);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename V>
|
||||
void construct(V const& v)
|
||||
{
|
||||
BOOST_ASSERT(!node_);
|
||||
node_constructed_ = false;
|
||||
value_constructed_ = false;
|
||||
node_base_constructed_ = false;
|
||||
|
||||
node_ = allocators_.node_alloc_.allocate(1);
|
||||
|
||||
allocators_.node_alloc_.construct(node_, node());
|
||||
node_constructed_ = true;
|
||||
allocators_.node_base_alloc_.construct(
|
||||
allocators_.node_base_alloc_.address(*node_),
|
||||
node_base());
|
||||
node_base_constructed_ = true;
|
||||
|
||||
new(node_->address()) value_type(v);
|
||||
value_constructed_ = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename K, typename M>
|
||||
void construct_pair(K const& k, M*)
|
||||
{
|
||||
BOOST_ASSERT(!node_);
|
||||
node_constructed_ = false;
|
||||
value_constructed_ = false;
|
||||
|
||||
node_ = allocators_.node_alloc_.allocate(1);
|
||||
|
||||
allocators_.node_alloc_.construct(node_, node());
|
||||
node_constructed_ = true;
|
||||
|
||||
new(node_->address()) value_type(k, M());
|
||||
allocators_.value_alloc_.construct(
|
||||
allocators_.value_alloc_.address(node_->value_), v);
|
||||
value_constructed_ = true;
|
||||
}
|
||||
|
||||
@@ -249,6 +322,7 @@ namespace boost {
|
||||
node_constructor(node_constructor const&);
|
||||
node_constructor& operator=(node_constructor const&);
|
||||
};
|
||||
#endif
|
||||
|
||||
// Methods for navigating groups of elements with equal keys.
|
||||
|
||||
@@ -277,7 +351,8 @@ namespace boost {
|
||||
|
||||
// pre: Must be pointing to a node
|
||||
static inline reference get_value(link_ptr p) {
|
||||
return get_node(p).value();
|
||||
BOOST_ASSERT(p);
|
||||
return static_cast<node*>(&*p)->value_;
|
||||
}
|
||||
|
||||
class iterator_base
|
||||
@@ -1119,7 +1194,7 @@ namespace boost {
|
||||
|
||||
// This can throw, but BOOST_UNORDERED_TABLE_DATA's destructor will clean
|
||||
// up.
|
||||
x.copy_buckets_to(data_);
|
||||
copy_buckets(x.data_, data_, functions_.current());
|
||||
}
|
||||
|
||||
// Copy Construct with allocator
|
||||
@@ -1134,7 +1209,7 @@ namespace boost {
|
||||
|
||||
// This can throw, but BOOST_UNORDERED_TABLE_DATA's destructor will clean
|
||||
// up.
|
||||
x.copy_buckets_to(data_);
|
||||
copy_buckets(x.data_, data_, functions_.current());
|
||||
}
|
||||
|
||||
// Move Construct
|
||||
@@ -1159,14 +1234,14 @@ namespace boost {
|
||||
if(x.data_.buckets_) {
|
||||
// This can throw, but BOOST_UNORDERED_TABLE_DATA's destructor will clean
|
||||
// up.
|
||||
x.copy_buckets_to(data_);
|
||||
copy_buckets(x.data_, data_, functions_.current());
|
||||
}
|
||||
}
|
||||
|
||||
// Assign
|
||||
//
|
||||
// basic exception safety, if buffered_functions::buffer or reserver throws
|
||||
// the container is left in a sane, empty state. If copy_buckets_to
|
||||
// the container is left in a sane, empty state. If copy_buckets
|
||||
// throws the container is left with whatever was successfully
|
||||
// copied.
|
||||
|
||||
@@ -1180,7 +1255,7 @@ namespace boost {
|
||||
mlf_ = x.mlf_; // no throw
|
||||
calculate_max_load(); // no throw
|
||||
reserve(x.size()); // throws
|
||||
x.copy_buckets_to(data_); // throws
|
||||
copy_buckets(x.data_, data_, functions_.current()); // throws
|
||||
}
|
||||
|
||||
return *this;
|
||||
@@ -1223,10 +1298,10 @@ namespace boost {
|
||||
// which will clean up if anything throws an exception.
|
||||
// (all can throw, but with no effect as these are new objects).
|
||||
data new_this(data_, x.min_buckets_for_size(x.data_.size_));
|
||||
x.copy_buckets_to(new_this);
|
||||
copy_buckets(x.data_, new_this, functions_.*new_func_this);
|
||||
|
||||
data new_that(x.data_, min_buckets_for_size(data_.size_));
|
||||
copy_buckets_to(new_that);
|
||||
x.copy_buckets(data_, new_that, x.functions_.*new_func_that);
|
||||
|
||||
// Start updating the data here, no throw from now on.
|
||||
data_.swap(new_this);
|
||||
@@ -1267,7 +1342,7 @@ namespace boost {
|
||||
// which will clean up if anything throws an exception.
|
||||
// (all can throw, but with no effect as these are new objects).
|
||||
data new_this(data_, x.min_buckets_for_size(x.data_.size_));
|
||||
x.copy_buckets_to(new_this);
|
||||
copy_buckets(x.data_, new_this, functions_.*new_func_this);
|
||||
|
||||
// Start updating the data here, no throw from now on.
|
||||
data_.move(new_this);
|
||||
@@ -1282,10 +1357,17 @@ namespace boost {
|
||||
// accessors
|
||||
|
||||
// no throw
|
||||
#if defined(BOOST_HAS_RVALUE_REFS) && defined(BOOST_HAS_VARIADIC_TMPL)
|
||||
node_allocator get_allocator() const
|
||||
{
|
||||
return data_.allocators_.node_alloc_;
|
||||
}
|
||||
#else
|
||||
value_allocator get_allocator() const
|
||||
{
|
||||
return data_.allocators_.value_alloc_;
|
||||
}
|
||||
#endif
|
||||
|
||||
// no throw
|
||||
hasher const& hash_function() const
|
||||
@@ -1387,21 +1469,6 @@ namespace boost {
|
||||
return need_to_reserve;
|
||||
}
|
||||
|
||||
// basic exception safety
|
||||
bool reserve_for_insert(size_type n)
|
||||
{
|
||||
bool need_to_reserve = n >= max_load_;
|
||||
// throws - basic:
|
||||
if (need_to_reserve) {
|
||||
size_type s = size();
|
||||
s = s + (s >> 1);
|
||||
s = s > n ? s : n;
|
||||
rehash_impl(min_buckets_for_size(s));
|
||||
}
|
||||
BOOST_ASSERT(n < max_load_ || n > max_size());
|
||||
return need_to_reserve;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// no throw
|
||||
@@ -1510,23 +1577,22 @@ namespace boost {
|
||||
return;
|
||||
|
||||
data new_buckets(data_, n); // throws, seperate
|
||||
move_buckets_to(new_buckets); // basic/no throw
|
||||
move_buckets(data_, new_buckets, hash_function());
|
||||
// basic/no throw
|
||||
new_buckets.swap(data_); // no throw
|
||||
calculate_max_load(); // no throw
|
||||
}
|
||||
|
||||
// move_buckets_to & copy_buckets_to
|
||||
// move_buckets & copy_buckets
|
||||
//
|
||||
// if the hash function throws, basic excpetion safety
|
||||
// no throw otherwise
|
||||
|
||||
void move_buckets_to(data& dst)
|
||||
static void move_buckets(data& src, data& dst, hasher const& hf)
|
||||
{
|
||||
BOOST_ASSERT(dst.size_ == 0);
|
||||
//BOOST_ASSERT(src.allocators_.node_alloc_ == dst.allocators_.node_alloc_);
|
||||
|
||||
data& src = this->data_;
|
||||
hasher const& hf = this->hash_function();
|
||||
bucket_ptr end = src.buckets_end();
|
||||
|
||||
for(; src.cached_begin_bucket_ != end;
|
||||
@@ -1550,14 +1616,12 @@ namespace boost {
|
||||
// basic excpetion safety. If an exception is thrown this will
|
||||
// leave dst partially filled.
|
||||
|
||||
void copy_buckets_to(data& dst) const
|
||||
static void copy_buckets(data const& src, data& dst, functions const& f)
|
||||
{
|
||||
BOOST_ASSERT(dst.size_ == 0);
|
||||
|
||||
// no throw:
|
||||
data const& src = this->data_;
|
||||
hasher const& hf = this->hash_function();
|
||||
bucket_ptr end = src.buckets_end();
|
||||
hasher const& hf = f.hash_function();
|
||||
|
||||
// no throw:
|
||||
for(bucket_ptr i = src.cached_begin_bucket_; i != end; ++i) {
|
||||
@@ -1649,14 +1713,14 @@ namespace boost {
|
||||
|
||||
iterator_base insert_impl(node_constructor& a)
|
||||
{
|
||||
key_type const& k = extract_key(a.get()->value());
|
||||
key_type const& k = extract_key(a.get()->value_);
|
||||
size_type hash_value = hash_function()(k);
|
||||
bucket_ptr bucket = data_.bucket_ptr_from_hash(hash_value);
|
||||
link_ptr position = find_iterator(bucket, k);
|
||||
|
||||
// reserve has basic exception safety if the hash function
|
||||
// throws, strong otherwise.
|
||||
if(reserve_for_insert(size() + 1))
|
||||
if(reserve(size() + 1))
|
||||
bucket = data_.bucket_ptr_from_hash(hash_value);
|
||||
|
||||
// I'm relying on link_ptr not being invalidated by
|
||||
@@ -1671,7 +1735,7 @@ namespace boost {
|
||||
iterator_base insert_hint_impl(iterator_base const& it, node_constructor& a)
|
||||
{
|
||||
// equal can throw, but with no effects
|
||||
if (it == data_.end() || !equal(extract_key(a.get()->value()), *it)) {
|
||||
if (it == data_.end() || !equal(extract_key(a.get()->value_), *it)) {
|
||||
// Use the standard insert if the iterator doesn't point
|
||||
// to a matching key.
|
||||
return insert_impl(a);
|
||||
@@ -1686,8 +1750,8 @@ namespace boost {
|
||||
|
||||
// reserve has basic exception safety if the hash function
|
||||
// throws, strong otherwise.
|
||||
bucket_ptr base = reserve_for_insert(size() + 1) ?
|
||||
get_bucket(extract_key(a.get()->value())) : it.bucket_;
|
||||
bucket_ptr base = reserve(size() + 1) ?
|
||||
get_bucket(extract_key(a.get()->value_)) : it.bucket_;
|
||||
|
||||
// Nothing after this point can throw
|
||||
|
||||
@@ -1711,13 +1775,13 @@ namespace boost {
|
||||
}
|
||||
else {
|
||||
// Only require basic exception safety here
|
||||
reserve_for_insert(size() + distance);
|
||||
reserve(size() + distance);
|
||||
node_constructor a(data_.allocators_);
|
||||
|
||||
for (; i != j; ++i) {
|
||||
a.construct(*i);
|
||||
|
||||
key_type const& k = extract_key(a.get()->value());
|
||||
key_type const& k = extract_key(a.get()->value_);
|
||||
bucket_ptr bucket = get_bucket(k);
|
||||
link_ptr position = find_iterator(bucket, k);
|
||||
|
||||
@@ -1773,11 +1837,11 @@ namespace boost {
|
||||
// Create the node before rehashing in case it throws an
|
||||
// exception (need strong safety in such a case).
|
||||
node_constructor a(data_.allocators_);
|
||||
a.construct_pair(k, (mapped_type*) 0);
|
||||
a.construct(value_type(k, mapped_type()));
|
||||
|
||||
// reserve has basic exception safety if the hash function
|
||||
// throws, strong otherwise.
|
||||
if(reserve_for_insert(size() + 1))
|
||||
if(reserve(size() + 1))
|
||||
bucket = data_.bucket_ptr_from_hash(hash_value);
|
||||
|
||||
// Nothing after this point can throw.
|
||||
@@ -1816,7 +1880,7 @@ namespace boost {
|
||||
|
||||
// reserve has basic exception safety if the hash function
|
||||
// throws, strong otherwise.
|
||||
if(reserve_for_insert(size() + 1))
|
||||
if(reserve(size() + 1))
|
||||
bucket = data_.bucket_ptr_from_hash(hash_value);
|
||||
|
||||
// Nothing after this point can throw.
|
||||
@@ -1883,7 +1947,7 @@ namespace boost {
|
||||
|
||||
// reserve has basic exception safety if the hash function
|
||||
// throws, strong otherwise.
|
||||
if(reserve_for_insert(size() + 1))
|
||||
if(reserve(size() + 1))
|
||||
bucket = data_.bucket_ptr_from_hash(hash_value);
|
||||
|
||||
// Nothing after this point can throw.
|
||||
@@ -1902,7 +1966,7 @@ namespace boost {
|
||||
a.construct(std::forward<Args>(args)...);
|
||||
|
||||
// No side effects in this initial code
|
||||
key_type const& k = extract_key(a.get()->value());
|
||||
key_type const& k = extract_key(a.get()->value_);
|
||||
size_type hash_value = hash_function()(k);
|
||||
bucket_ptr bucket = data_.bucket_ptr_from_hash(hash_value);
|
||||
link_ptr pos = find_iterator(bucket, k);
|
||||
@@ -1914,7 +1978,7 @@ namespace boost {
|
||||
} else {
|
||||
// reserve has basic exception safety if the hash function
|
||||
// throws, strong otherwise.
|
||||
if(reserve_for_insert(size() + 1))
|
||||
if(reserve(size() + 1))
|
||||
bucket = data_.bucket_ptr_from_hash(hash_value);
|
||||
|
||||
// Nothing after this point can throw.
|
||||
@@ -1983,7 +2047,7 @@ namespace boost {
|
||||
// reserve has basic exception safety if the hash function
|
||||
// throws, strong otherwise.
|
||||
if(size() + 1 >= max_load_) {
|
||||
reserve_for_insert(size() + insert_size(i, j));
|
||||
reserve(size() + insert_size(i, j));
|
||||
bucket = data_.bucket_ptr_from_hash(hash_value);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
// Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard.
|
||||
// Copyright (C) 2005-2009 Daniel James.
|
||||
// Copyright (C) 2005-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -21,15 +21,6 @@
|
||||
#include <boost/unordered/detail/move.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(push)
|
||||
#if BOOST_MSVC >= 1400
|
||||
#pragma warning(disable:4396) //the inline specifier cannot be used when a
|
||||
// friend declaration refers to a specialization
|
||||
// of a function template
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template <class Key, class T, class Hash, class Pred, class Alloc>
|
||||
@@ -135,24 +126,6 @@ namespace boost
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_INITIALIZER_LISTS)
|
||||
unordered_map(std::initializer_list<value_type> list,
|
||||
size_type n = boost::unordered_detail::default_initial_bucket_count,
|
||||
const hasher &hf = hasher(),
|
||||
const key_equal &eql = key_equal(),
|
||||
const allocator_type &a = allocator_type())
|
||||
: base(list.begin(), list.end(), n, hf, eql, a)
|
||||
{
|
||||
}
|
||||
|
||||
unordered_map& operator=(std::initializer_list<value_type> list)
|
||||
{
|
||||
base.data_.clear();
|
||||
base.insert_range(list.begin(), list.end());
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
BOOST_DEDUCED_TYPENAME implementation::iterator_base const&
|
||||
@@ -412,8 +385,8 @@ namespace boost
|
||||
friend bool operator==(unordered_map const&, unordered_map const&);
|
||||
friend bool operator!=(unordered_map const&, unordered_map const&);
|
||||
#else
|
||||
friend bool operator==<Key, T, Hash, Pred, Alloc>(unordered_map const&, unordered_map const&);
|
||||
friend bool operator!=<Key, T, Hash, Pred, Alloc>(unordered_map const&, unordered_map const&);
|
||||
friend bool operator==<>(unordered_map const&, unordered_map const&);
|
||||
friend bool operator!=<>(unordered_map const&, unordered_map const&);
|
||||
#endif
|
||||
}; // class template unordered_map
|
||||
|
||||
@@ -541,24 +514,6 @@ namespace boost
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_INITIALIZER_LISTS)
|
||||
unordered_multimap(std::initializer_list<value_type> list,
|
||||
size_type n = boost::unordered_detail::default_initial_bucket_count,
|
||||
const hasher &hf = hasher(),
|
||||
const key_equal &eql = key_equal(),
|
||||
const allocator_type &a = allocator_type())
|
||||
: base(list.begin(), list.end(), n, hf, eql, a)
|
||||
{
|
||||
}
|
||||
|
||||
unordered_multimap& operator=(std::initializer_list<value_type> list)
|
||||
{
|
||||
base.data_.clear();
|
||||
base.insert_range(list.begin(), list.end());
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@@ -802,8 +757,8 @@ namespace boost
|
||||
friend bool operator==(unordered_multimap const&, unordered_multimap const&);
|
||||
friend bool operator!=(unordered_multimap const&, unordered_multimap const&);
|
||||
#else
|
||||
friend bool operator==<Key, T, Hash, Pred, Alloc>(unordered_multimap const&, unordered_multimap const&);
|
||||
friend bool operator!=<Key, T, Hash, Pred, Alloc>(unordered_multimap const&, unordered_multimap const&);
|
||||
friend bool operator==<>(unordered_multimap const&, unordered_multimap const&);
|
||||
friend bool operator!=<>(unordered_multimap const&, unordered_multimap const&);
|
||||
#endif
|
||||
}; // class template unordered_multimap
|
||||
|
||||
@@ -830,8 +785,4 @@ namespace boost
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // BOOST_UNORDERED_UNORDERED_MAP_HPP_INCLUDED
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright (C) 2008-2009 Daniel James.
|
||||
// Copyright (C) 2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
// Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard.
|
||||
// Copyright (C) 2005-2009 Daniel James.
|
||||
// Copyright (C) 2005-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -21,15 +21,6 @@
|
||||
#include <boost/unordered/detail/move.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(push)
|
||||
#if BOOST_MSVC >= 1400
|
||||
#pragma warning(disable:4396) //the inline specifier cannot be used when a
|
||||
// friend declaration refers to a specialization
|
||||
// of a function template
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template <class Value, class Hash, class Pred, class Alloc>
|
||||
@@ -133,24 +124,6 @@ namespace boost
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_INITIALIZER_LISTS)
|
||||
unordered_set(std::initializer_list<value_type> list,
|
||||
size_type n = boost::unordered_detail::default_initial_bucket_count,
|
||||
const hasher &hf = hasher(),
|
||||
const key_equal &eql = key_equal(),
|
||||
const allocator_type &a = allocator_type())
|
||||
: base(list.begin(), list.end(), n, hf, eql, a)
|
||||
{
|
||||
}
|
||||
|
||||
unordered_set& operator=(std::initializer_list<value_type> list)
|
||||
{
|
||||
base.data_.clear();
|
||||
base.insert_range(list.begin(), list.end());
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
BOOST_DEDUCED_TYPENAME implementation::iterator_base const&
|
||||
@@ -384,8 +357,8 @@ namespace boost
|
||||
friend bool operator==(unordered_set const&, unordered_set const&);
|
||||
friend bool operator!=(unordered_set const&, unordered_set const&);
|
||||
#else
|
||||
friend bool operator==<Value, Hash, Pred, Alloc>(unordered_set const&, unordered_set const&);
|
||||
friend bool operator!=<Value, Hash, Pred, Alloc>(unordered_set const&, unordered_set const&);
|
||||
friend bool operator==<>(unordered_set const&, unordered_set const&);
|
||||
friend bool operator!=<>(unordered_set const&, unordered_set const&);
|
||||
#endif
|
||||
}; // class template unordered_set
|
||||
|
||||
@@ -511,24 +484,6 @@ namespace boost
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_INITIALIZER_LISTS)
|
||||
unordered_multiset(std::initializer_list<value_type> list,
|
||||
size_type n = boost::unordered_detail::default_initial_bucket_count,
|
||||
const hasher &hf = hasher(),
|
||||
const key_equal &eql = key_equal(),
|
||||
const allocator_type &a = allocator_type())
|
||||
: base(list.begin(), list.end(), n, hf, eql, a)
|
||||
{
|
||||
}
|
||||
|
||||
unordered_multiset& operator=(std::initializer_list<value_type> list)
|
||||
{
|
||||
base.data_.clear();
|
||||
base.insert_range(list.begin(), list.end());
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
BOOST_DEDUCED_TYPENAME implementation::iterator_base const&
|
||||
@@ -759,8 +714,8 @@ namespace boost
|
||||
friend bool operator==(unordered_multiset const&, unordered_multiset const&);
|
||||
friend bool operator!=(unordered_multiset const&, unordered_multiset const&);
|
||||
#else
|
||||
friend bool operator==<Value, Hash, Pred, Alloc>(unordered_multiset const&, unordered_multiset const&);
|
||||
friend bool operator!=<Value, Hash, Pred, Alloc>(unordered_multiset const&, unordered_multiset const&);
|
||||
friend bool operator==<>(unordered_multiset const&, unordered_multiset const&);
|
||||
friend bool operator!=<>(unordered_multiset const&, unordered_multiset const&);
|
||||
#endif
|
||||
}; // class template unordered_multiset
|
||||
|
||||
@@ -787,8 +742,4 @@ namespace boost
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // BOOST_UNORDERED_UNORDERED_SET_HPP_INCLUDED
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright (C) 2008-2009 Daniel James.
|
||||
// Copyright (C) 2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
boost_module(unordered DEPENDS config functional)
|
||||
@@ -1,75 +0,0 @@
|
||||
boost_additional_test_dependencies(unordered BOOST_DEPENDS test)
|
||||
|
||||
# GCC Compilers
|
||||
IF(CMAKE_COMPILER_IS_GNUCC)
|
||||
SET(test_compile_flags "-Wsign-promo -Wunused-parameter")
|
||||
ENDIF(CMAKE_COMPILER_IS_GNUCC)
|
||||
|
||||
# Intel Compiler flags
|
||||
IF( ${CMAKE_CXX_COMPILER} MATCHES "icpc" )
|
||||
SET(test_compile_flags "${test_compile_flags} -strict_ansi -cxxlib-icc")
|
||||
ENDIF( ${CMAKE_CXX_COMPILER} MATCHES "icpc" )
|
||||
|
||||
set (swap_compile_flags "${test_compile_flags} -DBOOST_UNORDERED_SWAP_METHOD=2")
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Unordered Tests
|
||||
set (unordered_tests
|
||||
fwd_set_test
|
||||
fwd_map_test
|
||||
compile_set
|
||||
compile_map
|
||||
link_test_1
|
||||
link_test_2
|
||||
simple_tests
|
||||
equivalent_keys_tests
|
||||
constructor_tests
|
||||
copy_tests
|
||||
move_tests.cpp
|
||||
assign_tests
|
||||
insert_tests
|
||||
insert_stable_tests
|
||||
unnecessary_copy_tests
|
||||
erase_tests
|
||||
erase_equiv_tests
|
||||
find_tests
|
||||
at_tests
|
||||
bucket_tests
|
||||
load_factor_tests
|
||||
rehash_tests
|
||||
equality_tests
|
||||
)
|
||||
#-- Create an executable test for each source
|
||||
foreach(test ${unordered_tests})
|
||||
boost_test_run(${test} "unordered/${test}.cpp"
|
||||
COMPILE_FLAGS ${test_compile_flags}
|
||||
DEPENDS boost_unit_test_framework)
|
||||
endforeach(test ${unordered_tests})
|
||||
|
||||
#-- run the swap test
|
||||
boost_test_run(swap_tests
|
||||
COMPILE_FLAGS ${swap_compile_flags}
|
||||
DEPENDS boost_unit_test_framework)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Exception Tests
|
||||
set (exception_tests
|
||||
constructor_exception_tests
|
||||
copy_exception_tests
|
||||
assign_exception_tests
|
||||
insert_exception_tests
|
||||
erase_exception_tests
|
||||
rehash_exception_tests
|
||||
)
|
||||
|
||||
#-- Create an executable test for each source
|
||||
foreach(test ${exception_tests})
|
||||
boost_test_run(${test} "exception/${test}.cpp"
|
||||
COMPILE_FLAGS ${test_compile_flags}
|
||||
DEPENDS boost_unit_test_framework)
|
||||
endforeach(test ${unordered_tests})
|
||||
|
||||
#-- run the swap test
|
||||
boost_test_run(swap_swap_exception_tests
|
||||
COMPILE_FLAGS ${swap_compile_flags}
|
||||
DEPENDS boost_unit_test_framework)
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// Copyright 2005-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2008-2009 Daniel James.
|
||||
// Copyright 2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or move at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// Copyright 2005-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// Copyright 2005-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// Copyright 2005-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
+6
-21
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2008-2009 Daniel James.
|
||||
// Copyright 2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -144,7 +144,6 @@ namespace test
|
||||
list& operator=(list const& other) {
|
||||
clear();
|
||||
insert(other.begin(), other.end());
|
||||
return *this;
|
||||
}
|
||||
|
||||
iterator begin() { return iterator(data_.first_); }
|
||||
@@ -243,28 +242,14 @@ namespace test
|
||||
node** merge_adjacent_ranges(node** first, node** second,
|
||||
node** third, Less less)
|
||||
{
|
||||
while(true) {
|
||||
while(true) {
|
||||
if(first == second) return third;
|
||||
if(less((*second)->value_, (*first)->value_)) break;
|
||||
first = &(*first)->next_;
|
||||
while(first != second) {
|
||||
if(less((*second)->value_, (*first)->value_)) {
|
||||
swap_adjacent_ranges(first, second, third);
|
||||
std::swap(second, third);
|
||||
}
|
||||
|
||||
swap_adjacent_ranges(first, second, third);
|
||||
first = &(*first)->next_;
|
||||
|
||||
// Since the two ranges we just swapped, the order is now:
|
||||
// first...third...second
|
||||
|
||||
while(true) {
|
||||
if(first == third) return second;
|
||||
if(!less((*first)->value_, (*third)->value_)) break;
|
||||
first = &(*first)->next_;
|
||||
}
|
||||
|
||||
swap_adjacent_ranges(first, third, second);
|
||||
first = &(*first)->next_;
|
||||
}
|
||||
return third;
|
||||
}
|
||||
|
||||
void swap_adjacent_ranges(node** first, node** second, node** third)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// Copyright 2005-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// Copyright 2005-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// Copyright 2005-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -103,22 +103,6 @@ UNORDERED_TEST(assign_tests2,
|
||||
((default_generator)(generate_collisions))
|
||||
)
|
||||
|
||||
#if !defined(BOOST_NO_INITIALIZER_LISTS)
|
||||
|
||||
UNORDERED_AUTO_TEST(assign_initializer_list)
|
||||
{
|
||||
std::cerr<<"Initializer List Tests\n";
|
||||
|
||||
boost::unordered_set<int> x;
|
||||
x.insert(10);
|
||||
x.insert(20);
|
||||
x = { 1, 2, -10 };
|
||||
BOOST_CHECK(x.find(10) == x.end());
|
||||
BOOST_CHECK(x.find(-10) != x.end());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
RUN_TESTS()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2007-2009 Daniel James.
|
||||
// Copyright 2007-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// Copyright 2005-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -288,17 +288,6 @@ UNORDERED_TEST(map_constructor_test,
|
||||
((test_map)(test_multimap))
|
||||
)
|
||||
|
||||
#if !defined(BOOST_NO_INITIALIZER_LISTS)
|
||||
|
||||
UNORDERED_AUTO_TEST(test_initializer_list) {
|
||||
std::cerr<<"Initializer List Tests\n";
|
||||
boost::unordered_set<int> x1 = { 2, 10, 45, -5 };
|
||||
BOOST_CHECK(x1.find(10) != x1.end());
|
||||
BOOST_CHECK(x1.find(46) == x1.end());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
RUN_TESTS()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2008-2009 Daniel James.
|
||||
// Copyright 2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -13,10 +13,6 @@ namespace equality_tests
|
||||
{
|
||||
struct mod_compare
|
||||
{
|
||||
bool alt_hash_;
|
||||
|
||||
explicit mod_compare(bool alt_hash = false) : alt_hash_(alt_hash) {}
|
||||
|
||||
bool operator()(int x, int y) const
|
||||
{
|
||||
return x % 1000 == y % 1000;
|
||||
@@ -24,7 +20,7 @@ namespace equality_tests
|
||||
|
||||
int operator()(int x) const
|
||||
{
|
||||
return alt_hash_ ? x % 250 : (x + 5) % 250;
|
||||
return x % 250;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -142,25 +138,6 @@ namespace equality_tests
|
||||
((1)(2))((1001)(1)), ==, ((1001)(2))((1)(1)));
|
||||
}
|
||||
|
||||
// Test that equality still works when the two containers have
|
||||
// different hash functions but the same equality predicate.
|
||||
|
||||
UNORDERED_AUTO_TEST(equality_different_hash_test)
|
||||
{
|
||||
typedef boost::unordered_set<int, mod_compare, mod_compare> set;
|
||||
set set1(0, mod_compare(false), mod_compare(false));
|
||||
set set2(0, mod_compare(true), mod_compare(true));
|
||||
BOOST_CHECK(set1 == set2);
|
||||
set1.insert(1); set2.insert(2);
|
||||
BOOST_CHECK(set1 != set2);
|
||||
set1.insert(2); set2.insert(1);
|
||||
BOOST_CHECK(set1 == set2);
|
||||
set1.insert(10); set2.insert(20);
|
||||
BOOST_CHECK(set1 != set2);
|
||||
set1.insert(20); set2.insert(10);
|
||||
BOOST_CHECK(set1 == set2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RUN_TESTS()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2008-2009 Daniel James.
|
||||
// Copyright 2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2008-2009 Daniel James.
|
||||
// Copyright 2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2007-2009 Daniel James.
|
||||
// Copyright 2007-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2008-2009 Daniel James.
|
||||
// Copyright 2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or move at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright 2006-2009 Daniel James.
|
||||
// Copyright 2006-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user