diff --git a/test/more/run-tests.py b/test/more/run-tests.py
index 2dd1b24..33fb855 100755
--- a/test/more/run-tests.py
+++ b/test/more/run-tests.py
@@ -40,7 +40,7 @@ def main(argv):
# Walk the test directory
parser = etree.XMLParser()
-
+
try:
boostbook_xsl = etree.XSLT(
etree.parse(os.path.join(boostbook_directory, "docbook.xsl"), parser)
@@ -49,35 +49,43 @@ def main(argv):
print "Error parsing boostbook xsl:"
print error
sys.exit(1)
-
+
for root, dirs, files in os.walk(os.path.join(script_directory, 'tests')):
success = True
for filename in files:
(base, ext) = os.path.splitext(filename)
if (ext == '.xml'):
- src_path = os.path.join(root, filename)
- gold_path = os.path.join(root, base + '.gold')
- try:
- doc_text = run_boostbook(parser, boostbook_xsl, src_path)
- except:
- # TODO: Need better error reporting here:
- print "Error running boostbook for " + src_path
- success = False
- continue
-
- if (generate_gold):
- file = open(gold_path, 'w')
+ for consistent_ids in [False, True]:
+ if not consistent_ids:
+ gold_ext = ".gold"
+ else:
+ gold_ext = ".gold2"
+ src_path = os.path.join(root, filename)
+ gold_path = os.path.join(root, base + gold_ext)
try:
- file.write(doc_text)
- finally: file.close()
- else:
- file = open(gold_path, 'r')
- try:
- gold_text = file.read()
- finally:
- file.close()
- if not compare_xml(src_path, doc_text, gold_text):
+ if consistent_ids:
+ doc_text = run_boostbook_consistent_ids(parser, boostbook_xsl, src_path)
+ else:
+ doc_text = run_boostbook(parser, boostbook_xsl, src_path)
+ except:
+ # TODO: Need better error reporting here:
+ print "Error running boostbook for " + src_path
success = False
+ continue
+
+ if (generate_gold):
+ file = open(gold_path, 'w')
+ try:
+ file.write(doc_text)
+ finally: file.close()
+ else:
+ file = open(gold_path, 'r')
+ try:
+ gold_text = file.read()
+ finally:
+ file.close()
+ if not compare_xml(src_path, doc_text, gold_text):
+ success = False
if not success:
sys.exit(1)
@@ -87,17 +95,23 @@ def run_boostbook(parser, boostbook_xsl, file):
normalize_boostbook_ids(doc)
return etree.tostring(doc)
+def run_boostbook_consistent_ids(parser, boostbook_xsl, file):
+ doc = boostbook_xsl(etree.parse(file, parser), **{
+ 'generate.consistent.ids': '1'
+ })
+ return etree.tostring(doc)
+
def normalize_boostbook_ids(doc):
ids = {}
id_bases = defaultdict(int)
for node in doc.xpath("//*[starts-with(@id, 'id') or contains(@id, '_id')]"):
id = node.get('id')
-
+
if(id in ids):
print 'Duplicate id: ' + id
-
- match = re.match("(.+_id|id)([mp]?\d+)((?:-bb)?)", id)
+
+ match = re.match("(.+_id|id)([-mp]?[\d_]+)((?:-bb)?)", id)
if(match):
# Truncate id name, as it sometimes has different lengths...
match2 = re.match("(.*?)([^.]*?)(_?id)", match.group(1))
@@ -115,7 +129,7 @@ def normalize_boostbook_ids(doc):
def compare_xml(file, doc_text, gold_text):
# Had hoped to use xmldiff but it turned out to be a pain to install.
# So instead just do a text diff.
-
+
if (doc_text != gold_text):
print "Error: " + file
print
diff --git a/test/more/tests/book/boostbook.gold2 b/test/more/tests/book/boostbook.gold2
new file mode 100644
index 0000000..6f07643
--- /dev/null
+++ b/test/more/tests/book/boostbook.gold2
@@ -0,0 +1,4 @@
+
+
+ Test 'boostbook' root.
+
\ No newline at end of file
diff --git a/test/more/tests/book/chapter.gold2 b/test/more/tests/book/chapter.gold2
new file mode 100644
index 0000000..a57055b
--- /dev/null
+++ b/test/more/tests/book/chapter.gold2
@@ -0,0 +1,4 @@
+
+
+ Test 'boostbook' root.
+
\ No newline at end of file
diff --git a/test/more/tests/book/library-autoid.gold2 b/test/more/tests/book/library-autoid.gold2
new file mode 100644
index 0000000..7bbfdd5
--- /dev/null
+++ b/test/more/tests/book/library-autoid.gold2
@@ -0,0 +1,4 @@
+
+
+ Test 'boostbook' root.
+
\ No newline at end of file
diff --git a/test/more/tests/book/library.gold2 b/test/more/tests/book/library.gold2
new file mode 100644
index 0000000..5fb2b49
--- /dev/null
+++ b/test/more/tests/book/library.gold2
@@ -0,0 +1,4 @@
+
+
+ Test 'boostbook' root.
+
\ No newline at end of file
diff --git a/test/more/tests/libs/array.gold2 b/test/more/tests/libs/array.gold2
new file mode 100644
index 0000000..404f73b
--- /dev/null
+++ b/test/more/tests/libs/array.gold2
@@ -0,0 +1,311 @@
+
+
+
+ Nicolai
+ Josuttis
+
+ 2001
+ 2002
+ 2003
+ 2004
+ Nicolai M. Josuttis
+
+ 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)
+
+
+
+ Boost.Array
+
+
+ Introduction
+
+
+
+
+ The C++ Standard Template Library STL as part of the C++
+ Standard Library provides a framework for processing algorithms on
+ different kind of containers. However, ordinary arrays don't
+ provide the interface of STL containers (although, they provide
+ the iterator interface of STL containers).
+
+ As replacement for ordinary arrays, the STL provides class
+ std::vector. However,
+ std::vector<> provides
+ the semantics of dynamic arrays. Thus, it manages data to be able
+ to change the number of elements. This results in some overhead in
+ case only arrays with static size are needed.
+
+ In his book, Generic Programming and the
+ STL, Matthew H. Austern introduces a useful wrapper
+ class for ordinary arrays with static size, called
+ block. It is safer and has no worse performance than
+ ordinary arrays. In The C++ Programming
+ Language, 3rd edition, Bjarne Stroustrup introduces a
+ similar class, called c_array, which I (Nicolai Josuttis) present
+ slightly modified in my book The C++ Standard Library -
+ A Tutorial and Reference, called
+ carray. This is the essence of these approaches
+ spiced with many feedback from boost.
+
+ After considering different names, we decided to name this
+ class simply array.
+
+ Note that this class is suggested to be part of the next
+ Technical Report, which will extend the C++ Standard (see
+ http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1548.htm).
+
+ Class array fulfills most
+ but not all of the requirements of "reversible containers" (see
+ Section 23.1, [lib.container.requirements] of the C++
+ Standard). The reasons array is not an reversible STL container is
+ because:
+
+ No constructors are provided.
+ Elements may have an undetermined initial value (see ).
+ swap() has no constant complexity.
+ size() is always constant, based on the second template argument of the type.
+ The container provides no allocator support.
+
+
+
+ It doesn't fulfill the requirements of a "sequence" (see Section 23.1.1, [lib.sequence.reqmts] of the C++ Standard), except that:
+
+ front() and back() are provided.
+ operator[] and at() are provided.
+
+
+
+
+ Reference
+ Header <boost/array.hpp>namespaceboost{
+ template<typename T,std::size_t N>class array;
+ template<typename T,std::size_t N>voidswap(array<T,N>&, array<T,N>&);
+ template<typename T,std::size_t N>
+ booloperator==(const array<T,N>&,const array<T,N>&);
+ template<typename T,std::size_t N>
+ booloperator!=(const array<T,N>&,const array<T,N>&);
+ template<typename T,std::size_t N>
+ booloperator<(const array<T,N>&,const array<T,N>&);
+ template<typename T,std::size_t N>
+ booloperator>(const array<T,N>&,const array<T,N>&);
+ template<typename T,std::size_t N>
+ booloperator<=(const array<T,N>&,const array<T,N>&);
+ template<typename T,std::size_t N>
+ booloperator>=(const array<T,N>&,const array<T,N>&);
+}
+ Class template array3boost::arraySTL compliant container wrapper for arrays of constant size// In header: <boost/array.hpp>
+
+template<typename T,std::size_t N>
+class array {
+public:
+ // types
+ typedefTvalue_type;
+ typedefT*iterator;
+ typedefconstT*const_iterator;
+ typedef std::reverse_iterator<iterator>reverse_iterator;
+ typedef std::reverse_iterator<const_iterator>const_reverse_iterator;
+ typedefT&reference;
+ typedefconstT&const_reference;
+ typedefstd::size_tsize_type;
+ typedefstd::ptrdiff_tdifference_type;
+
+ // static constants
+ staticconstsize_typestatic_size = N;
+
+ // construct/copy/destruct
+ template<typename U> array& operator=(const array<U,N>&);
+
+ // iterator support
+ iteratorbegin();
+ const_iteratorbegin()const;
+ iteratorend();
+ const_iteratorend()const;
+
+ // reverse iterator support
+ reverse_iteratorrbegin();
+ const_reverse_iteratorrbegin()const;
+ reverse_iteratorrend();
+ const_reverse_iteratorrend()const;
+
+ // capacity
+ size_typesize();
+ boolempty();
+ size_typemax_size();
+
+ // element access
+ referenceoperator[](size_type);
+ const_referenceoperator[](size_type)const;
+ referenceat(size_type);
+ const_referenceat(size_type)const;
+ referencefront();
+ const_referencefront()const;
+ referenceback();
+ const_referenceback()const;
+ constT*data()const;
+ T*c_array();
+
+ // modifiers
+ voidswap(array<T,N>&);
+ voidassign(constT&);
+
+ // public data members
+ Telems[N];
+};
+
+// specialized algorithms
+template<typename T,std::size_t N>voidswap(array<T,N>&, array<T,N>&);
+
+// comparisons
+template<typename T,std::size_t N>
+ booloperator==(const array<T,N>&,const array<T,N>&);
+template<typename T,std::size_t N>
+ booloperator!=(const array<T,N>&,const array<T,N>&);
+template<typename T,std::size_t N>
+ booloperator<(const array<T,N>&,const array<T,N>&);
+template<typename T,std::size_t N>
+ booloperator>(const array<T,N>&,const array<T,N>&);
+template<typename T,std::size_t N>
+ booloperator<=(const array<T,N>&,const array<T,N>&);
+template<typename T,std::size_t N>
+ booloperator>=(const array<T,N>&,const array<T,N>&);Descriptionarray
+ public
+ construct/copy/destructtemplate<typename U> array& operator=(const array<U,N>& other);Effects:std::copy(rhs.begin(),rhs.end(), begin())array iterator supportiteratorbegin();
+const_iteratorbegin()const;Returns:iterator for the first elementThrows:will not throwiteratorend();
+const_iteratorend()const;Returns:iterator for position after the last elementThrows:will not throwarray reverse iterator supportreverse_iteratorrbegin();
+const_reverse_iteratorrbegin()const;Returns:reverse iterator for the first element of reverse iterationreverse_iteratorrend();
+const_reverse_iteratorrend()const;Returns:reverse iterator for position after the last element in reverse iterationarray capacitysize_typesize();Returns:Nboolempty();Returns:N==0Throws:will not throwsize_typemax_size();Returns:NThrows:will not throwarray element accessreferenceoperator[](size_type i);
+const_referenceoperator[](size_type i)const;Requires:i < NReturns:element with index iThrows:will not throw.referenceat(size_type i);
+const_referenceat(size_type i)const;Returns:element with index iThrows:std::range_error if i >= Nreferencefront();
+const_referencefront()const;Requires:N > 0Returns:the first elementThrows:will not throwreferenceback();
+const_referenceback()const;Requires:N > 0Returns:the last elementThrows:will not throwconstT*data()const;Returns:elemsThrows:will not throwT*c_array();Returns:elemsThrows:will not throwarray modifiersvoidswap(array<T,N>& other);Effects:std::swap_ranges(begin(), end(), other.begin())Complexity:linear in Nvoidassign(constT& value);Effects:std::fill_n(begin(), N, value)array specialized algorithmstemplate<typename T,std::size_t N>voidswap(array<T,N>& x, array<T,N>& y);Effects:x.swap(y)Throws:will not throw.array comparisonstemplate<typename T,std::size_t N>
+ booloperator==(const array<T,N>& x,const array<T,N>& y);Returns:std::equal(x.begin(), x.end(), y.begin())template<typename T,std::size_t N>
+ booloperator!=(const array<T,N>& x,const array<T,N>& y);Returns:!(x == y)template<typename T,std::size_t N>
+ booloperator<(const array<T,N>& x,const array<T,N>& y);Returns:std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end())template<typename T,std::size_t N>
+ booloperator>(const array<T,N>& x,const array<T,N>& y);Returns:y < xtemplate<typename T,std::size_t N>
+ booloperator<=(const array<T,N>& x,const array<T,N>& y);Returns:!(y < x)template<typename T,std::size_t N>
+ booloperator>=(const array<T,N>& x,const array<T,N>& y);Returns:!(x < y)
+
+
+
+
+ Design Rationale
+
+ There was an important design tradeoff regarding the
+ constructors: We could implement array as an "aggregate" (see
+ Section 8.5.1, [dcl.init.aggr], of the C++ Standard). This would
+ mean:
+
+ An array can be initialized with a
+ brace-enclosing, comma-separated list of initializers for the
+ elements of the container, written in increasing subscript
+ order:
+
+ boost::array<int,4> a = { { 1, 2, 3 } };
+
+ Note that if there are fewer elements in the
+ initializer list, then each remaining element gets
+ default-initialized (thus, it has a defined value).
+
+
+ However, this approach has its drawbacks: passing no initializer list means that the elements
+ have an indetermined initial value, because the rule says
+ that aggregates may have:
+
+ No user-declared constructors.
+ No private or protected non-static data members.
+ No base classes.
+ No virtual functions.
+
+
+
+ Nevertheless, The current implementation uses this approach.
+
+ Note that for standard conforming compilers it is possible to
+ use fewer braces (according to 8.5.1 (11) of the Standard). That is,
+ you can initialize an array as follows:
+
+
+boost::array<int,4> a = { 1, 2, 3 };
+
+
+ I'd appreciate any constructive feedback. Please note: I don't have time to read all boost
+ mails. Thus, to make sure that feedback arrives to me, please send
+ me a copy of each mail regarding this class.
+
+ The code is provided "as is" without expressed or implied
+ warranty.
+
+
+
+
+ For more information...
+ To find more details about using ordinary arrays in C++ and
+ the framework of the STL, see e.g.
+
+ The C++ Standard Library - A Tutorial and Reference
+by Nicolai M. Josuttis
+Addison Wesley Longman, 1999
+ISBN 0-201-37926-0
+
+
+ Home Page of Nicolai
+ Josuttis
+
+
+
+ Acknowledgements
+
+ Doug Gregor ported the documentation to the BoostBook format.
+
+
+
+
+
\ No newline at end of file
diff --git a/test/more/tests/libs/hash-ref.gold2 b/test/more/tests/libs/hash-ref.gold2
new file mode 100644
index 0000000..e3a08b4
--- /dev/null
+++ b/test/more/tests/libs/hash-ref.gold2
@@ -0,0 +1,397 @@
+
+Reference
+
+ For the full specification, see section 6.3 of the
+ C++ Standard Library Technical Report
+ and issue 6.18 of the
+ Library Extension Technical Report Issues List (page 63).
+
+
+ Header <boost/functional/hash.hpp>
+ Defines boost::hash,
+ and helper functions.
+ namespaceboost{
+ template<typename T>struct hash;
+
+ template<>struct hash<bool>;
+ template<>struct hash<char>;
+ template<>struct hash<signedchar>;
+ template<>struct hash<unsignedchar>;
+ template<>struct hash<wchar_t>;
+ template<>struct hash<short>;
+ template<>struct hash<unsignedshort>;
+ template<>struct hash<int>;
+ template<>struct hash<unsignedint>;
+ template<>struct hash<long>;
+ template<>struct hash<unsignedlong>;
+ template<>struct hash<longlong>;
+ template<>struct hash<unsignedlonglong>;
+ template<>struct hash<float>;
+ template<>struct hash<double>;
+ template<>struct hash<longdouble>;
+ template<>struct hash<std::string>;
+ template<>struct hash<std::wstring>;
+ template<typename T>struct hash<T*>;
+
+ // Support functions (Boost extension).
+ template<typename T>voidhash_combine(size_t&,Tconst&);
+ template<typename It>std::size_thash_range(It,It);
+ template<typename It>voidhash_range(std::size_t&,It,It);
+
+ // Overloadable hash implementation (Boost extension).
+ std::size_thash_value(bool);
+ std::size_thash_value(char);
+ std::size_thash_value(signedchar);
+ std::size_thash_value(unsignedchar);
+ std::size_thash_value(wchar_t);
+ std::size_thash_value(short);
+ std::size_thash_value(unsignedshort);
+ std::size_thash_value(int);
+ std::size_thash_value(unsignedint);
+ std::size_thash_value(long);
+ std::size_thash_value(unsignedlong);
+ std::size_thash_value(longlong);
+ std::size_thash_value(unsignedlonglong);
+ std::size_thash_value(float);
+ std::size_thash_value(double);
+ std::size_thash_value(longdouble);
+ template<typename T>std::size_thash_value(T*const&);
+ template<typename T,unsigned N>std::size_thash_value(T(&val)[N]);
+ template<typename T,unsigned N>std::size_thash_value(constT(&val)[N]);
+ template<typename Ch,typename A>
+ std::size_thash_value(std::basic_string<Ch,std::char_traits<Ch>,A>const&);
+ template<typename A,typename B>
+ std::size_thash_value(std::pair<A,B>const&);
+ template<typename T,typename A>
+ std::size_thash_value(std::vector<T,A>const&);
+ template<typename T,typename A>
+ std::size_thash_value(std::list<T,A>const&);
+ template<typename T,typename A>
+ std::size_thash_value(std::deque<T,A>const&);
+ template<typename K,typename C,typename A>
+ std::size_thash_value(std::set<K,C,A>const&);
+ template<typename K,typename C,typename A>
+ std::size_thash_value(std::multiset<K,C,A>const&);
+ template<typename K,typename T,typename C,typename A>
+ std::size_thash_value(std::map<K,T,C,A>const&);
+ template<typename K,typename T,typename C,typename A>
+ std::size_thash_value(std::multimap<K,T,C,A>const&);
+ template<typename T>std::size_thash_value(std::complex<T>const&);
+}
+
+
+ Support functions (Boost extension).template<typename T>voidhash_combine(size_t& seed,Tconst& v);
+ Called repeatedly to incrementally create a hash value from
+ several variables.
+ Effects:seed^= hash_value(v)+0x9e3779b9+(seed<<6)+(seed>>2);Notes:hash_value is called without
+ qualification, so that overloads can be found via ADL.This is an extension to TR1Throws:
+ Only throws if hash_value(T) throws.
+ Strong exception safety, as long as hash_value(T)
+ also has strong exception safety.
+ template<typename It>std::size_thash_range(It first,It last);
+template<typename It>voidhash_range(std::size_t& seed,It first,It last);
+ Calculate the combined hash value of the elements of an iterator
+ range.
+ Effects:For the two argument overload:
+
+size_tseed=0;
+
+for(;first!=last;++first)
+{
+ hash_combine(seed,*first);
+}
+
+returnseed;
+
+ For the three arguments overload:
+
+for(;first!=last;++first)
+{
+ hash_combine(seed,*first);
+}
+
+ Notes:
+ hash_range is sensitive to the order of the elements
+ so it wouldn't be appropriate to use this with an unordered
+ container.
+ This is an extension to TR1Throws:
+ Only throws if hash_value(std::iterator_traits<It>::value_type)
+ throws. hash_range(std::size_t&, It, It) has basic exception safety as long as
+ hash_value(std::iterator_traits<It>::value_type)
+ has basic exception safety.
+ Overloadable hash implementation (Boost extension).std::size_thash_value(bool val);
+std::size_thash_value(char val);
+std::size_thash_value(signedchar val);
+std::size_thash_value(unsignedchar val);
+std::size_thash_value(wchar_t val);
+std::size_thash_value(short val);
+std::size_thash_value(unsignedshort val);
+std::size_thash_value(int val);
+std::size_thash_value(unsignedint val);
+std::size_thash_value(long val);
+std::size_thash_value(unsignedlong val);
+std::size_thash_value(longlong val);
+std::size_thash_value(unsignedlonglong val);
+std::size_thash_value(float val);
+std::size_thash_value(double val);
+std::size_thash_value(longdouble val);
+template<typename T>std::size_thash_value(T*const& val);
+template<typename T,unsigned N>std::size_thash_value(T(&val)[N]);
+template<typename T,unsigned N>std::size_thash_value(constT(&val)[N]);
+template<typename Ch,typename A>
+ std::size_thash_value(std::basic_string<Ch,std::char_traits<Ch>,A>const& val);
+template<typename A,typename B>
+ std::size_thash_value(std::pair<A,B>const& val);
+template<typename T,typename A>
+ std::size_thash_value(std::vector<T,A>const& val);
+template<typename T,typename A>
+ std::size_thash_value(std::list<T,A>const& val);
+template<typename T,typename A>
+ std::size_thash_value(std::deque<T,A>const& val);
+template<typename K,typename C,typename A>
+ std::size_thash_value(std::set<K,C,A>const& val);
+template<typename K,typename C,typename A>
+ std::size_thash_value(std::multiset<K,C,A>const& val);
+template<typename K,typename T,typename C,typename A>
+ std::size_thash_value(std::map<K,T,C,A>const& val);
+template<typename K,typename T,typename C,typename A>
+ std::size_thash_value(std::multimap<K,T,C,A>const& val);
+template<typename T>std::size_thash_value(std::complex<T>const& val);
+ Implementation of the hash function.
+
+ Generally shouldn't be called directly by users, instead they should use
+ boost::hash, boost::hash_range
+ or boost::hash_combine which
+ call hash_value without namespace qualification so that overloads
+ for custom types are found via ADL.
+ Notes:This is an extension to TR1Throws:
+ Only throws if a user supplied version of
+ hash_value
+ throws for an element of a container, or
+ one of the types stored in a pair.
+ Returns:
+
+
+
+ Types
+ Returns
+
+
+
+
+ bool,
+ char, signed char, unsigned char, wchar_t,
+ short, unsigned short,
+ int, unsigned int, long, unsigned long
+
+ val
+
+
+ long long, unsigned long long
+ val when abs(val) <= std::numeric_limits<std::size_t>::max().
+
+
+ float, double, long double
+ An unspecified value, except that equal arguments shall yield the same result.
+
+
+ T*
+ An unspecified value, except that equal arguments shall yield the same result.
+
+
+
+ T val[N],
+ const T val[N]
+
+ hash_range(val, val+N)
+
+
+
+ std:basic_string<Ch, std::char_traits<Ch>, A>,
+ std::vector<T, A>,
+ std::list<T, A>,
+ std::deque<T, A>,
+ std::set<K, C, A>,
+ std::multiset<K, C, A>,
+ std::map<K, T, C, A>,
+ std::multimap<K, T, C, A>
+
+ hash_range(val.begin(), val.end())
+
+
+ std::pair<A, B>
+ size_tseed=0;
+hash_combine(seed,val.first);
+hash_combine(seed,val.second);
+returnseed;
+
+
+
+ std::complex<T>
+
+ When T is a built in type and val.imag() == 0, the result is equal to hash_value(val.real()). Otherwise an unspecified value, except that equal arguments shall yield the same result.
+
+
+
+ Struct template hash3boost::hashA TR1 compliant hash function object.// In header: <boost/functional/hash.hpp>
+
+template<typename T>
+struct hash :public std::unary_function<T, std::size_t> {
+ std::size_toperator()(Tconst&)const;
+};Descriptionstd::size_toperator()(Tconst& val)const;Returns:
+ hash_value(val)
+ Notes:
+ The call to hash_value
+ is unqualified, so that custom overloads can be
+ found via argument dependent lookup.
+
+ This is not defined when the macro BOOST_HASH_NO_EXTENSIONS
+ is defined. The specializations are still defined, so only the specializations
+ required by TR1 are defined.
+ Throws:
+ Only throws if
+ hash_value(T) throws.
+ Struct hash<bool>3boost::hash<bool>// In header: <boost/functional/hash.hpp>
+
+
+struct hash<bool>{
+ std::size_toperator()(bool)const;
+};Descriptionstd::size_toperator()(bool val)const;Returns:Unspecified in TR1, except that equal arguments yield the same result.hash_value(val) in Boost.Throws:Doesn't throwStruct hash<char>3boost::hash<char>// In header: <boost/functional/hash.hpp>
+
+
+struct hash<char>{
+ std::size_toperator()(char)const;
+};Descriptionstd::size_toperator()(char val)const;Returns:Unspecified in TR1, except that equal arguments yield the same result.hash_value(val) in Boost.Throws:Doesn't throwStruct hash<signed char>3boost::hash<signed char>// In header: <boost/functional/hash.hpp>
+
+
+struct hash<signedchar>{
+ std::size_toperator()(signedchar)const;
+};Descriptionstd::size_toperator()(signedchar val)const;Returns:Unspecified in TR1, except that equal arguments yield the same result.hash_value(val) in Boost.Throws:Doesn't throwStruct hash<unsigned char>3boost::hash<unsigned char>// In header: <boost/functional/hash.hpp>
+
+
+struct hash<unsignedchar>{
+ std::size_toperator()(unsignedchar)const;
+};Descriptionstd::size_toperator()(unsignedchar val)const;Returns:Unspecified in TR1, except that equal arguments yield the same result.hash_value(val) in Boost.Throws:Doesn't throwStruct hash<wchar_t>3boost::hash<wchar_t>// In header: <boost/functional/hash.hpp>
+
+
+struct hash<wchar_t>{
+ std::size_toperator()(wchar_t)const;
+};Descriptionstd::size_toperator()(wchar_t val)const;Returns:Unspecified in TR1, except that equal arguments yield the same result.hash_value(val) in Boost.Throws:Doesn't throwStruct hash<short>3boost::hash<short>// In header: <boost/functional/hash.hpp>
+
+
+struct hash<short>{
+ std::size_toperator()(short)const;
+};Descriptionstd::size_toperator()(short val)const;Returns:Unspecified in TR1, except that equal arguments yield the same result.hash_value(val) in Boost.Throws:Doesn't throwStruct hash<unsigned short>3boost::hash<unsigned short>// In header: <boost/functional/hash.hpp>
+
+
+struct hash<unsignedshort>{
+ std::size_toperator()(unsignedshort)const;
+};Descriptionstd::size_toperator()(unsignedshort val)const;Returns:Unspecified in TR1, except that equal arguments yield the same result.hash_value(val) in Boost.Throws:Doesn't throwStruct hash<int>3boost::hash<int>// In header: <boost/functional/hash.hpp>
+
+
+struct hash<int>{
+ std::size_toperator()(int)const;
+};Descriptionstd::size_toperator()(int val)const;Returns:Unspecified in TR1, except that equal arguments yield the same result.hash_value(val) in Boost.Throws:Doesn't throwStruct hash<unsigned int>3boost::hash<unsigned int>// In header: <boost/functional/hash.hpp>
+
+
+struct hash<unsignedint>{
+ std::size_toperator()(unsignedint)const;
+};Descriptionstd::size_toperator()(unsignedint val)const;Returns:Unspecified in TR1, except that equal arguments yield the same result.hash_value(val) in Boost.Throws:Doesn't throwStruct hash<long>3boost::hash<long>// In header: <boost/functional/hash.hpp>
+
+
+struct hash<long>{
+ std::size_toperator()(long)const;
+};Descriptionstd::size_toperator()(long val)const;Returns:Unspecified in TR1, except that equal arguments yield the same result.hash_value(val) in Boost.Throws:Doesn't throwStruct hash<unsigned long>3boost::hash<unsigned long>// In header: <boost/functional/hash.hpp>
+
+
+struct hash<unsignedlong>{
+ std::size_toperator()(unsignedlong)const;
+};Descriptionstd::size_toperator()(unsignedlong val)const;Returns:Unspecified in TR1, except that equal arguments yield the same result.hash_value(val) in Boost.Throws:Doesn't throwStruct hash<long long>3boost::hash<long long>// In header: <boost/functional/hash.hpp>
+
+
+struct hash<longlong>{
+ std::size_toperator()(longlong)const;
+};Descriptionstd::size_toperator()(longlong val)const;Returns:Unspecified in TR1, except that equal arguments yield the same result.hash_value(val) in Boost.Throws:Doesn't throwStruct hash<unsigned long long>3boost::hash<unsigned long long>// In header: <boost/functional/hash.hpp>
+
+
+struct hash<unsignedlonglong>{
+ std::size_toperator()(unsignedlonglong)const;
+};Descriptionstd::size_toperator()(unsignedlonglong val)const;Returns:Unspecified in TR1, except that equal arguments yield the same result.hash_value(val) in Boost.Throws:Doesn't throwStruct hash<float>3boost::hash<float>// In header: <boost/functional/hash.hpp>
+
+
+struct hash<float>{
+ std::size_toperator()(float)const;
+};Descriptionstd::size_toperator()(float val)const;Returns:Unspecified in TR1, except that equal arguments yield the same result.hash_value(val) in Boost.Throws:Doesn't throwStruct hash<double>3boost::hash<double>// In header: <boost/functional/hash.hpp>
+
+
+struct hash<double>{
+ std::size_toperator()(double)const;
+};Descriptionstd::size_toperator()(double val)const;Returns:Unspecified in TR1, except that equal arguments yield the same result.hash_value(val) in Boost.Throws:Doesn't throwStruct hash<long double>3boost::hash<long double>// In header: <boost/functional/hash.hpp>
+
+
+struct hash<longdouble>{
+ std::size_toperator()(longdouble)const;
+};Descriptionstd::size_toperator()(longdouble val)const;Returns:Unspecified in TR1, except that equal arguments yield the same result.hash_value(val) in Boost.Throws:Doesn't throwStruct hash<std::string>3boost::hash<std::string>// In header: <boost/functional/hash.hpp>
+
+
+struct hash<std::string>{
+ std::size_toperator()(std::stringconst&)const;
+};Descriptionstd::size_toperator()(std::stringconst& val)const;Returns:Unspecified in TR1, except that equal arguments yield the same result.hash_value(val) in Boost.Throws:Doesn't throwStruct hash<std::wstring>3boost::hash<std::wstring>// In header: <boost/functional/hash.hpp>
+
+
+struct hash<std::wstring>{
+ std::size_toperator()(std::wstringconst&)const;
+};Descriptionstd::size_toperator()(std::wstringconst& val)const;Returns:Unspecified in TR1, except that equal arguments yield the same result.hash_value(val) in Boost.Throws:Doesn't throwStruct template hash<T*>3boost::hash<T*>// In header: <boost/functional/hash.hpp>
+
+template<typename T>
+struct hash<T*>{
+ std::size_toperator()(T*)const;
+};Descriptionstd::size_toperator()(T* val)const;Returns:Unspecified in TR1, except that equal arguments yield the same result.Throws:Doesn't throw
+
+
\ No newline at end of file
diff --git a/test/more/tests/libs/unordered-ref.gold2 b/test/more/tests/libs/unordered-ref.gold2
new file mode 100644
index 0000000..0a501a2
--- /dev/null
+++ b/test/more/tests/libs/unordered-ref.gold2
@@ -0,0 +1,1508 @@
+
+Reference
+ Header <boost/unordered_set.hpp>namespaceboost{
+ template<typename Value,typename Hash =boost::hash<Value>,
+ typename Pred =std::equal_to<Value>,
+ typename Alloc =std::allocator<Value>>
+ class unordered_set;
+ template<typename Value,typename Hash,typename Pred,typename Alloc>
+ booloperator==(unordered_set<Value,Hash,Pred,Alloc>const&,
+ unordered_set<Value,Hash,Pred,Alloc>const&);
+ template<typename Value,typename Hash,typename Pred,typename Alloc>
+ booloperator!=(unordered_set<Value,Hash,Pred,Alloc>const&,
+ unordered_set<Value,Hash,Pred,Alloc>const&);
+ template<typename Value,typename Hash,typename Pred,typename Alloc>
+ voidswap(unordered_set<Value,Hash,Pred,Alloc>&,
+ unordered_set<Value,Hash,Pred,Alloc>&);
+ template<typename Value,typename Hash =boost::hash<Value>,
+ typename Pred =std::equal_to<Value>,
+ typename Alloc =std::allocator<Value>>
+ class unordered_multiset;
+ template<typename Value,typename Hash,typename Pred,typename Alloc>
+ booloperator==(unordered_multiset<Value,Hash,Pred,Alloc>const&,
+ unordered_multiset<Value,Hash,Pred,Alloc>const&);
+ template<typename Value,typename Hash,typename Pred,typename Alloc>
+ booloperator!=(unordered_multiset<Value,Hash,Pred,Alloc>const&,
+ unordered_multiset<Value,Hash,Pred,Alloc>const&);
+ template<typename Value,typename Hash,typename Pred,typename Alloc>
+ voidswap(unordered_multiset<Value,Hash,Pred,Alloc>&,
+ unordered_multiset<Value,Hash,Pred,Alloc>&);
+}
+ Class template unordered_set3boost::unordered_set
+ An unordered associative container that stores unique values.
+ // In header: <boost/unordered_set.hpp>
+
+template<typename Value,typename Hash =boost::hash<Value>,
+ typename Pred =std::equal_to<Value>,
+ typename Alloc =std::allocator<Value>>
+class unordered_set {
+public:
+ // types
+ typedefValuekey_type;
+ typedefValuevalue_type;
+ typedefHashhasher;
+ typedefPredkey_equal;
+ typedefAllocallocator_type;
+ typedeftypenameallocator_type::pointerpointer;
+ typedeftypenameallocator_type::const_pointerconst_pointer;
+ typedeftypenameallocator_type::referencereference;// lvalue of value_type.
+ typedeftypenameallocator_type::const_referenceconst_reference;// const lvalue of value_type.
+ typedefimplementation-definedsize_type;
+ typedefimplementation-defineddifference_type;
+ typedefimplementation-definediterator;
+ typedefimplementation-definedconst_iterator;
+ typedefimplementation-definedlocal_iterator;
+ typedefimplementation-definedconst_local_iterator;
+
+ // construct/copy/destruct
+ explicitunordered_set(size_type=implementation-defined,
+ hasherconst&=hasher(),
+ key_equalconst&=key_equal(),
+ allocator_typeconst&=allocator_type());
+ template<typename InputIterator>
+ unordered_set(InputIterator,InputIterator,
+ size_type=implementation-defined,
+ hasherconst&=hasher(),key_equalconst&=key_equal(),
+ allocator_typeconst&=allocator_type());
+ unordered_set(unordered_setconst&);
+ unordered_set(unordered_set&&);
+ explicitunordered_set(Allocatorconst&);
+ unordered_set(unordered_setconst&,Allocatorconst&);
+ ~unordered_set();
+ unordered_set&operator=(unordered_setconst&);
+ unordered_set&operator=(unordered_set&&);
+ allocator_typeget_allocator()const;
+
+ // size and capacity
+ boolempty()const;
+ size_typesize()const;
+ size_typemax_size()const;
+
+ // iterators
+ iteratorbegin();
+ const_iteratorbegin()const;
+ iteratorend();
+ const_iteratorend()const;
+ const_iteratorcbegin()const;
+ const_iteratorcend()const;
+
+ // modifiers
+ template<typename... Args>std::pair<iterator,bool>emplace(Args&&...);
+ template<typename... Args>iteratoremplace_hint(const_iterator,Args&&...);
+ std::pair<iterator,bool>insert(value_typeconst&);
+ iteratorinsert(const_iterator,value_typeconst&);
+ template<typename InputIterator>voidinsert(InputIterator,InputIterator);
+ iteratorerase(const_iterator);
+ size_typeerase(key_typeconst&);
+ iteratorerase(const_iterator,const_iterator);
+ voidquick_erase(const_iterator);
+ voiderase_return_void(const_iterator);
+ voidclear();
+ voidswap(unordered_set&);
+
+ // observers
+ hasherhash_function()const;
+ key_equalkey_eq()const;
+
+ // lookup
+ iteratorfind(key_typeconst&);
+ const_iteratorfind(key_typeconst&)const;
+ template<typename CompatibleKey,typename CompatibleHash,
+ typename CompatiblePredicate>
+ iteratorfind(CompatibleKeyconst&,CompatibleHashconst&,
+ CompatiblePredicateconst&);
+ template<typename CompatibleKey,typename CompatibleHash,
+ typename CompatiblePredicate>
+ const_iterator
+ find(CompatibleKeyconst&,CompatibleHashconst&,
+ CompatiblePredicateconst&)const;
+ size_typecount(key_typeconst&)const;
+ std::pair<iterator,iterator>equal_range(key_typeconst&);
+ std::pair<const_iterator,const_iterator>equal_range(key_typeconst&)const;
+
+ // bucket interface
+ size_typebucket_count()const;
+ size_typemax_bucket_count()const;
+ size_typebucket_size(size_type)const;
+ size_typebucket(key_typeconst&)const;
+ local_iteratorbegin(size_type);
+ const_local_iteratorbegin(size_type)const;
+ local_iteratorend(size_type);
+ const_local_iteratorend(size_type)const;
+ const_local_iteratorcbegin(size_type)const;
+ const_local_iteratorcend(size_type);
+
+ // hash policy
+ floatload_factor()const;
+ floatmax_load_factor()const;
+ voidmax_load_factor(float);
+ voidrehash(size_type);
+};
+
+// Equality Comparisons
+template<typename Value,typename Hash,typename Pred,typename Alloc>
+ booloperator==(unordered_set<Value,Hash,Pred,Alloc>const&,
+ unordered_set<Value,Hash,Pred,Alloc>const&);
+template<typename Value,typename Hash,typename Pred,typename Alloc>
+ booloperator!=(unordered_set<Value,Hash,Pred,Alloc>const&,
+ unordered_set<Value,Hash,Pred,Alloc>const&);
+
+// swap
+template<typename Value,typename Hash,typename Pred,typename Alloc>
+ voidswap(unordered_set<Value,Hash,Pred,Alloc>&,
+ unordered_set<Value,Hash,Pred,Alloc>&);Description
+ Based on chapter 23 of
+ the working draft of the C++ standard [n2960].
+ But without the updated rules for allocators.
+
+ Template Parameters
+
+
+
+
+ Value
+ Value must be Assignable and CopyConstructible
+
+ Hash
+ A unary function object type that acts a hash function for a Value. It takes a single argument of type Value and returns a value of type std::size_t.
+
+ Pred
+ A binary function object that implements an equivalence relation on values of type Value.
+ A binary function object that induces an equivalence relation on values of type Key.
+ It takes two arguments of type Key and returns a value of type bool.
+
+ Alloc
+ An allocator whose value type is the same as the container's value type.
+ The elements are organized into buckets. Keys with the same hash code are stored in the same bucket.
+ The number of buckets can be automatically increased by a call to insert, or as the result of calling rehash.
+ unordered_set
+ public
+ types
+typedefimplementation-definedsize_type;
+ An unsigned integral type.
+ size_type can represent any non-negative value of difference_type.
+
+typedefimplementation-defineddifference_type;
+ A signed integral type.
+ Is identical to the difference type of iterator and const_iterator.
+
+typedefimplementation-definediterator;
+ A constant iterator whose value type is value_type.
+ The iterator category is at least a forward iterator.
+ Convertible to const_iterator.
+
+typedefimplementation-definedconst_iterator;
+ A constant iterator whose value type is value_type.
+ The iterator category is at least a forward iterator.
+
+typedefimplementation-definedlocal_iterator;
+ An iterator with the same value type, difference type and pointer and reference type as iterator.
+ A local_iterator object can be used to iterate through a single bucket.
+
+typedefimplementation-definedconst_local_iterator;
+ A constant iterator with the same value type, difference type and pointer and reference type as const_iterator.
+ A const_local_iterator object can be used to iterate through a single bucket.
+ unordered_set
+ public
+ construct/copy/destructexplicitunordered_set(size_type n =implementation-defined,
+ hasherconst& hf =hasher(),
+ key_equalconst& eq =key_equal(),
+ allocator_typeconst& a =allocator_type());Constructs an empty container with at least n buckets, using hf as the hash function, eq as the key equality predicate, a as the allocator and a maximum load factor of 1.0.Postconditions:size() == 0template<typename InputIterator>
+ unordered_set(InputIterator f,InputIterator l,
+ size_type n =implementation-defined,
+ hasherconst& hf =hasher(),
+ key_equalconst& eq =key_equal(),
+ allocator_typeconst& a =allocator_type());Constructs an empty container with at least n buckets, using hf as the hash function, eq as the key equality predicate, a as the allocator and a maximum load factor of 1.0 and inserts the elements from [f, l) into it.unordered_set(unordered_setconst&);The copy constructor. Copies the contained elements, hash function, predicate, maximum load factor and allocator.Requires:value_type is copy constructibleunordered_set(unordered_set&&);The move constructor.Notes:This is emulated on compilers without rvalue references.Requires:
+ value_type is move constructible.
+ (TODO: This is not actually required in this implementation).
+ explicitunordered_set(Allocatorconst& a);Constructs an empty container, using allocator a.unordered_set(unordered_setconst& x,Allocatorconst& a);Constructs an container, copying x's contained elements, hash function, predicate, maximum load factor, but using allocator a.~unordered_set();Notes:The destructor is applied to every element, and all memory is deallocatedunordered_set&operator=(unordered_setconst&);The assignment operator. Copies the contained elements, hash function, predicate and maximum load factor but not the allocator.Notes:
+ On compilers without rvalue references, there is a single assignment
+ operator with the signature operator=(unordered_set)
+ in order to emulate move semantics.
+ Requires:value_type is copy constructibleunordered_set&operator=(unordered_set&&);The move assignment operator.Notes:
+ On compilers without rvalue references, there is a single assignment
+ operator with the signature operator=(unordered_set)
+ in order to emulate move semantics.
+ Requires:
+ value_type is move constructible.
+ (TODO: This is not actually required in this implementation).
+ allocator_typeget_allocator()const;unordered_set size and capacityboolempty()const;Returns:size() == 0size_typesize()const;Returns:std::distance(begin(), end())size_typemax_size()const;Returns:size() of the largest possible container.
+ unordered_set iteratorsiteratorbegin();
+const_iteratorbegin()const;Returns:An iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container.
+ iteratorend();
+const_iteratorend()const;Returns:An iterator which refers to the past-the-end value for the container.
+ const_iteratorcbegin()const;Returns:A constant iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container.
+ const_iteratorcend()const;Returns:A constant iterator which refers to the past-the-end value for the container.
+ unordered_set modifierstemplate<typename... Args>std::pair<iterator,bool>emplace(Args&&... args);Inserts an object, constructed with the arguments args, in the container if and only if there is no element in the container with an equivalent value.Returns:The bool component of the return type is true if an insert took place.If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent value.Throws:If an exception is thrown by an operation other than a call to hasher the function has no effect.Notes:Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.Pointers and references to elements are never invalidated.If the compiler doesn't support variadic template arguments or rvalue
+ references, this is emulated for up to 10 arguments, with no support
+ for rvalue references or move semantics.template<typename... Args>
+ iteratoremplace_hint(const_iterator hint,Args&&... args);Inserts an object, constructed with the arguments args, in the container if and only if there is no element in the container with an equivalent value.hint is a suggestion to where the element should be inserted.Returns:If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent value.Throws:If an exception is thrown by an operation other than a call to hasher the function has no effect.Notes:The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same value. Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.Pointers and references to elements are never invalidated.If the compiler doesn't support variadic template arguments or rvalue
+ references, this is emulated for up to 10 arguments, with no support
+ for rvalue references or move semantics.std::pair<iterator,bool>insert(value_typeconst& obj);Inserts obj in the container if and only if there is no element in the container with an equivalent value.Returns:The bool component of the return type is true if an insert took place.If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent value.Throws:If an exception is thrown by an operation other than a call to hasher the function has no effect.Notes:Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.Pointers and references to elements are never invalidated.iteratorinsert(const_iterator hint,value_typeconst& obj);Inserts obj in the container if and only if there is no element in the container with an equivalent value.hint is a suggestion to where the element should be inserted.Returns:If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent value.Throws:If an exception is thrown by an operation other than a call to hasher the function has no effect.Notes:The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same value. Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.Pointers and references to elements are never invalidated.template<typename InputIterator>
+ voidinsert(InputIterator first,InputIterator last);Inserts a range of elements into the container. Elements are inserted if and only if there is no element in the container with an equivalent value.Throws:When inserting a single element, if an exception is thrown by an operation other than a call to hasher the function has no effect.Notes:Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.Pointers and references to elements are never invalidated.iteratorerase(const_iterator position);Erase the element pointed to by position.Returns:The iterator following position before the erasure.Throws:Only throws an exception if it is thrown by hasher or key_equal.In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.Notes:
+ When the number of elements is a lot smaller than the number of buckets
+ this function can be very inefficient as it has to search through empty
+ buckets for the next element, in order to return the iterator.
+ The method quick_erase is faster, but has yet
+ to be standardized.
+ size_typeerase(key_typeconst& k);Erase all elements with key equivalent to k.Returns:The number of elements erased.Throws:Only throws an exception if it is thrown by hasher or key_equal.iteratorerase(const_iterator first,const_iterator last);Erases the elements in the range from first to last.Returns:The iterator following the erased elements - i.e. last.Throws:Only throws an exception if it is thrown by hasher or key_equal.In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.voidquick_erase(const_iterator position);Erase the element pointed to by position.Throws:Only throws an exception if it is thrown by hasher or key_equal.In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.Notes:
+ This method is faster than erase as
+ it doesn't have to find the next element in the container -
+ a potentially costly operation.
+
+ As it hasn't been standardized, it's likely that this may
+ change in the future.
+ voiderase_return_void(const_iterator position);Erase the element pointed to by position.Throws:Only throws an exception if it is thrown by hasher or key_equal.In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.Notes:
+ This method is now deprecated, use
+ quick_return instead. Although be
+ warned that as that isn't standardized yet, it could also
+ change.
+ voidclear();Erases all elements in the container.Postconditions:size() == 0Throws:Never throws an exception.voidswap(unordered_set&);Throws:If the allocators are equal, doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of key_equal or hasher.Notes:For a discussion of the behavior when allocators aren't equal see
+ the implementation details.unordered_set observershasherhash_function()const;Returns:The container's hash function.
+ key_equalkey_eq()const;Returns:The container's key equality predicate.
+ unordered_set lookupiteratorfind(key_typeconst& k);
+const_iteratorfind(key_typeconst& k)const;
+template<typename CompatibleKey,typename CompatibleHash,
+ typename CompatiblePredicate>
+ iteratorfind(CompatibleKeyconst& k,CompatibleHashconst& hash,
+ CompatiblePredicateconst& eq);
+template<typename CompatibleKey,typename CompatibleHash,
+ typename CompatiblePredicate>
+ const_iterator
+ find(CompatibleKeyconst& k,CompatibleHashconst& hash,
+ CompatiblePredicateconst& eq)const;Returns:An iterator pointing to an element with key equivalent to k, or b.end() if no such element exists.Notes:
+ The templated overloads are a non-standard extensions which
+ allows you to use a compatible hash function and equality
+ predicate for a key of a different type in order to avoid
+ an expensive type cast. In general, its use is not encouraged.
+ size_typecount(key_typeconst& k)const;Returns:The number of elements with key equivalent to k.std::pair<iterator,iterator>equal_range(key_typeconst& k);
+std::pair<const_iterator,const_iterator>equal_range(key_typeconst& k)const;Returns:A range containing all elements with key equivalent to k.
+ If the container doesn't container any such elements, returns
+ std::make_pair(b.end(),b.end()).
+ unordered_set bucket interfacesize_typebucket_count()const;Returns:The number of buckets.size_typemax_bucket_count()const;Returns:An upper bound on the number of buckets.size_typebucket_size(size_type n)const;Requires:n < bucket_count()Returns:The number of elements in bucket n.size_typebucket(key_typeconst& k)const;Returns:The index of the bucket which would contain an element with key k.Postconditions:The return value is less than bucket_count()local_iteratorbegin(size_type n);
+const_local_iteratorbegin(size_type n)const;Requires:n shall be in the range [0, bucket_count()).Returns:A local iterator pointing the first element in the bucket with index n.local_iteratorend(size_type n);
+const_local_iteratorend(size_type n)const;Requires:n shall be in the range [0, bucket_count()).Returns:A local iterator pointing the 'one past the end' element in the bucket with index n.const_local_iteratorcbegin(size_type n)const;Requires:n shall be in the range [0, bucket_count()).Returns:A constant local iterator pointing the first element in the bucket with index n.const_local_iteratorcend(size_type n);Requires:n shall be in the range [0, bucket_count()).Returns:A constant local iterator pointing the 'one past the end' element in the bucket with index n.unordered_set hash policyfloatload_factor()const;Returns:The average number of elements per bucket.floatmax_load_factor()const;Returns:Returns the current maximum load factor.voidmax_load_factor(float z);Effects:Changes the container's maximum load factor, using z as a hint.voidrehash(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.Invalidates iterators, and changes the order of elements. Pointers and references to elements are not invalidated.Throws:The function has no effect if an exception is thrown, unless it is thrown by the container's hash function or comparison function.unordered_set Equality Comparisonstemplate<typename Value,typename Hash,typename Pred,typename Alloc>
+ booloperator==(unordered_set<Value,Hash,Pred,Alloc>const& x,
+ unordered_set<Value,Hash,Pred,Alloc>const& y);Notes:This is a boost extension.Behavior is undefined if the two containers don't have
+ equivalent equality predicates.template<typename Value,typename Hash,typename Pred,typename Alloc>
+ booloperator!=(unordered_set<Value,Hash,Pred,Alloc>const& x,
+ unordered_set<Value,Hash,Pred,Alloc>const& y);Notes:This is a boost extension.Behavior is undefined if the two containers don't have
+ equivalent equality predicates.unordered_set swaptemplate<typename Value,typename Hash,typename Pred,typename Alloc>
+ voidswap(unordered_set<Value,Hash,Pred,Alloc>& x,
+ unordered_set<Value,Hash,Pred,Alloc>& y);Effects:x.swap(y)Throws:If the allocators are equal, doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of Hash or Pred.Notes:For a discussion of the behavior when allocators aren't equal see
+ the implementation details.Class template unordered_multiset3boost::unordered_multiset
+ An unordered associative container that stores values. The same key can be stored multiple times.
+ // In header: <boost/unordered_set.hpp>
+
+template<typename Value,typename Hash =boost::hash<Value>,
+ typename Pred =std::equal_to<Value>,
+ typename Alloc =std::allocator<Value>>
+class unordered_multiset {
+public:
+ // types
+ typedefValuekey_type;
+ typedefValuevalue_type;
+ typedefHashhasher;
+ typedefPredkey_equal;
+ typedefAllocallocator_type;
+ typedeftypenameallocator_type::pointerpointer;
+ typedeftypenameallocator_type::const_pointerconst_pointer;
+ typedeftypenameallocator_type::referencereference;// lvalue of value_type.
+ typedeftypenameallocator_type::const_referenceconst_reference;// const lvalue of value_type.
+ typedefimplementation-definedsize_type;
+ typedefimplementation-defineddifference_type;
+ typedefimplementation-definediterator;
+ typedefimplementation-definedconst_iterator;
+ typedefimplementation-definedlocal_iterator;
+ typedefimplementation-definedconst_local_iterator;
+
+ // construct/copy/destruct
+ explicitunordered_multiset(size_type=implementation-defined,
+ hasherconst&=hasher(),
+ key_equalconst&=key_equal(),
+ allocator_typeconst&=allocator_type());
+ template<typename InputIterator>
+ unordered_multiset(InputIterator,InputIterator,
+ size_type=implementation-defined,
+ hasherconst&=hasher(),
+ key_equalconst&=key_equal(),
+ allocator_typeconst&=allocator_type());
+ unordered_multiset(unordered_multisetconst&);
+ unordered_multiset(unordered_multiset&&);
+ explicitunordered_multiset(Allocatorconst&);
+ unordered_multiset(unordered_multisetconst&,Allocatorconst&);
+ ~unordered_multiset();
+ unordered_multiset&operator=(unordered_multisetconst&);
+ unordered_multiset&operator=(unordered_multiset&&);
+ allocator_typeget_allocator()const;
+
+ // size and capacity
+ boolempty()const;
+ size_typesize()const;
+ size_typemax_size()const;
+
+ // iterators
+ iteratorbegin();
+ const_iteratorbegin()const;
+ iteratorend();
+ const_iteratorend()const;
+ const_iteratorcbegin()const;
+ const_iteratorcend()const;
+
+ // modifiers
+ template<typename... Args>iteratoremplace(Args&&...);
+ template<typename... Args>iteratoremplace_hint(const_iterator,Args&&...);
+ iteratorinsert(value_typeconst&);
+ iteratorinsert(const_iterator,value_typeconst&);
+ template<typename InputIterator>voidinsert(InputIterator,InputIterator);
+ iteratorerase(const_iterator);
+ size_typeerase(key_typeconst&);
+ iteratorerase(const_iterator,const_iterator);
+ voidquick_erase(const_iterator);
+ voiderase_return_void(const_iterator);
+ voidclear();
+ voidswap(unordered_multiset&);
+
+ // observers
+ hasherhash_function()const;
+ key_equalkey_eq()const;
+
+ // lookup
+ iteratorfind(key_typeconst&);
+ const_iteratorfind(key_typeconst&)const;
+ template<typename CompatibleKey,typename CompatibleHash,
+ typename CompatiblePredicate>
+ iteratorfind(CompatibleKeyconst&,CompatibleHashconst&,
+ CompatiblePredicateconst&);
+ template<typename CompatibleKey,typename CompatibleHash,
+ typename CompatiblePredicate>
+ const_iterator
+ find(CompatibleKeyconst&,CompatibleHashconst&,
+ CompatiblePredicateconst&)const;
+ size_typecount(key_typeconst&)const;
+ std::pair<iterator,iterator>equal_range(key_typeconst&);
+ std::pair<const_iterator,const_iterator>equal_range(key_typeconst&)const;
+
+ // bucket interface
+ size_typebucket_count()const;
+ size_typemax_bucket_count()const;
+ size_typebucket_size(size_type)const;
+ size_typebucket(key_typeconst&)const;
+ local_iteratorbegin(size_type);
+ const_local_iteratorbegin(size_type)const;
+ local_iteratorend(size_type);
+ const_local_iteratorend(size_type)const;
+ const_local_iteratorcbegin(size_type)const;
+ const_local_iteratorcend(size_type);
+
+ // hash policy
+ floatload_factor()const;
+ floatmax_load_factor()const;
+ voidmax_load_factor(float);
+ voidrehash(size_type);
+};
+
+// Equality Comparisons
+template<typename Value,typename Hash,typename Pred,typename Alloc>
+ booloperator==(unordered_multiset<Value,Hash,Pred,Alloc>const&,
+ unordered_multiset<Value,Hash,Pred,Alloc>const&);
+template<typename Value,typename Hash,typename Pred,typename Alloc>
+ booloperator!=(unordered_multiset<Value,Hash,Pred,Alloc>const&,
+ unordered_multiset<Value,Hash,Pred,Alloc>const&);
+
+// swap
+template<typename Value,typename Hash,typename Pred,typename Alloc>
+ voidswap(unordered_multiset<Value,Hash,Pred,Alloc>&,
+ unordered_multiset<Value,Hash,Pred,Alloc>&);Description
+ Based on chapter 23 of
+ the working draft of the C++ standard [n2960].
+ But without the updated rules for allocators.
+
+ Template Parameters
+
+
+
+
+ Value
+ Value must be Assignable and CopyConstructible
+
+ Hash
+ A unary function object type that acts a hash function for a Value. It takes a single argument of type Value and returns a value of type std::size_t.
+
+ Pred
+ A binary function object that implements an equivalence relation on values of type Value.
+ A binary function object that induces an equivalence relation on values of type Key.
+ It takes two arguments of type Key and returns a value of type bool.
+
+ Alloc
+ An allocator whose value type is the same as the container's value type.
+ The elements are organized into buckets. Keys with the same hash code are stored in the same bucket and elements with equivalent keys are stored next to each other.
+ The number of buckets can be automatically increased by a call to insert, or as the result of calling rehash.
+ unordered_multiset
+ public
+ types
+typedefimplementation-definedsize_type;
+ An unsigned integral type.
+ size_type can represent any non-negative value of difference_type.
+
+typedefimplementation-defineddifference_type;
+ A signed integral type.
+ Is identical to the difference type of iterator and const_iterator.
+
+typedefimplementation-definediterator;
+ A constant iterator whose value type is value_type.
+ The iterator category is at least a forward iterator.
+ Convertible to const_iterator.
+
+typedefimplementation-definedconst_iterator;
+ A constant iterator whose value type is value_type.
+ The iterator category is at least a forward iterator.
+
+typedefimplementation-definedlocal_iterator;
+ An iterator with the same value type, difference type and pointer and reference type as iterator.
+ A local_iterator object can be used to iterate through a single bucket.
+
+typedefimplementation-definedconst_local_iterator;
+ A constant iterator with the same value type, difference type and pointer and reference type as const_iterator.
+ A const_local_iterator object can be used to iterate through a single bucket.
+ unordered_multiset
+ public
+ construct/copy/destructexplicitunordered_multiset(size_type n =implementation-defined,
+ hasherconst& hf =hasher(),
+ key_equalconst& eq =key_equal(),
+ allocator_typeconst& a =allocator_type());Constructs an empty container with at least n buckets, using hf as the hash function, eq as the key equality predicate, a as the allocator and a maximum load factor of 1.0.Postconditions:size() == 0template<typename InputIterator>
+ unordered_multiset(InputIterator f,InputIterator l,
+ size_type n =implementation-defined,
+ hasherconst& hf =hasher(),
+ key_equalconst& eq =key_equal(),
+ allocator_typeconst& a =allocator_type());Constructs an empty container with at least n buckets, using hf as the hash function, eq as the key equality predicate, a as the allocator and a maximum load factor of 1.0 and inserts the elements from [f, l) into it.unordered_multiset(unordered_multisetconst&);The copy constructor. Copies the contained elements, hash function, predicate, maximum load factor and allocator.Requires:value_type is copy constructibleunordered_multiset(unordered_multiset&&);The move constructor.Notes:This is emulated on compilers without rvalue references.Requires:
+ value_type is move constructible.
+ (TODO: This is not actually required in this implementation).
+ explicitunordered_multiset(Allocatorconst& a);Constructs an empty container, using allocator a.unordered_multiset(unordered_multisetconst& x,Allocatorconst& a);Constructs an container, copying x's contained elements, hash function, predicate, maximum load factor, but using allocator a.~unordered_multiset();Notes:The destructor is applied to every element, and all memory is deallocatedunordered_multiset&operator=(unordered_multisetconst&);The assignment operator. Copies the contained elements, hash function, predicate and maximum load factor but not the allocator.Notes:
+ On compilers without rvalue references, there is a single assignment
+ operator with the signature operator=(unordered_multiset)
+ in order to emulate move semantics.
+ Requires:value_type is copy constructibleunordered_multiset&operator=(unordered_multiset&&);The move assignment operator.Notes:
+ On compilers without rvalue references, there is a single assignment
+ operator with the signature operator=(unordered_multiset)
+ in order to emulate move semantics.
+ Requires:
+ value_type is move constructible.
+ (TODO: This is not actually required in this implementation).
+ allocator_typeget_allocator()const;unordered_multiset size and capacityboolempty()const;Returns:size() == 0size_typesize()const;Returns:std::distance(begin(), end())size_typemax_size()const;Returns:size() of the largest possible container.
+ unordered_multiset iteratorsiteratorbegin();
+const_iteratorbegin()const;Returns:An iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container.
+ iteratorend();
+const_iteratorend()const;Returns:An iterator which refers to the past-the-end value for the container.
+ const_iteratorcbegin()const;Returns:A constant iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container.
+ const_iteratorcend()const;Returns:A constant iterator which refers to the past-the-end value for the container.
+ unordered_multiset modifierstemplate<typename... Args>iteratoremplace(Args&&... args);Inserts an object, constructed with the arguments args, in the container.Returns:An iterator pointing to the inserted element.Throws:If an exception is thrown by an operation other than a call to hasher the function has no effect.Notes:Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.Pointers and references to elements are never invalidated.If the compiler doesn't support variadic template arguments or rvalue
+ references, this is emulated for up to 10 arguments, with no support
+ for rvalue references or move semantics.template<typename... Args>
+ iteratoremplace_hint(const_iterator hint,Args&&... args);Inserts an object, constructed with the arguments args, in the container.hint is a suggestion to where the element should be inserted.Returns:An iterator pointing to the inserted element.Throws:If an exception is thrown by an operation other than a call to hasher the function has no effect.Notes:The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same value. Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.Pointers and references to elements are never invalidated.If the compiler doesn't support variadic template arguments or rvalue
+ references, this is emulated for up to 10 arguments, with no support
+ for rvalue references or move semantics.iteratorinsert(value_typeconst& obj);Inserts obj in the container.Returns:An iterator pointing to the inserted element.Throws:If an exception is thrown by an operation other than a call to hasher the function has no effect.Notes:Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.Pointers and references to elements are never invalidated.iteratorinsert(const_iterator hint,value_typeconst& obj);Inserts obj in the container.hint is a suggestion to where the element should be inserted.Returns:An iterator pointing to the inserted element.Throws:If an exception is thrown by an operation other than a call to hasher the function has no effect.Notes:The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same value. Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.Pointers and references to elements are never invalidated.template<typename InputIterator>
+ voidinsert(InputIterator first,InputIterator last);Inserts a range of elements into the container.Throws:When inserting a single element, if an exception is thrown by an operation other than a call to hasher the function has no effect.Notes:Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.Pointers and references to elements are never invalidated.iteratorerase(const_iterator position);Erase the element pointed to by position.Returns:The iterator following position before the erasure.Throws:Only throws an exception if it is thrown by hasher or key_equal.In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.Notes:
+ When the number of elements is a lot smaller than the number of buckets
+ this function can be very inefficient as it has to search through empty
+ buckets for the next element, in order to return the iterator.
+ The method quick_erase is faster, but has yet
+ to be standardized.
+ size_typeerase(key_typeconst& k);Erase all elements with key equivalent to k.Returns:The number of elements erased.Throws:Only throws an exception if it is thrown by hasher or key_equal.iteratorerase(const_iterator first,const_iterator last);Erases the elements in the range from first to last.Returns:The iterator following the erased elements - i.e. last.Throws:Only throws an exception if it is thrown by hasher or key_equal.In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.voidquick_erase(const_iterator position);Erase the element pointed to by position.Throws:Only throws an exception if it is thrown by hasher or key_equal.In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.Notes:
+ This method is faster than erase as
+ it doesn't have to find the next element in the container -
+ a potentially costly operation.
+
+ As it hasn't been standardized, it's likely that this may
+ change in the future.
+ voiderase_return_void(const_iterator position);Erase the element pointed to by position.Throws:Only throws an exception if it is thrown by hasher or key_equal.In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.Notes:
+ This method is now deprecated, use
+ quick_return instead. Although be
+ warned that as that isn't standardized yet, it could also
+ change.
+ voidclear();Erases all elements in the container.Postconditions:size() == 0Throws:Never throws an exception.voidswap(unordered_multiset&);Throws:If the allocators are equal, doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of key_equal or hasher.Notes:For a discussion of the behavior when allocators aren't equal see
+ the implementation details.unordered_multiset observershasherhash_function()const;Returns:The container's hash function.
+ key_equalkey_eq()const;Returns:The container's key equality predicate.
+ unordered_multiset lookupiteratorfind(key_typeconst& k);
+const_iteratorfind(key_typeconst& k)const;
+template<typename CompatibleKey,typename CompatibleHash,
+ typename CompatiblePredicate>
+ iteratorfind(CompatibleKeyconst& k,CompatibleHashconst& hash,
+ CompatiblePredicateconst& eq);
+template<typename CompatibleKey,typename CompatibleHash,
+ typename CompatiblePredicate>
+ const_iterator
+ find(CompatibleKeyconst& k,CompatibleHashconst& hash,
+ CompatiblePredicateconst& eq)const;Returns:An iterator pointing to an element with key equivalent to k, or b.end() if no such element exists.Notes:
+ The templated overloads are a non-standard extensions which
+ allows you to use a compatible hash function and equality
+ predicate for a key of a different type in order to avoid
+ an expensive type cast. In general, its use is not encouraged.
+ size_typecount(key_typeconst& k)const;Returns:The number of elements with key equivalent to k.std::pair<iterator,iterator>equal_range(key_typeconst& k);
+std::pair<const_iterator,const_iterator>equal_range(key_typeconst& k)const;Returns:A range containing all elements with key equivalent to k.
+ If the container doesn't container any such elements, returns
+ std::make_pair(b.end(),b.end()).
+ unordered_multiset bucket interfacesize_typebucket_count()const;Returns:The number of buckets.size_typemax_bucket_count()const;Returns:An upper bound on the number of buckets.size_typebucket_size(size_type n)const;Requires:n < bucket_count()Returns:The number of elements in bucket n.size_typebucket(key_typeconst& k)const;Returns:The index of the bucket which would contain an element with key k.Postconditions:The return value is less than bucket_count()local_iteratorbegin(size_type n);
+const_local_iteratorbegin(size_type n)const;Requires:n shall be in the range [0, bucket_count()).Returns:A local iterator pointing the first element in the bucket with index n.local_iteratorend(size_type n);
+const_local_iteratorend(size_type n)const;Requires:n shall be in the range [0, bucket_count()).Returns:A local iterator pointing the 'one past the end' element in the bucket with index n.const_local_iteratorcbegin(size_type n)const;Requires:n shall be in the range [0, bucket_count()).Returns:A constant local iterator pointing the first element in the bucket with index n.const_local_iteratorcend(size_type n);Requires:n shall be in the range [0, bucket_count()).Returns:A constant local iterator pointing the 'one past the end' element in the bucket with index n.unordered_multiset hash policyfloatload_factor()const;Returns:The average number of elements per bucket.floatmax_load_factor()const;Returns:Returns the current maximum load factor.voidmax_load_factor(float z);Effects:Changes the container's maximum load factor, using z as a hint.voidrehash(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.Invalidates iterators, and changes the order of elements. Pointers and references to elements are not invalidated.Throws:The function has no effect if an exception is thrown, unless it is thrown by the container's hash function or comparison function.unordered_multiset Equality Comparisonstemplate<typename Value,typename Hash,typename Pred,typename Alloc>
+ booloperator==(unordered_multiset<Value,Hash,Pred,Alloc>const& x,
+ unordered_multiset<Value,Hash,Pred,Alloc>const& y);Notes:This is a boost extension.Behavior is undefined if the two containers don't have
+ equivalent equality predicates.template<typename Value,typename Hash,typename Pred,typename Alloc>
+ booloperator!=(unordered_multiset<Value,Hash,Pred,Alloc>const& x,
+ unordered_multiset<Value,Hash,Pred,Alloc>const& y);Notes:This is a boost extension.Behavior is undefined if the two containers don't have
+ equivalent equality predicates.unordered_multiset swaptemplate<typename Value,typename Hash,typename Pred,typename Alloc>
+ voidswap(unordered_multiset<Value,Hash,Pred,Alloc>& x,
+ unordered_multiset<Value,Hash,Pred,Alloc>& y);Effects:x.swap(y)Throws:If the allocators are equal, doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of Hash or Pred.Notes:For a discussion of the behavior when allocators aren't equal see
+ the implementation details.
+
+ Header <boost/unordered_map.hpp>namespaceboost{
+ template<typename Key,typename Mapped,typename Hash =boost::hash<Key>,
+ typename Pred =std::equal_to<Key>,
+ typename Alloc =std::allocator<std::pair<Keyconst,Mapped>>>
+ class unordered_map;
+ template<typename Key,typename Mapped,typename Hash,typename Pred,
+ typename Alloc>
+ booloperator==(unordered_map<Key,Mapped,Hash,Pred,Alloc>const&,
+ unordered_map<Key,Mapped,Hash,Pred,Alloc>const&);
+ template<typename Key,typename Mapped,typename Hash,typename Pred,
+ typename Alloc>
+ booloperator!=(unordered_map<Key,Mapped,Hash,Pred,Alloc>const&,
+ unordered_map<Key,Mapped,Hash,Pred,Alloc>const&);
+ template<typename Key,typename Mapped,typename Hash,typename Pred,
+ typename Alloc>
+ voidswap(unordered_map<Key,Mapped,Hash,Pred,Alloc>&,
+ unordered_map<Key,Mapped,Hash,Pred,Alloc>&);
+ template<typename Key,typename Mapped,typename Hash =boost::hash<Key>,
+ typename Pred =std::equal_to<Key>,
+ typename Alloc =std::allocator<std::pair<Keyconst,Mapped>>>
+ class unordered_multimap;
+ template<typename Key,typename Mapped,typename Hash,typename Pred,
+ typename Alloc>
+ booloperator==(unordered_multimap<Key,Mapped,Hash,Pred,Alloc>const&,
+ unordered_multimap<Key,Mapped,Hash,Pred,Alloc>const&);
+ template<typename Key,typename Mapped,typename Hash,typename Pred,
+ typename Alloc>
+ booloperator!=(unordered_multimap<Key,Mapped,Hash,Pred,Alloc>const&,
+ unordered_multimap<Key,Mapped,Hash,Pred,Alloc>const&);
+ template<typename Key,typename Mapped,typename Hash,typename Pred,
+ typename Alloc>
+ voidswap(unordered_multimap<Key,Mapped,Hash,Pred,Alloc>&,
+ unordered_multimap<Key,Mapped,Hash,Pred,Alloc>&);
+}
+ Class template unordered_map3boost::unordered_map
+ An unordered associative container that associates unique keys with another value.
+ // In header: <boost/unordered_map.hpp>
+
+template<typename Key,typename Mapped,typename Hash =boost::hash<Key>,
+ typename Pred =std::equal_to<Key>,
+ typename Alloc =std::allocator<std::pair<Keyconst,Mapped>>>
+class unordered_map {
+public:
+ // types
+ typedefKeykey_type;
+ typedefstd::pair<Keyconst,Mapped>value_type;
+ typedefMappedmapped_type;
+ typedefHashhasher;
+ typedefPredkey_equal;
+ typedefAllocallocator_type;
+ typedeftypenameallocator_type::pointerpointer;
+ typedeftypenameallocator_type::const_pointerconst_pointer;
+ typedeftypenameallocator_type::referencereference;// lvalue of value_type.
+ typedeftypenameallocator_type::const_referenceconst_reference;// const lvalue of value_type.
+ typedefimplementation-definedsize_type;
+ typedefimplementation-defineddifference_type;
+ typedefimplementation-definediterator;
+ typedefimplementation-definedconst_iterator;
+ typedefimplementation-definedlocal_iterator;
+ typedefimplementation-definedconst_local_iterator;
+
+ // construct/copy/destruct
+ explicitunordered_map(size_type=implementation-defined,
+ hasherconst&=hasher(),
+ key_equalconst&=key_equal(),
+ allocator_typeconst&=allocator_type());
+ template<typename InputIterator>
+ unordered_map(InputIterator,InputIterator,
+ size_type=implementation-defined,
+ hasherconst&=hasher(),key_equalconst&=key_equal(),
+ allocator_typeconst&=allocator_type());
+ unordered_map(unordered_mapconst&);
+ unordered_map(unordered_map&&);
+ explicitunordered_map(Allocatorconst&);
+ unordered_map(unordered_mapconst&,Allocatorconst&);
+ ~unordered_map();
+ unordered_map&operator=(unordered_mapconst&);
+ unordered_map&operator=(unordered_map&&);
+ allocator_typeget_allocator()const;
+
+ // size and capacity
+ boolempty()const;
+ size_typesize()const;
+ size_typemax_size()const;
+
+ // iterators
+ iteratorbegin();
+ const_iteratorbegin()const;
+ iteratorend();
+ const_iteratorend()const;
+ const_iteratorcbegin()const;
+ const_iteratorcend()const;
+
+ // modifiers
+ template<typename... Args>std::pair<iterator,bool>emplace(Args&&...);
+ template<typename... Args>iteratoremplace_hint(const_iterator,Args&&...);
+ std::pair<iterator,bool>insert(value_typeconst&);
+ iteratorinsert(const_iterator,value_typeconst&);
+ template<typename InputIterator>voidinsert(InputIterator,InputIterator);
+ iteratorerase(const_iterator);
+ size_typeerase(key_typeconst&);
+ iteratorerase(const_iterator,const_iterator);
+ voidquick_erase(const_iterator);
+ voiderase_return_void(const_iterator);
+ voidclear();
+ voidswap(unordered_map&);
+
+ // observers
+ hasherhash_function()const;
+ key_equalkey_eq()const;
+
+ // lookup
+ iteratorfind(key_typeconst&);
+ const_iteratorfind(key_typeconst&)const;
+ template<typename CompatibleKey,typename CompatibleHash,
+ typename CompatiblePredicate>
+ iteratorfind(CompatibleKeyconst&,CompatibleHashconst&,
+ CompatiblePredicateconst&);
+ template<typename CompatibleKey,typename CompatibleHash,
+ typename CompatiblePredicate>
+ const_iterator
+ find(CompatibleKeyconst&,CompatibleHashconst&,
+ CompatiblePredicateconst&)const;
+ size_typecount(key_typeconst&)const;
+ std::pair<iterator,iterator>equal_range(key_typeconst&);
+ std::pair<const_iterator,const_iterator>equal_range(key_typeconst&)const;
+ mapped_type&operator[](key_typeconst&);
+ Mapped&at(key_typeconst&);
+ Mappedconst&at(key_typeconst&)const;
+
+ // bucket interface
+ size_typebucket_count()const;
+ size_typemax_bucket_count()const;
+ size_typebucket_size(size_type)const;
+ size_typebucket(key_typeconst&)const;
+ local_iteratorbegin(size_type);
+ const_local_iteratorbegin(size_type)const;
+ local_iteratorend(size_type);
+ const_local_iteratorend(size_type)const;
+ const_local_iteratorcbegin(size_type)const;
+ const_local_iteratorcend(size_type);
+
+ // hash policy
+ floatload_factor()const;
+ floatmax_load_factor()const;
+ voidmax_load_factor(float);
+ voidrehash(size_type);
+};
+
+// Equality Comparisons
+template<typename Key,typename Mapped,typename Hash,typename Pred,
+ typename Alloc>
+ booloperator==(unordered_map<Key,Mapped,Hash,Pred,Alloc>const&,
+ unordered_map<Key,Mapped,Hash,Pred,Alloc>const&);
+template<typename Key,typename Mapped,typename Hash,typename Pred,
+ typename Alloc>
+ booloperator!=(unordered_map<Key,Mapped,Hash,Pred,Alloc>const&,
+ unordered_map<Key,Mapped,Hash,Pred,Alloc>const&);
+
+// swap
+template<typename Key,typename Mapped,typename Hash,typename Pred,
+ typename Alloc>
+ voidswap(unordered_map<Key,Mapped,Hash,Pred,Alloc>&,
+ unordered_map<Key,Mapped,Hash,Pred,Alloc>&);Description
+ Based on chapter 23 of
+ the working draft of the C++ standard [n2960].
+ But without the updated rules for allocators.
+
+ Template Parameters
+
+
+
+
+ Key
+ Key must be Assignable and CopyConstructible.
+
+ Mapped
+ Mapped must be CopyConstructible
+
+ Hash
+ A unary function object type that acts a hash function for a Key. It takes a single argument of type Key and returns a value of type std::size_t.
+
+ Pred
+ A binary function object that implements an equivalence relation on values of type Key.
+ A binary function object that induces an equivalence relation on values of type Key.
+ It takes two arguments of type Key and returns a value of type bool.
+
+ Alloc
+ An allocator whose value type is the same as the container's value type.
+ The elements are organized into buckets. Keys with the same hash code are stored in the same bucket.
+ The number of buckets can be automatically increased by a call to insert, or as the result of calling rehash.
+ unordered_map
+ public
+ types
+typedefimplementation-definedsize_type;
+ An unsigned integral type.
+ size_type can represent any non-negative value of difference_type.
+
+typedefimplementation-defineddifference_type;
+ A signed integral type.
+ Is identical to the difference type of iterator and const_iterator.
+
+typedefimplementation-definediterator;
+ A iterator whose value type is value_type.
+ The iterator category is at least a forward iterator.
+ Convertible to const_iterator.
+
+typedefimplementation-definedconst_iterator;
+ A constant iterator whose value type is value_type.
+ The iterator category is at least a forward iterator.
+
+typedefimplementation-definedlocal_iterator;
+ An iterator with the same value type, difference type and pointer and reference type as iterator.
+ A local_iterator object can be used to iterate through a single bucket.
+
+typedefimplementation-definedconst_local_iterator;
+ A constant iterator with the same value type, difference type and pointer and reference type as const_iterator.
+ A const_local_iterator object can be used to iterate through a single bucket.
+ unordered_map
+ public
+ construct/copy/destructexplicitunordered_map(size_type n =implementation-defined,
+ hasherconst& hf =hasher(),
+ key_equalconst& eq =key_equal(),
+ allocator_typeconst& a =allocator_type());Constructs an empty container with at least n buckets, using hf as the hash function, eq as the key equality predicate, a as the allocator and a maximum load factor of 1.0.Postconditions:size() == 0template<typename InputIterator>
+ unordered_map(InputIterator f,InputIterator l,
+ size_type n =implementation-defined,
+ hasherconst& hf =hasher(),
+ key_equalconst& eq =key_equal(),
+ allocator_typeconst& a =allocator_type());Constructs an empty container with at least n buckets, using hf as the hash function, eq as the key equality predicate, a as the allocator and a maximum load factor of 1.0 and inserts the elements from [f, l) into it.unordered_map(unordered_mapconst&);The copy constructor. Copies the contained elements, hash function, predicate, maximum load factor and allocator.Requires:value_type is copy constructibleunordered_map(unordered_map&&);The move constructor.Notes:This is emulated on compilers without rvalue references.Requires:
+ value_type is move constructible.
+ (TODO: This is not actually required in this implementation).
+ explicitunordered_map(Allocatorconst& a);Constructs an empty container, using allocator a.unordered_map(unordered_mapconst& x,Allocatorconst& a);Constructs an container, copying x's contained elements, hash function, predicate, maximum load factor, but using allocator a.~unordered_map();Notes:The destructor is applied to every element, and all memory is deallocatedunordered_map&operator=(unordered_mapconst&);The assignment operator. Copies the contained elements, hash function, predicate and maximum load factor but not the allocator.Notes:
+ On compilers without rvalue references, there is a single assignment
+ operator with the signature operator=(unordered_map)
+ in order to emulate move semantics.
+ Requires:value_type is copy constructibleunordered_map&operator=(unordered_map&&);The move assignment operator.Notes:
+ On compilers without rvalue references, there is a single assignment
+ operator with the signature operator=(unordered_map)
+ in order to emulate move semantics.
+ Requires:
+ value_type is move constructible.
+ (TODO: This is not actually required in this implementation).
+ allocator_typeget_allocator()const;unordered_map size and capacityboolempty()const;Returns:size() == 0size_typesize()const;Returns:std::distance(begin(), end())size_typemax_size()const;Returns:size() of the largest possible container.
+ unordered_map iteratorsiteratorbegin();
+const_iteratorbegin()const;Returns:An iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container.
+ iteratorend();
+const_iteratorend()const;Returns:An iterator which refers to the past-the-end value for the container.
+ const_iteratorcbegin()const;Returns:A constant iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container.
+ const_iteratorcend()const;Returns:A constant iterator which refers to the past-the-end value for the container.
+ unordered_map modifierstemplate<typename... Args>std::pair<iterator,bool>emplace(Args&&... args);Inserts an object, constructed with the arguments args, in the container if and only if there is no element in the container with an equivalent key.Returns:The bool component of the return type is true if an insert took place.If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent key.Throws:If an exception is thrown by an operation other than a call to hasher the function has no effect.Notes:Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.Pointers and references to elements are never invalidated.If the compiler doesn't support variadic template arguments or rvalue
+ references, this is emulated for up to 10 arguments, with no support
+ for rvalue references or move semantics.template<typename... Args>
+ iteratoremplace_hint(const_iterator hint,Args&&... args);Inserts an object, constructed with the arguments args, in the container if and only if there is no element in the container with an equivalent key.hint is a suggestion to where the element should be inserted.Returns:If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent key.Throws:If an exception is thrown by an operation other than a call to hasher the function has no effect.Notes:The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same key. Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.Pointers and references to elements are never invalidated.If the compiler doesn't support variadic template arguments or rvalue
+ references, this is emulated for up to 10 arguments, with no support
+ for rvalue references or move semantics.std::pair<iterator,bool>insert(value_typeconst& obj);Inserts obj in the container if and only if there is no element in the container with an equivalent key.Returns:The bool component of the return type is true if an insert took place.If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent key.Throws:If an exception is thrown by an operation other than a call to hasher the function has no effect.Notes:Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.Pointers and references to elements are never invalidated.iteratorinsert(const_iterator hint,value_typeconst& obj);Inserts obj in the container if and only if there is no element in the container with an equivalent key.hint is a suggestion to where the element should be inserted.Returns:If an insert took place, then the iterator points to the newly inserted element. Otherwise, it points to the element with equivalent key.Throws:If an exception is thrown by an operation other than a call to hasher the function has no effect.Notes:The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same key. Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.Pointers and references to elements are never invalidated.template<typename InputIterator>
+ voidinsert(InputIterator first,InputIterator last);Inserts a range of elements into the container. Elements are inserted if and only if there is no element in the container with an equivalent key.Throws:When inserting a single element, if an exception is thrown by an operation other than a call to hasher the function has no effect.Notes:Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.Pointers and references to elements are never invalidated.iteratorerase(const_iterator position);Erase the element pointed to by position.Returns:The iterator following position before the erasure.Throws:Only throws an exception if it is thrown by hasher or key_equal.In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.Notes:
+ When the number of elements is a lot smaller than the number of buckets
+ this function can be very inefficient as it has to search through empty
+ buckets for the next element, in order to return the iterator.
+ The method quick_erase is faster, but has yet
+ to be standardized.
+ size_typeerase(key_typeconst& k);Erase all elements with key equivalent to k.Returns:The number of elements erased.Throws:Only throws an exception if it is thrown by hasher or key_equal.iteratorerase(const_iterator first,const_iterator last);Erases the elements in the range from first to last.Returns:The iterator following the erased elements - i.e. last.Throws:Only throws an exception if it is thrown by hasher or key_equal.In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.voidquick_erase(const_iterator position);Erase the element pointed to by position.Throws:Only throws an exception if it is thrown by hasher or key_equal.In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.Notes:
+ This method is faster than erase as
+ it doesn't have to find the next element in the container -
+ a potentially costly operation.
+
+ As it hasn't been standardized, it's likely that this may
+ change in the future.
+ voiderase_return_void(const_iterator position);Erase the element pointed to by position.Throws:Only throws an exception if it is thrown by hasher or key_equal.In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.Notes:
+ This method is now deprecated, use
+ quick_return instead. Although be
+ warned that as that isn't standardized yet, it could also
+ change.
+ voidclear();Erases all elements in the container.Postconditions:size() == 0Throws:Never throws an exception.voidswap(unordered_map&);Throws:If the allocators are equal, doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of key_equal or hasher.Notes:For a discussion of the behavior when allocators aren't equal see
+ the implementation details.unordered_map observershasherhash_function()const;Returns:The container's hash function.
+ key_equalkey_eq()const;Returns:The container's key equality predicate.
+ unordered_map lookupiteratorfind(key_typeconst& k);
+const_iteratorfind(key_typeconst& k)const;
+template<typename CompatibleKey,typename CompatibleHash,
+ typename CompatiblePredicate>
+ iteratorfind(CompatibleKeyconst& k,CompatibleHashconst& hash,
+ CompatiblePredicateconst& eq);
+template<typename CompatibleKey,typename CompatibleHash,
+ typename CompatiblePredicate>
+ const_iterator
+ find(CompatibleKeyconst& k,CompatibleHashconst& hash,
+ CompatiblePredicateconst& eq)const;Returns:An iterator pointing to an element with key equivalent to k, or b.end() if no such element exists.Notes:
+ The templated overloads are a non-standard extensions which
+ allows you to use a compatible hash function and equality
+ predicate for a key of a different type in order to avoid
+ an expensive type cast. In general, its use is not encouraged.
+ size_typecount(key_typeconst& k)const;Returns:The number of elements with key equivalent to k.std::pair<iterator,iterator>equal_range(key_typeconst& k);
+std::pair<const_iterator,const_iterator>equal_range(key_typeconst& k)const;Returns:A range containing all elements with key equivalent to k.
+ If the container doesn't container any such elements, returns
+ std::make_pair(b.end(),b.end()).
+ mapped_type&operator[](key_typeconst& k);Effects:If the container does not already contain an elements with a key equivalent to k, inserts the value std::pair<key_type const, mapped_type>(k, mapped_type())Returns:A reference to x.second where x is the element already in the container, or the newly inserted element with a key equivalent to kThrows:If an exception is thrown by an operation other than a call to hasher the function has no effect.Notes:Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.Pointers and references to elements are never invalidated.Mapped&at(key_typeconst& k);
+Mappedconst&at(key_typeconst& k)const;Returns:A reference to x.second where x is the (unique) element whose key is equivalent to k.Throws:An exception object of type std::out_of_range if no such element is present.Notes:This is not specified in the draft standard, but that is probably an oversight. The issue has been raised in
+ comp.std.c++.unordered_map bucket interfacesize_typebucket_count()const;Returns:The number of buckets.size_typemax_bucket_count()const;Returns:An upper bound on the number of buckets.size_typebucket_size(size_type n)const;Requires:n < bucket_count()Returns:The number of elements in bucket n.size_typebucket(key_typeconst& k)const;Returns:The index of the bucket which would contain an element with key k.Postconditions:The return value is less than bucket_count()local_iteratorbegin(size_type n);
+const_local_iteratorbegin(size_type n)const;Requires:n shall be in the range [0, bucket_count()).Returns:A local iterator pointing the first element in the bucket with index n.local_iteratorend(size_type n);
+const_local_iteratorend(size_type n)const;Requires:n shall be in the range [0, bucket_count()).Returns:A local iterator pointing the 'one past the end' element in the bucket with index n.const_local_iteratorcbegin(size_type n)const;Requires:n shall be in the range [0, bucket_count()).Returns:A constant local iterator pointing the first element in the bucket with index n.const_local_iteratorcend(size_type n);Requires:n shall be in the range [0, bucket_count()).Returns:A constant local iterator pointing the 'one past the end' element in the bucket with index n.unordered_map hash policyfloatload_factor()const;Returns:The average number of elements per bucket.floatmax_load_factor()const;Returns:Returns the current maximum load factor.voidmax_load_factor(float z);Effects:Changes the container's maximum load factor, using z as a hint.voidrehash(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.Invalidates iterators, and changes the order of elements. Pointers and references to elements are not invalidated.Throws:The function has no effect if an exception is thrown, unless it is thrown by the container's hash function or comparison function.unordered_map Equality Comparisonstemplate<typename Key,typename Mapped,typename Hash,typename Pred,
+ typename Alloc>
+ booloperator==(unordered_map<Key,Mapped,Hash,Pred,Alloc>const& x,
+ unordered_map<Key,Mapped,Hash,Pred,Alloc>const& y);Notes:This is a boost extension.Behavior is undefined if the two containers don't have
+ equivalent equality predicates.template<typename Key,typename Mapped,typename Hash,typename Pred,
+ typename Alloc>
+ booloperator!=(unordered_map<Key,Mapped,Hash,Pred,Alloc>const& x,
+ unordered_map<Key,Mapped,Hash,Pred,Alloc>const& y);Notes:This is a boost extension.Behavior is undefined if the two containers don't have
+ equivalent equality predicates.unordered_map swaptemplate<typename Key,typename Mapped,typename Hash,typename Pred,
+ typename Alloc>
+ voidswap(unordered_map<Key,Mapped,Hash,Pred,Alloc>& x,
+ unordered_map<Key,Mapped,Hash,Pred,Alloc>& y);Effects:x.swap(y)Throws:If the allocators are equal, doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of Hash or Pred.Notes:For a discussion of the behavior when allocators aren't equal see
+ the implementation details.Class template unordered_multimap3boost::unordered_multimap
+ An unordered associative container that associates keys with another value. The same key can be stored multiple times.
+ // In header: <boost/unordered_map.hpp>
+
+template<typename Key,typename Mapped,typename Hash =boost::hash<Key>,
+ typename Pred =std::equal_to<Key>,
+ typename Alloc =std::allocator<std::pair<Keyconst,Mapped>>>
+class unordered_multimap {
+public:
+ // types
+ typedefKeykey_type;
+ typedefstd::pair<Keyconst,Mapped>value_type;
+ typedefMappedmapped_type;
+ typedefHashhasher;
+ typedefPredkey_equal;
+ typedefAllocallocator_type;
+ typedeftypenameallocator_type::pointerpointer;
+ typedeftypenameallocator_type::const_pointerconst_pointer;
+ typedeftypenameallocator_type::referencereference;// lvalue of value_type.
+ typedeftypenameallocator_type::const_referenceconst_reference;// const lvalue of value_type.
+ typedefimplementation-definedsize_type;
+ typedefimplementation-defineddifference_type;
+ typedefimplementation-definediterator;
+ typedefimplementation-definedconst_iterator;
+ typedefimplementation-definedlocal_iterator;
+ typedefimplementation-definedconst_local_iterator;
+
+ // construct/copy/destruct
+ explicitunordered_multimap(size_type=implementation-defined,
+ hasherconst&=hasher(),
+ key_equalconst&=key_equal(),
+ allocator_typeconst&=allocator_type());
+ template<typename InputIterator>
+ unordered_multimap(InputIterator,InputIterator,
+ size_type=implementation-defined,
+ hasherconst&=hasher(),
+ key_equalconst&=key_equal(),
+ allocator_typeconst&=allocator_type());
+ unordered_multimap(unordered_multimapconst&);
+ unordered_multimap(unordered_multimap&&);
+ explicitunordered_multimap(Allocatorconst&);
+ unordered_multimap(unordered_multimapconst&,Allocatorconst&);
+ ~unordered_multimap();
+ unordered_multimap&operator=(unordered_multimapconst&);
+ unordered_multimap&operator=(unordered_multimap&&);
+ allocator_typeget_allocator()const;
+
+ // size and capacity
+ boolempty()const;
+ size_typesize()const;
+ size_typemax_size()const;
+
+ // iterators
+ iteratorbegin();
+ const_iteratorbegin()const;
+ iteratorend();
+ const_iteratorend()const;
+ const_iteratorcbegin()const;
+ const_iteratorcend()const;
+
+ // modifiers
+ template<typename... Args>iteratoremplace(Args&&...);
+ template<typename... Args>iteratoremplace_hint(const_iterator,Args&&...);
+ iteratorinsert(value_typeconst&);
+ iteratorinsert(const_iterator,value_typeconst&);
+ template<typename InputIterator>voidinsert(InputIterator,InputIterator);
+ iteratorerase(const_iterator);
+ size_typeerase(key_typeconst&);
+ iteratorerase(const_iterator,const_iterator);
+ voidquick_erase(const_iterator);
+ voiderase_return_void(const_iterator);
+ voidclear();
+ voidswap(unordered_multimap&);
+
+ // observers
+ hasherhash_function()const;
+ key_equalkey_eq()const;
+
+ // lookup
+ iteratorfind(key_typeconst&);
+ const_iteratorfind(key_typeconst&)const;
+ template<typename CompatibleKey,typename CompatibleHash,
+ typename CompatiblePredicate>
+ iteratorfind(CompatibleKeyconst&,CompatibleHashconst&,
+ CompatiblePredicateconst&);
+ template<typename CompatibleKey,typename CompatibleHash,
+ typename CompatiblePredicate>
+ const_iterator
+ find(CompatibleKeyconst&,CompatibleHashconst&,
+ CompatiblePredicateconst&)const;
+ size_typecount(key_typeconst&)const;
+ std::pair<iterator,iterator>equal_range(key_typeconst&);
+ std::pair<const_iterator,const_iterator>equal_range(key_typeconst&)const;
+
+ // bucket interface
+ size_typebucket_count()const;
+ size_typemax_bucket_count()const;
+ size_typebucket_size(size_type)const;
+ size_typebucket(key_typeconst&)const;
+ local_iteratorbegin(size_type);
+ const_local_iteratorbegin(size_type)const;
+ local_iteratorend(size_type);
+ const_local_iteratorend(size_type)const;
+ const_local_iteratorcbegin(size_type)const;
+ const_local_iteratorcend(size_type);
+
+ // hash policy
+ floatload_factor()const;
+ floatmax_load_factor()const;
+ voidmax_load_factor(float);
+ voidrehash(size_type);
+};
+
+// Equality Comparisons
+template<typename Key,typename Mapped,typename Hash,typename Pred,
+ typename Alloc>
+ booloperator==(unordered_multimap<Key,Mapped,Hash,Pred,Alloc>const&,
+ unordered_multimap<Key,Mapped,Hash,Pred,Alloc>const&);
+template<typename Key,typename Mapped,typename Hash,typename Pred,
+ typename Alloc>
+ booloperator!=(unordered_multimap<Key,Mapped,Hash,Pred,Alloc>const&,
+ unordered_multimap<Key,Mapped,Hash,Pred,Alloc>const&);
+
+// swap
+template<typename Key,typename Mapped,typename Hash,typename Pred,
+ typename Alloc>
+ voidswap(unordered_multimap<Key,Mapped,Hash,Pred,Alloc>&,
+ unordered_multimap<Key,Mapped,Hash,Pred,Alloc>&);Description
+ Based on chapter 23 of
+ the working draft of the C++ standard [n2960].
+ But without the updated rules for allocators.
+
+ Template Parameters
+
+
+
+
+ Key
+ Key must be Assignable and CopyConstructible.
+
+ Mapped
+ Mapped must be CopyConstructible
+
+ Hash
+ A unary function object type that acts a hash function for a Key. It takes a single argument of type Key and returns a value of type std::size_t.
+
+ Pred
+ A binary function object that implements an equivalence relation on values of type Key.
+ A binary function object that induces an equivalence relation on values of type Key.
+ It takes two arguments of type Key and returns a value of type bool.
+
+ Alloc
+ An allocator whose value type is the same as the container's value type.
+ The elements are organized into buckets. Keys with the same hash code are stored in the same bucket and elements with equivalent keys are stored next to each other.
+ The number of buckets can be automatically increased by a call to insert, or as the result of calling rehash.
+ unordered_multimap
+ public
+ types
+typedefimplementation-definedsize_type;
+ An unsigned integral type.
+ size_type can represent any non-negative value of difference_type.
+
+typedefimplementation-defineddifference_type;
+ A signed integral type.
+ Is identical to the difference type of iterator and const_iterator.
+
+typedefimplementation-definediterator;
+ A iterator whose value type is value_type.
+ The iterator category is at least a forward iterator.
+ Convertible to const_iterator.
+
+typedefimplementation-definedconst_iterator;
+ A constant iterator whose value type is value_type.
+ The iterator category is at least a forward iterator.
+
+typedefimplementation-definedlocal_iterator;
+ An iterator with the same value type, difference type and pointer and reference type as iterator.
+ A local_iterator object can be used to iterate through a single bucket.
+
+typedefimplementation-definedconst_local_iterator;
+ A constant iterator with the same value type, difference type and pointer and reference type as const_iterator.
+ A const_local_iterator object can be used to iterate through a single bucket.
+ unordered_multimap
+ public
+ construct/copy/destructexplicitunordered_multimap(size_type n =implementation-defined,
+ hasherconst& hf =hasher(),
+ key_equalconst& eq =key_equal(),
+ allocator_typeconst& a =allocator_type());Constructs an empty container with at least n buckets, using hf as the hash function, eq as the key equality predicate, a as the allocator and a maximum load factor of 1.0.Postconditions:size() == 0template<typename InputIterator>
+ unordered_multimap(InputIterator f,InputIterator l,
+ size_type n =implementation-defined,
+ hasherconst& hf =hasher(),
+ key_equalconst& eq =key_equal(),
+ allocator_typeconst& a =allocator_type());Constructs an empty container with at least n buckets, using hf as the hash function, eq as the key equality predicate, a as the allocator and a maximum load factor of 1.0 and inserts the elements from [f, l) into it.unordered_multimap(unordered_multimapconst&);The copy constructor. Copies the contained elements, hash function, predicate, maximum load factor and allocator.Requires:value_type is copy constructibleunordered_multimap(unordered_multimap&&);The move constructor.Notes:This is emulated on compilers without rvalue references.Requires:
+ value_type is move constructible.
+ (TODO: This is not actually required in this implementation).
+ explicitunordered_multimap(Allocatorconst& a);Constructs an empty container, using allocator a.unordered_multimap(unordered_multimapconst& x,Allocatorconst& a);Constructs an container, copying x's contained elements, hash function, predicate, maximum load factor, but using allocator a.~unordered_multimap();Notes:The destructor is applied to every element, and all memory is deallocatedunordered_multimap&operator=(unordered_multimapconst&);The assignment operator. Copies the contained elements, hash function, predicate and maximum load factor but not the allocator.Notes:
+ On compilers without rvalue references, there is a single assignment
+ operator with the signature operator=(unordered_multimap)
+ in order to emulate move semantics.
+ Requires:value_type is copy constructibleunordered_multimap&operator=(unordered_multimap&&);The move assignment operator.Notes:
+ On compilers without rvalue references, there is a single assignment
+ operator with the signature operator=(unordered_multimap)
+ in order to emulate move semantics.
+ Requires:
+ value_type is move constructible.
+ (TODO: This is not actually required in this implementation).
+ allocator_typeget_allocator()const;unordered_multimap size and capacityboolempty()const;Returns:size() == 0size_typesize()const;Returns:std::distance(begin(), end())size_typemax_size()const;Returns:size() of the largest possible container.
+ unordered_multimap iteratorsiteratorbegin();
+const_iteratorbegin()const;Returns:An iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container.
+ iteratorend();
+const_iteratorend()const;Returns:An iterator which refers to the past-the-end value for the container.
+ const_iteratorcbegin()const;Returns:A constant iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container.
+ const_iteratorcend()const;Returns:A constant iterator which refers to the past-the-end value for the container.
+ unordered_multimap modifierstemplate<typename... Args>iteratoremplace(Args&&... args);Inserts an object, constructed with the arguments args, in the container.Returns:An iterator pointing to the inserted element.Throws:If an exception is thrown by an operation other than a call to hasher the function has no effect.Notes:Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.Pointers and references to elements are never invalidated.If the compiler doesn't support variadic template arguments or rvalue
+ references, this is emulated for up to 10 arguments, with no support
+ for rvalue references or move semantics.template<typename... Args>
+ iteratoremplace_hint(const_iterator hint,Args&&... args);Inserts an object, constructed with the arguments args, in the container.hint is a suggestion to where the element should be inserted.Returns:An iterator pointing to the inserted element.Throws:If an exception is thrown by an operation other than a call to hasher the function has no effect.Notes:The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same key. Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.Pointers and references to elements are never invalidated.If the compiler doesn't support variadic template arguments or rvalue
+ references, this is emulated for up to 10 arguments, with no support
+ for rvalue references or move semantics.iteratorinsert(value_typeconst& obj);Inserts obj in the container.Returns:An iterator pointing to the inserted element.Throws:If an exception is thrown by an operation other than a call to hasher the function has no effect.Notes:Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.Pointers and references to elements are never invalidated.iteratorinsert(const_iterator hint,value_typeconst& obj);Inserts obj in the container.hint is a suggestion to where the element should be inserted.Returns:An iterator pointing to the inserted element.Throws:If an exception is thrown by an operation other than a call to hasher the function has no effect.Notes:The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same key. Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.Pointers and references to elements are never invalidated.template<typename InputIterator>
+ voidinsert(InputIterator first,InputIterator last);Inserts a range of elements into the container.Throws:When inserting a single element, if an exception is thrown by an operation other than a call to hasher the function has no effect.Notes:Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor.Pointers and references to elements are never invalidated.iteratorerase(const_iterator position);Erase the element pointed to by position.Returns:The iterator following position before the erasure.Throws:Only throws an exception if it is thrown by hasher or key_equal.In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.Notes:
+ When the number of elements is a lot smaller than the number of buckets
+ this function can be very inefficient as it has to search through empty
+ buckets for the next element, in order to return the iterator.
+ The method quick_erase is faster, but has yet
+ to be standardized.
+ size_typeerase(key_typeconst& k);Erase all elements with key equivalent to k.Returns:The number of elements erased.Throws:Only throws an exception if it is thrown by hasher or key_equal.iteratorerase(const_iterator first,const_iterator last);Erases the elements in the range from first to last.Returns:The iterator following the erased elements - i.e. last.Throws:Only throws an exception if it is thrown by hasher or key_equal.In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.voidquick_erase(const_iterator position);Erase the element pointed to by position.Throws:Only throws an exception if it is thrown by hasher or key_equal.In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.Notes:
+ This method is faster than erase as
+ it doesn't have to find the next element in the container -
+ a potentially costly operation.
+
+ As it hasn't been standardized, it's likely that this may
+ change in the future.
+ voiderase_return_void(const_iterator position);Erase the element pointed to by position.Throws:Only throws an exception if it is thrown by hasher or key_equal.In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.Notes:
+ This method is now deprecated, use
+ quick_return instead. Although be
+ warned that as that isn't standardized yet, it could also
+ change.
+ voidclear();Erases all elements in the container.Postconditions:size() == 0Throws:Never throws an exception.voidswap(unordered_multimap&);Throws:If the allocators are equal, doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of key_equal or hasher.Notes:For a discussion of the behavior when allocators aren't equal see
+ the implementation details.unordered_multimap observershasherhash_function()const;Returns:The container's hash function.
+ key_equalkey_eq()const;Returns:The container's key equality predicate.
+ unordered_multimap lookupiteratorfind(key_typeconst& k);
+const_iteratorfind(key_typeconst& k)const;
+template<typename CompatibleKey,typename CompatibleHash,
+ typename CompatiblePredicate>
+ iteratorfind(CompatibleKeyconst& k,CompatibleHashconst& hash,
+ CompatiblePredicateconst& eq);
+template<typename CompatibleKey,typename CompatibleHash,
+ typename CompatiblePredicate>
+ const_iterator
+ find(CompatibleKeyconst& k,CompatibleHashconst& hash,
+ CompatiblePredicateconst& eq)const;Returns:An iterator pointing to an element with key equivalent to k, or b.end() if no such element exists.Notes:
+ The templated overloads are a non-standard extensions which
+ allows you to use a compatible hash function and equality
+ predicate for a key of a different type in order to avoid
+ an expensive type cast. In general, its use is not encouraged.
+ size_typecount(key_typeconst& k)const;Returns:The number of elements with key equivalent to k.std::pair<iterator,iterator>equal_range(key_typeconst& k);
+std::pair<const_iterator,const_iterator>equal_range(key_typeconst& k)const;Returns:A range containing all elements with key equivalent to k.
+ If the container doesn't container any such elements, returns
+ std::make_pair(b.end(),b.end()).
+ unordered_multimap bucket interfacesize_typebucket_count()const;Returns:The number of buckets.size_typemax_bucket_count()const;Returns:An upper bound on the number of buckets.size_typebucket_size(size_type n)const;Requires:n < bucket_count()Returns:The number of elements in bucket n.size_typebucket(key_typeconst& k)const;Returns:The index of the bucket which would contain an element with key k.Postconditions:The return value is less than bucket_count()local_iteratorbegin(size_type n);
+const_local_iteratorbegin(size_type n)const;Requires:n shall be in the range [0, bucket_count()).Returns:A local iterator pointing the first element in the bucket with index n.local_iteratorend(size_type n);
+const_local_iteratorend(size_type n)const;Requires:n shall be in the range [0, bucket_count()).Returns:A local iterator pointing the 'one past the end' element in the bucket with index n.const_local_iteratorcbegin(size_type n)const;Requires:n shall be in the range [0, bucket_count()).Returns:A constant local iterator pointing the first element in the bucket with index n.const_local_iteratorcend(size_type n);Requires:n shall be in the range [0, bucket_count()).Returns:A constant local iterator pointing the 'one past the end' element in the bucket with index n.unordered_multimap hash policyfloatload_factor()const;Returns:The average number of elements per bucket.floatmax_load_factor()const;Returns:Returns the current maximum load factor.voidmax_load_factor(float z);Effects:Changes the container's maximum load factor, using z as a hint.voidrehash(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.Invalidates iterators, and changes the order of elements. Pointers and references to elements are not invalidated.Throws:The function has no effect if an exception is thrown, unless it is thrown by the container's hash function or comparison function.unordered_multimap Equality Comparisonstemplate<typename Key,typename Mapped,typename Hash,typename Pred,
+ typename Alloc>
+ booloperator==(unordered_multimap<Key,Mapped,Hash,Pred,Alloc>const& x,
+ unordered_multimap<Key,Mapped,Hash,Pred,Alloc>const& y);Notes:This is a boost extension.Behavior is undefined if the two containers don't have
+ equivalent equality predicates.template<typename Key,typename Mapped,typename Hash,typename Pred,
+ typename Alloc>
+ booloperator!=(unordered_multimap<Key,Mapped,Hash,Pred,Alloc>const& x,
+ unordered_multimap<Key,Mapped,Hash,Pred,Alloc>const& y);Notes:This is a boost extension.Behavior is undefined if the two containers don't have
+ equivalent equality predicates.unordered_multimap swaptemplate<typename Key,typename Mapped,typename Hash,typename Pred,
+ typename Alloc>
+ voidswap(unordered_multimap<Key,Mapped,Hash,Pred,Alloc>& x,
+ unordered_multimap<Key,Mapped,Hash,Pred,Alloc>& y);Effects:x.swap(y)Throws:If the allocators are equal, doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of Hash or Pred.Notes:For a discussion of the behavior when allocators aren't equal see
+ the implementation details.
+
+
\ No newline at end of file
diff --git a/test/more/tests/misc/processing.gold2 b/test/more/tests/misc/processing.gold2
new file mode 100644
index 0000000..2bf9710
--- /dev/null
+++ b/test/more/tests/misc/processing.gold2
@@ -0,0 +1,5 @@
+
+
+ Test processing instructions
+
+
\ No newline at end of file
diff --git a/test/more/tests/ref/methodname.gold2 b/test/more/tests/ref/methodname.gold2
new file mode 100644
index 0000000..5457964
--- /dev/null
+++ b/test/more/tests/ref/methodname.gold2
@@ -0,0 +1,26 @@
+
+
+ Methodname Test
+
+
+ thing::foo::bar,
+ thing::foo::bar(int x),
+ thing::foo::operator(),
+ thing::foo::operator()(int x).
+
+
+ Reference
+ Header <boost/unordered_set.hpp>namespacething{
+ class foo;
+}
+ Class foo3thing::foo// In header: <boost/unordered_set.hpp>
+
+
+class foo {
+public:
+ voidbar(int);
+ voidoperator()(int);
+};Descriptionvoidbar(int);voidoperator()(int);
+
+
+
\ No newline at end of file
diff --git a/test/more/tests/syntax-highlight/comments.gold2 b/test/more/tests/syntax-highlight/comments.gold2
new file mode 100644
index 0000000..a2b1633
--- /dev/null
+++ b/test/more/tests/syntax-highlight/comments.gold2
@@ -0,0 +1,26 @@
+
+Header <example.hpp>
+ Fake reference documentation, so that the syntax highlighter will kick in.
+
+
+foo
+
+
+ Macro foo3foo// In header: <example.hpp>
+
+fooDescription
+ /* C style comment */
+ /* Broken C style comment
+
+/* Multi-line
+ *comment
+ */
+ /*/ Tricky comment */
+ /**/
+ /***/
+ // Single line comment
+ // Single line comment
+
+
+
+
\ No newline at end of file
diff --git a/test/more/tests/syntax-highlight/language-attribute.gold2 b/test/more/tests/syntax-highlight/language-attribute.gold2
new file mode 100644
index 0000000..9722d10
--- /dev/null
+++ b/test/more/tests/syntax-highlight/language-attribute.gold2
@@ -0,0 +1,13 @@
+
+
+ Test language attribute
+ plain text
+ voidmain(){}
+ actions something ;
+
+
+ plain text
+ voidmain(){}
+ actions something ;
+
+
\ No newline at end of file