Merge test improvements, pdf documentation improvements, some implementation

tweaks.

Merged revisions 45747-46030 via svnmerge from 
https://svn.boost.org/svn/boost/branches/unordered/trunk

................
  r45747 | danieljames | 2008-05-25 18:03:30 +0100 (Sun, 25 May 2008) | 1 line
  
  Remove /branches/unordered/dev from svnmerge tracking.
................
  r45874 | danieljames | 2008-05-28 18:54:53 +0100 (Wed, 28 May 2008) | 1 line
  
  Merge from trunk.
................
  r45881 | danieljames | 2008-05-29 00:10:37 +0100 (Thu, 29 May 2008) | 2 lines
  
  Make it possible to use a custom generator in more places.
................
  r45882 | danieljames | 2008-05-29 00:10:56 +0100 (Thu, 29 May 2008) | 2 lines
  
  Remove several unused parameters.
................
  r45883 | danieljames | 2008-05-29 00:11:06 +0100 (Thu, 29 May 2008) | 2 lines
  
  No need to run move_construct_tests1 from move_construct_tests2, already calling it directly.
................
  r45884 | danieljames | 2008-05-29 00:11:15 +0100 (Thu, 29 May 2008) | 2 lines
  
  Remove unused 'construct' as in trunk.
................
  r45885 | danieljames | 2008-05-29 00:11:25 +0100 (Thu, 29 May 2008) | 2 lines
  
  More consistent implementations of insert_impl.
................
  r45886 | danieljames | 2008-05-29 00:11:34 +0100 (Thu, 29 May 2008) | 2 lines
  
  No need to use the single argument version of methods when the variadic version is available. Frees up the non-variadic version for overloading to emulate variadic methods.
................
  r45887 | danieljames | 2008-05-29 00:11:44 +0100 (Thu, 29 May 2008) | 2 lines
  
  Add another test, mainly to avoid an unused parameter warning.
................
  r45888 | danieljames | 2008-05-29 00:11:54 +0100 (Thu, 29 May 2008) | 2 lines
  
  Adjust the pixels per inch of the buckets diagram so it'll fit on the page.
................
  r45889 | danieljames | 2008-05-29 00:15:49 +0100 (Thu, 29 May 2008) | 1 line
  
  Improve pdf output, thanks to John Maddock.
................
  r45890 | danieljames | 2008-05-29 00:17:45 +0100 (Thu, 29 May 2008) | 1 line
  
  Add an svg version of the bucket diagram.
................
  r45891 | danieljames | 2008-05-29 00:18:11 +0100 (Thu, 29 May 2008) | 1 line
  
  Remove the original dia buckets diagram, I'm not using it anymore.
................
  r46025 | danieljames | 2008-06-01 18:39:51 +0100 (Sun, 01 Jun 2008) | 1 line
  
  Initialise merging from doc.
................
  r46030 | danieljames | 2008-06-01 18:54:36 +0100 (Sun, 01 Jun 2008) | 29 lines
  
  Merge in documentation improvements from the doc branch.
  
  Merged revisions 45892-46020 via svnmerge from 
  https://svn.boost.org/svn/boost/branches/doc
  
  ........
    r45892 | danieljames | 2008-05-29 00:30:07 +0100 (Thu, 29 May 2008) | 1 line
    
    Merge latest changes from unordered.
  ........
    r46017 | danieljames | 2008-06-01 18:18:15 +0100 (Sun, 01 Jun 2008) | 2 lines
    
    Use both PNG and SVG versions of the buckets diagram.
  ........
    r46018 | danieljames | 2008-06-01 18:18:27 +0100 (Sun, 01 Jun 2008) | 2 lines
    
    Improved function summary tables in unordered documenations.
  ........
    r46019 | danieljames | 2008-06-01 18:18:39 +0100 (Sun, 01 Jun 2008) | 3 lines
    
    I'd hacked the bibliography to avoid showing the title twice, but this was
    causing problems when generating PDFs, so show the title twice.
  ........
    r46020 | danieljames | 2008-06-01 18:18:52 +0100 (Sun, 01 Jun 2008) | 3 lines
    
    Don't use the compact boostbook refernce style in the standalone documentation
    as it is too wide for printing out.
  ........
................


[SVN r46031]
This commit is contained in:
Daniel James
2008-06-01 18:00:53 +00:00
parent 749dfc4044
commit 6b65b7a916
21 changed files with 459 additions and 84 deletions

View File

@ -3,6 +3,9 @@
# 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)
path-constant images_location : ../ ;
path-constant admonishment_location : ../../../../doc/src/images ;
xml unordered : unordered.qbk ;
boostbook standalone : unordered :
<xsl:param>admon.graphics.path=images/
@ -16,8 +19,38 @@ boostbook standalone : unordered :
<xsl:param>toc.section.depth=1
<xsl:param>toc.max.depth=1
<xsl:param>boost.compact.typedef=0
<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
<format>pdf:<xsl:param>xep.extensions=1
# TOC generation: this is needed for FOP 0.2, but must not be set to zero for FOP-0.9!
<format>pdf:<xsl:param>fop.extensions=0
# No indent on body text:
<format>pdf:<xsl:param>body.start.indent=0pt
# Margin size:
<format>pdf:<xsl:param>page.margin.inner=0.5in
# Margin size:
<format>pdf:<xsl:param>page.margin.outer=0.5in
# Paper type = A4
<format>pdf:<xsl:param>paper.type=A4
# Yes, we want graphics for admonishments:
<xsl:param>admon.graphics=1
# Set this one for PDF generation *only*:
# default png graphics are awful in PDF form,
# better use SVG's instead:
<format>pdf:<xsl:param>admon.graphics.extension=".svg"
<format>pdf:<xsl:param>use.role.for.mediaobject=1
<format>pdf:<xsl:param>preferred.mediaobject.role=print
<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"
;
install css : [ glob $(BOOST_ROOT)/doc/src/*.css ]

View File

@ -1,6 +1,6 @@
<section id="unordered.bibliography" label="Bibliography">
<section id="unordered.bibliography">
<title>Bibliography</title>
<bibliography>
<title>Bibliography</title>
<biblioentry>
<biblioset relation="journal">
<title>C/C++ Users Journal</title>

View File

@ -10,7 +10,7 @@ boost::unordered_set unordered_set] with 7 buckets containing 5 elements, `A`,
`B`, `C`, `D` and `E` (this is just for illustration, containers will typically
have more buckets).
[$../../libs/unordered/doc/diagrams/buckets.png]
[diagram buckets]
In order to decide which bucket to place an element in, the container applies
the hash function, `Hash`, to the element's key (for `unordered_set` and
@ -35,37 +35,53 @@ When looking for elements in this bucket up to 2 comparisons are made, making
the search slower. This is known as a collision. To keep things fast we try to
keep collisions to a minimum.
[table Methods for Accessing Buckets
[[Method] [Description]]
[
[``size_type bucket_count() const``]
[The number of buckets.]
]
[
[``size_type max_bucket_count() const``]
[An upper bound on the number of buckets.]
]
[
[``size_type bucket_size(size_type n) const``]
[The number of elements in bucket `n`.]
]
[
[``size_type bucket(key_type const& k) const``]
[Returns the index of the bucket which would contain k]
]
[
[``
local_iterator begin(size_type n);
local_iterator end(size_type n);
const_local_iterator begin(size_type n) const;
const_local_iterator end(size_type n) const;
const_local_iterator cbegin(size_type n) const;
const_local_iterator cend(size_type n) const;
``]
[Return begin and end iterators for bucket `n`.]
]
]
'''
<table frame="all"><title>Methods for Accessing Buckets</title>
<tgroup cols="2">
<thead><row>
<entry><para>Method</para></entry>
<entry><para>Description</para></entry>
</row></thead>
<tbody>
<row>
<entry>'''`size_type bucket_count() const`'''</entry>
<entry>'''The number of buckets.'''</entry>
</row>
<row>
<entry>'''`size_type max_bucket_count() const`'''</entry>
<entry>'''An upper bound on the number of buckets.'''</entry>
</row>
<row>
<entry>'''`size_type bucket_size(size_type n) const`'''</entry>
<entry>'''The number of elements in bucket `n`.'''</entry>
</row>
<row>
<entry>'''`size_type bucket(key_type const& k) const`'''</entry>
<entry>'''Returns the index of the bucket which would contain k'''</entry>
</row>
<row>
<entry>'''`local_iterator begin(size_type n);`'''</entry>
<entry morerows='5'>'''Return begin and end iterators for bucket `n`.'''</entry>
</row>
<row>
<entry>'''`local_iterator end(size_type n);`'''</entry>
</row>
<row>
<entry>'''`const_local_iterator begin(size_type n) const;`'''</entry>
</row>
<row>
<entry>'''`const_local_iterator end(size_type n) const;`'''</entry>
</row>
<row>
<entry>'''`const_local_iterator cbegin(size_type n) const;`'''</entry>
</row>
<row>
<entry>'''`const_local_iterator cend(size_type n) const;`'''</entry>
</row>
</tbody>
</tgroup>
</table>
'''
[h2 Controlling the number of buckets]
@ -100,19 +116,19 @@ or close to the hint - unless your hint is unreasonably small or large.
[[Method] [Description]]
[
[``float load_factor() const``]
[`float load_factor() const`]
[The average number of elements per bucket.]
]
[
[``float max_load_factor() const``]
[`float max_load_factor() const`]
[Returns the current maximum load factor.]
]
[
[``float max_load_factor(float z)``]
[`float max_load_factor(float z)`]
[Changes the container's maximum load factor, using `z` as a hint.]
]
[
[``void rehash(size_type n)``]
[`void rehash(size_type n)`]
[Changes the number of buckets so that there at least n buckets, and
so that the load factor is less than the maximum load factor.]
]

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 13 KiB

313
doc/diagrams/buckets.svg Normal file
View File

@ -0,0 +1,313 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.0"
width="507.85925"
height="400.45422"
viewBox="1.33 0.95 6.01 4.09"
id="svg2">
<defs
id="defs95" />
<rect
width="6.0023117"
height="4.0815721"
x="1.3310578"
y="0.95080346"
id="rect4"
style="fill:#e5e5e5;stroke:none;stroke-width:0" />
<rect
width="6.0023117"
height="4.0815721"
x="1.3310578"
y="0.95080346"
id="rect6"
style="opacity:1;fill:none;stroke:#000000;stroke-width:0.02400924" />
<rect
width="1.2004625"
height="1.6806473"
x="1.5711501"
y="1.1908962"
id="rect8"
style="fill:#ffffff;stroke:none;stroke-width:0" />
<rect
width="1.2004625"
height="1.6806473"
x="1.5711501"
y="1.1908962"
id="rect10"
style="fill:none;stroke:#000000;stroke-width:0.02400924" />
<text
x="1.7289008"
y="1.4950322"
id="text12"
style="font-size:0.19207397px;font-style:normal;font-weight:400;text-anchor:start;fill:#000000;font-family:sans">Bucket 1</text>
<line
x1="1.5711501"
y1="1.6710808"
x2="2.7716124"
y2="1.6710808"
id="line14"
style="stroke:#000000;stroke-width:0.02400924" />
<rect
width="1.2004625"
height="1.6806473"
x="3.0117054"
y="1.1908962"
id="rect16"
style="fill:#ffffff;stroke:none;stroke-width:0" />
<rect
width="1.2004625"
height="1.6806473"
x="3.0117054"
y="1.1908962"
id="rect18"
style="fill:none;stroke:#000000;stroke-width:0.02400924" />
<text
x="3.1603069"
y="1.4950322"
id="text20"
style="font-size:0.19207397px;font-style:normal;font-weight:400;text-anchor:start;fill:#000000;font-family:sans">Bucket 2</text>
<line
x1="3.0117054"
y1="1.6710808"
x2="4.2121677"
y2="1.6710808"
id="line22"
style="stroke:#000000;stroke-width:0.02400924" />
<rect
width="1.2004625"
height="1.6806473"
x="4.4522605"
y="1.1908962"
id="rect24"
style="fill:#ffffff;stroke:none;stroke-width:0" />
<rect
width="1.2004625"
height="1.6806473"
x="4.4522605"
y="1.1908962"
id="rect26"
style="fill:none;stroke:#000000;stroke-width:0.02400924" />
<text
x="4.5917125"
y="1.4950322"
id="text28"
style="font-size:0.19207397px;font-style:normal;font-weight:400;text-anchor:start;fill:#000000;font-family:sans">Bucket 3</text>
<line
x1="4.4522605"
y1="1.6710808"
x2="5.6527228"
y2="1.6710808"
id="line30"
style="stroke:#000000;stroke-width:0.02400924" />
<rect
width="1.2004625"
height="1.6806473"
x="5.8928151"
y="1.1908962"
id="rect32"
style="fill:#ffffff;stroke:none;stroke-width:0" />
<rect
width="1.2004625"
height="1.6806473"
x="5.8928151"
y="1.1908962"
id="rect34"
style="fill:none;stroke:#000000;stroke-width:0.02400924" />
<text
x="6.0688629"
y="1.4858831"
id="text36"
style="font-size:0.19207397px;font-style:normal;font-weight:400;text-anchor:start;fill:#000000;font-family:sans">Bucket 4</text>
<line
x1="5.8928151"
y1="1.6710808"
x2="7.093277"
y2="1.6710808"
id="line38"
style="stroke:#000000;stroke-width:0.02400924" />
<rect
width="1.2004625"
height="1.6806473"
x="2.2941716"
y="3.1054616"
id="rect40"
style="fill:#ffffff;stroke:none;stroke-width:0" />
<rect
width="1.2004625"
height="1.6806473"
x="2.2941716"
y="3.1054616"
id="rect42"
style="fill:none;stroke:#000000;stroke-width:0.02400924" />
<text
x="2.4427731"
y="3.4187472"
id="text44"
style="font-size:0.19207397px;font-style:normal;font-weight:400;text-anchor:start;fill:#000000;font-family:sans">Bucket 5</text>
<line
x1="2.2941716"
y1="3.5856469"
x2="3.4946339"
y2="3.5856469"
id="line46"
style="stroke:#000000;stroke-width:0.02400924" />
<rect
width="1.2004625"
height="1.6806473"
x="3.7347264"
y="3.1054616"
id="rect48"
style="fill:#ffffff;stroke:none;stroke-width:0" />
<rect
width="1.2004625"
height="1.6806473"
x="3.7347264"
y="3.1054616"
id="rect50"
style="fill:none;stroke:#000000;stroke-width:0.02400924" />
<text
x="3.8833277"
y="3.4187472"
id="text52"
style="font-size:0.19207397px;font-style:normal;font-weight:400;text-anchor:start;fill:#000000;font-family:sans">Bucket 6</text>
<line
x1="3.7347264"
y1="3.5856469"
x2="4.9351892"
y2="3.5856469"
id="line54"
style="stroke:#000000;stroke-width:0.02400924" />
<rect
width="1.2004625"
height="1.6806473"
x="5.175281"
y="3.1054616"
id="rect56"
style="fill:#ffffff;stroke:none;stroke-width:0" />
<rect
width="1.2004625"
height="1.6806473"
x="5.175281"
y="3.1054616"
id="rect58"
style="fill:none;stroke:#000000;stroke-width:0.02400924" />
<text
x="5.3330317"
y="3.4187472"
id="text60"
style="font-size:0.19207397px;font-style:normal;font-weight:400;text-anchor:start;fill:#000000;font-family:sans">Bucket 7</text>
<line
x1="5.175281"
y1="3.5856469"
x2="6.3757439"
y2="3.5856469"
id="line62"
style="stroke:#000000;stroke-width:0.02400924" />
<ellipse
cx="7.1999998"
cy="4.0110002"
rx="0.308"
ry="0.308"
transform="matrix(0.6859785,0,0,0.6859785,1.3310577,-0.7298436)"
id="ellipse64"
style="fill:#ffffff;stroke:none" />
<ellipse
cx="7.1999998"
cy="4.0110002"
rx="0.308"
ry="0.308"
transform="matrix(0.6859785,0,0,0.6859785,1.3310577,-0.7298436)"
id="ellipse66"
style="fill:none;stroke:#000000;stroke-width:0.035" />
<text
x="6.1443377"
y="2.1364057"
id="text68"
style="font-size:0.34038281px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;font-family:Sans;-inkscape-font-specification:Sans">A</text>
<ellipse
cx="3.007"
cy="4.0300002"
rx="0.308"
ry="0.308"
transform="matrix(0.6859785,0,0,0.6859785,1.3310577,-0.7298436)"
id="ellipse70"
style="fill:#ffffff;stroke:none" />
<ellipse
cx="3.007"
cy="4.0300002"
rx="0.308"
ry="0.308"
transform="matrix(0.6859785,0,0,0.6859785,1.3310577,-0.7298436)"
id="ellipse72"
style="fill:none;stroke:#000000;stroke-width:0.035" />
<text
x="3.2742035"
y="2.1540098"
id="text74"
style="font-size:0.34038281px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;font-family:Sans;-inkscape-font-specification:Sans">B</text>
<ellipse
cx="4.0599999"
cy="6.7820001"
rx="0.308"
ry="0.308"
transform="matrix(0.6859785,0,0,0.6859785,1.3310577,-0.7298436)"
id="ellipse76"
style="fill:#ffffff;stroke:none" />
<ellipse
cx="4.0599999"
cy="6.7820001"
rx="0.308"
ry="0.308"
transform="matrix(0.6859785,0,0,0.6859785,1.3310577,-0.7298436)"
id="ellipse78"
style="fill:none;stroke:#000000;stroke-width:0.035" />
<text
x="3.976877"
y="4.0473108"
id="text80"
style="font-size:0.34038281px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;font-family:Sans;-inkscape-font-specification:Sans">C</text>
<ellipse
cx="7.8449998"
cy="4.6550002"
rx="0.308"
ry="0.308"
transform="matrix(0.6859785,0,0,0.6859785,1.3310577,-0.7298436)"
id="ellipse82"
style="fill:#ffffff;stroke:none" />
<ellipse
cx="7.8449998"
cy="4.6550002"
rx="0.308"
ry="0.308"
transform="matrix(0.6859785,0,0,0.6859785,1.3310577,-0.7298436)"
id="ellipse84"
style="fill:none;stroke:#000000;stroke-width:0.035" />
<text
x="6.5808516"
y="2.5937216"
id="text86"
style="font-size:0.34038281px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;font-family:Sans;-inkscape-font-specification:Sans">D</text>
<ellipse
cx="0.87"
cy="4.0079999"
rx="0.308"
ry="0.308"
transform="matrix(0.6859785,0,0,0.6859785,1.3310577,-0.7298436)"
id="ellipse88"
style="fill:#ffffff;stroke:none" />
<ellipse
cx="0.87"
cy="4.0079999"
rx="0.308"
ry="0.308"
transform="matrix(0.6859785,0,0,0.6859785,1.3310577,-0.7298436)"
id="ellipse90"
style="fill:none;stroke:#000000;stroke-width:0.035" />
<text
x="1.7991183"
y="2.1403852"
id="text92"
style="font-size:0.34038281px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;font-family:Sans;-inkscape-font-specification:Sans">E</text>
</svg>

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

@ -63,11 +63,11 @@ won't work on other implementations of the unordered associative containers.
[[Method] [Description]]
[
[``hasher hash_function() const``]
[`hasher hash_function() const`]
[Returns the container's hash function.]
]
[
[``key_equal key_eq() const``]
[`key_equal key_eq() const`]
[Returns the container's key equality function.]
]
]

View File

@ -17,6 +17,16 @@
]
]
[template diagram[name] '''<inlinemediaobject>
<imageobject role="html">
<imagedata align = "center" fileref="../../libs/unordered/doc/diagrams/'''[name]'''.png"></imagedata>
</imageobject>
<imageobject role="print">
<imagedata align = "center" fileref="../../libs/unordered/doc/diagrams/'''[name]'''.svg"></imagedata>
</imageobject>
</inlinemediaobject>''']
[include:unordered intro.qbk]
[include:unordered buckets.qbk]
[include:unordered hash_equality.qbk]

View File

@ -1648,6 +1648,7 @@ namespace boost {
#if BOOST_UNORDERED_EQUIVALENT_KEYS
#if !(defined(BOOST_HAS_RVALUE_REFS) && defined(BOOST_HAS_VARIADIC_TMPL))
// Insert (equivalent key containers)
// if hash function throws, basic exception safety
@ -1676,7 +1677,8 @@ namespace boost {
return insert_hint_impl(it, a);
}
#if defined(BOOST_HAS_RVALUE_REFS) && defined(BOOST_HAS_VARIADIC_TMPL)
#else
// Insert (equivalent key containers)
// (I'm using an overloaded insert for both 'insert' and 'emplace')
@ -1850,6 +1852,8 @@ namespace boost {
}
}
#if !(defined(BOOST_HAS_RVALUE_REFS) && defined(BOOST_HAS_VARIADIC_TMPL))
// Insert (unique keys)
// if hash function throws, basic exception safety
@ -1902,7 +1906,8 @@ namespace boost {
return insert(v).first;
}
#if defined(BOOST_HAS_RVALUE_REFS) && defined(BOOST_HAS_VARIADIC_TMPL)
#else
// Insert (unique keys)
// (I'm using an overloaded insert for both 'insert' and 'emplace')
//
@ -1949,10 +1954,8 @@ namespace boost {
// Nothing after this point can throw.
link_ptr n = data_.link_node_in_bucket(a, bucket);
return std::pair<iterator_base, bool>(
iterator_base(bucket, n), true);
return std::pair<iterator_base, bool>(iterator_base(bucket,
data_.link_node_in_bucket(a, bucket)), true);
}
}
@ -1993,7 +1996,7 @@ namespace boost {
// if hash function throws, basic exception safety
// strong otherwise
template<typename... Args>
iterator_base insert_hint(iterator_base const& it, Args&&... args)
iterator_base insert_hint(iterator_base const&, Args&&... args)
{
// Life is complicated - just call the normal implementation.
return insert(std::forward<Args>(args)...).first;
@ -2148,7 +2151,7 @@ private:
return it1 == end1 && it2 == end2;
}
#else
static inline bool group_equals(link_ptr it1, link_ptr it2,
static inline bool group_equals(link_ptr, link_ptr,
type_wrapper<key_type>*)
{
return true;

View File

@ -11,7 +11,7 @@ alias framework : ;
project unordered-test/exception-tests
: requirements
<toolset>intel-linux:"<cxxflags>-strict_ansi -cxxlib-icc"
<toolset>gcc:<cxxflags>-Wsign-promo
<toolset>gcc:<cxxflags>"-Wsign-promo -Wunused-parameter"
;
test-suite unordered-exception

View File

@ -210,7 +210,7 @@ namespace test {
}
template <class Test>
void exception_safety(Test const& f, char const* name) {
void exception_safety(Test const& f, char const* /*name*/) {
test_runner<Test> runner(f);
iteration = 0;

View File

@ -153,12 +153,12 @@ namespace test
if(count_allocations > 0) --count_allocations;
}
void track_construct(void* ptr, std::size_t /*size*/, int tag)
void track_construct(void* /*ptr*/, std::size_t /*size*/, int /*tag*/)
{
++count_constructions;
}
void track_destroy(void* ptr, std::size_t /*size*/, int tag)
void track_destroy(void* /*ptr*/, std::size_t /*size*/, int /*tag*/)
{
BOOST_CHECK(count_constructions > 0);
if(count_constructions > 0) --count_constructions;

View File

@ -8,7 +8,7 @@ import testing ;
project unordered-test/unordered
: requirements
<toolset>intel-linux:"<cxxflags>-strict_ansi -cxxlib-icc"
<toolset>gcc:<cxxflags>-Wsign-promo
<toolset>gcc:<cxxflags>"-Wsign-promo -Wunused-parameter"
#<toolset>msvc:<cxxflags>/W4
;

View File

@ -16,11 +16,11 @@ namespace bucket_tests {
test::seed_t seed(54635);
template <class X>
void tests(X* = 0)
void tests(X* = 0, test::random_generator generator = test::default_generator)
{
typedef BOOST_DEDUCED_TYPENAME X::size_type size_type;
typedef BOOST_DEDUCED_TYPENAME X::const_local_iterator const_local_iterator;
test::random_values<X> v(1000);
test::random_values<X> v(1000, generator);
X x(v.begin(), v.end());

View File

@ -149,6 +149,8 @@ void unordered_map_test(X& r, Key const& k, T const& v)
typedef BOOST_DEDUCED_TYPENAME X::key_type key_type;
BOOST_MPL_ASSERT((boost::is_same<value_type, std::pair<key_type const, T> >));
r.insert(std::pair<Key const, T>(k, v));
#if defined(BOOST_HAS_RVALUE_REFS) && defined(BOOST_HAS_VARIADIC_TMPL)
Key k_lvalue(k);
T v_lvalue(v);

View File

@ -253,12 +253,12 @@ void constructor_tests2(T*, test::random_generator const& generator = test::defa
}
template <class T>
void map_constructor_test(T* = 0)
void map_constructor_test(T* = 0, test::random_generator const& generator = test::default_generator)
{
std::cerr<<"map_constructor_test\n";
typedef test::list<std::pair<BOOST_DEDUCED_TYPENAME T::key_type, BOOST_DEDUCED_TYPENAME T::mapped_type> > list;
test::random_values<T> v(1000);
test::random_values<T> v(1000, generator);
list l(v.begin(), v.end());
T x(l.begin(), l.end());

View File

@ -36,7 +36,7 @@ void copy_construct_tests1(T*, test::random_generator const& generator = test::d
}
{
test::random_values<T> v(1000);
test::random_values<T> v(1000, generator);
T x(v.begin(), v.end());
T y(x);
@ -50,7 +50,7 @@ void copy_construct_tests1(T*, test::random_generator const& generator = test::d
// is much lower than the load factor. The hash table is not allowed
// to rehash, but the destination container should probably allocate
// enough buckets to decrease the load factor appropriately.
test::random_values<T> v(1000);
test::random_values<T> v(1000, generator);
T x(v.begin(), v.end());
x.max_load_factor(x.load_factor() / 4);
T y(x);
@ -95,7 +95,7 @@ void copy_construct_tests2(T* ptr, test::random_generator const& generator = tes
}
{
test::random_values<T> v(1000);
test::random_values<T> v(1000, generator);
T x(v.begin(), v.end(), 0, hf, eq, al);
T y(x);
@ -106,7 +106,7 @@ void copy_construct_tests2(T* ptr, test::random_generator const& generator = tes
}
{
test::random_values<T> v(500);
test::random_values<T> v(500, generator);
T x(v.begin(), v.end(), 0, hf, eq, al);
T y(x, al2);

View File

@ -34,13 +34,13 @@ void set_load_factor_tests(X* = 0)
}
template <class X>
void insert_test(X*, float mlf)
void insert_test(X*, float mlf, test::random_generator generator = test::default_generator)
{
X x;
x.max_load_factor(mlf);
float b = x.max_load_factor();
test::random_values<X> values(1000);
test::random_values<X> values(1000, generator);
for(BOOST_DEDUCED_TYPENAME test::random_values<X>::const_iterator
it = values.begin(), end = values.end(); it != end; ++it)

View File

@ -17,7 +17,7 @@ namespace move_tests
test::seed_t seed(98624);
template<class T>
T empty(T* ptr) {
T empty(T*) {
return T();
}
@ -61,7 +61,7 @@ namespace move_tests
}
{
test::random_values<T> v(1000);
test::random_values<T> v(1000, generator);
test::object_count count;
T y(create(v, count));
BOOST_CHECK(count == test::global_object_count);
@ -71,10 +71,10 @@ namespace move_tests
}
template <class T>
void move_assign_tests1(T* ptr, test::random_generator const& generator = test::default_generator)
void move_assign_tests1(T*, test::random_generator const& generator = test::default_generator)
{
{
test::random_values<T> v(500);
test::random_values<T> v(500, generator);
test::object_count count;
T y;
y = create(v, count);
@ -85,11 +85,9 @@ namespace move_tests
}
template <class T>
void move_construct_tests2(T* ptr,
void move_construct_tests2(T*,
test::random_generator const& generator = test::default_generator)
{
move_construct_tests1(ptr);
BOOST_DEDUCED_TYPENAME T::hasher hf(1);
BOOST_DEDUCED_TYPENAME T::key_equal eq(1);
BOOST_DEDUCED_TYPENAME T::allocator_type al(1);
@ -98,7 +96,7 @@ namespace move_tests
test::object_count count;
{
test::random_values<T> v(500);
test::random_values<T> v(500, generator);
T y(create(v, count, hf, eq, al, 0.5));
BOOST_CHECK(count == test::global_object_count);
test::check_container(y, v);
@ -111,7 +109,7 @@ namespace move_tests
{
// TODO: To do this correctly requires the fancy new allocator stuff.
test::random_values<T> v(500);
test::random_values<T> v(500, generator);
T y(create(v, count, hf, eq, al, 2.0), al2);
BOOST_CHECK(count != test::global_object_count);
test::check_container(y, v);
@ -123,7 +121,7 @@ namespace move_tests
}
{
test::random_values<T> v(25);
test::random_values<T> v(25, generator);
T y(create(v, count, hf, eq, al, 1.0), al);
#if defined(BOOST_HAS_RVALUE_REFS)
BOOST_CHECK(count == test::global_object_count);

View File

@ -33,9 +33,9 @@ void rehash_empty_test1(X* = 0)
}
template <class X>
void rehash_test1(X* = 0)
void rehash_test1(X* = 0, test::random_generator generator = test::default_generator)
{
test::random_values<X> v(1000);
test::random_values<X> v(1000, generator);
test::ordered<X> tracker;
tracker.insert_range(v.begin(), v.end());
X x(v.begin(), v.end());

View File

@ -32,7 +32,7 @@ void swap_test_impl(X& x1, X& x2)
}
template <class X>
void swap_tests1(X* = 0)
void swap_tests1(X*, test::random_generator generator = test::default_generator)
{
{
X x;
@ -45,14 +45,14 @@ void swap_tests1(X* = 0)
}
{
test::random_values<X> v(1000);
test::random_values<X> v(1000, generator);
X x, y(v.begin(), v.end());
swap_test_impl(x, y);
swap_test_impl(x, y);
}
{
test::random_values<X> vx(1000), vy(1000);
test::random_values<X> vx(1000, generator), vy(1000, generator);
X x(vx.begin(), vx.end()), y(vy.begin(), vy.end());
swap_test_impl(x, y);
swap_test_impl(x, y);
@ -60,7 +60,7 @@ void swap_tests1(X* = 0)
}
template <class X>
void swap_tests2(X* ptr = 0)
void swap_tests2(X* ptr = 0, test::random_generator generator = test::default_generator)
{
swap_tests1(ptr);
@ -75,14 +75,14 @@ void swap_tests2(X* ptr = 0)
}
{
test::random_values<X> v(1000);
test::random_values<X> v(1000, generator);
X x(v.begin(), v.end(), 0, hasher(1), key_equal(1));
X y(0, hasher(2), key_equal(2));
swap_test_impl(x, y);
}
{
test::random_values<X> vx(100), vy(50);
test::random_values<X> vx(100, generator), vy(50, generator);
X x(vx.begin(), vx.end(), 0, hasher(1), key_equal(1));
X y(vy.begin(), vy.end(), 0, hasher(2), key_equal(2));
swap_test_impl(x, y);
@ -91,7 +91,7 @@ void swap_tests2(X* ptr = 0)
#if BOOST_UNORDERED_SWAP_METHOD == 1
{
test::random_values<X> vx(100), vy(50);
test::random_values<X> vx(100, generator), vy(50, generator);
X x(vx.begin(), vx.end(), 0, hasher(), key_equal(), allocator_type(1));
X y(vy.begin(), vy.end(), 0, hasher(), key_equal(), allocator_type(2));
try {
@ -101,14 +101,14 @@ void swap_tests2(X* ptr = 0)
}
#else
{
test::random_values<X> vx(50), vy(100);
test::random_values<X> vx(50, generator), vy(100, generator);
X x(vx.begin(), vx.end(), 0, hasher(), key_equal(), allocator_type(1));
X y(vy.begin(), vy.end(), 0, hasher(), key_equal(), allocator_type(2));
swap_test_impl(x, y);
}
{
test::random_values<X> vx(100), vy(100);
test::random_values<X> vx(100, generator), vy(100, generator);
X x(vx.begin(), vx.end(), 0, hasher(1), key_equal(1), allocator_type(1));
X y(vy.begin(), vy.end(), 0, hasher(2), key_equal(2), allocator_type(2));
swap_test_impl(x, y);