From 56aab0081b2900e9534c92c93e4c5056f18d8d93 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 22 Oct 2017 17:39:28 +0100 Subject: [PATCH 01/10] Use sudo to fix 'pip install' in travis --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 64970f5..3bf0d6e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,9 @@ # Distributed under the Boost Software License, Version 1.0. (See accompanying # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +sudo: required +dist: trusty + addons: apt: packages: @@ -12,7 +15,7 @@ addons: before_script: - touch Jamroot.jam - - pip install lxml + - sudo pip install lxml script: - cd ${TRAVIS_BUILD_DIR}/test From 6740d35836e2754a3292509c48f631defa068ddb Mon Sep 17 00:00:00 2001 From: Daniel James Date: Wed, 25 Oct 2017 01:14:53 +0100 Subject: [PATCH 02/10] Run the doxygen tests on travis --- .travis.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3bf0d6e..7d50f51 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,13 +12,18 @@ addons: - xsltproc - docbook-xsl - docbook-xml + - doxygen before_script: - touch Jamroot.jam - sudo pip install lxml + - "echo using boostbook : : : ${TRAVIS_BUILD_DIR} \\; > ~/user-config.jam" + - cat ~/user-config.jam script: - cd ${TRAVIS_BUILD_DIR}/test - - bjam -q ${BJAM_TOOLSET} + - bjam -q + - cd ${TRAVIS_BUILD_DIR}/test/doxygen + - bjam -q - cd ${TRAVIS_BUILD_DIR}/test/more - python run-tests.py From 1b8441c17c5606fb9acc04678d1cd83f3a50285c Mon Sep 17 00:00:00 2001 From: Daniel James Date: Wed, 25 Oct 2017 01:14:54 +0100 Subject: [PATCH 03/10] Use object.id in boostbook to docbook conversion Will generate more consistent ids if generate.consistent.ids is set to 1. --- xsl/docbook.xsl | 4 ++++ xsl/lookup.xsl | 9 +++++---- xsl/macro.xsl | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/xsl/docbook.xsl b/xsl/docbook.xsl index 12bef90..a862bb1 100644 --- a/xsl/docbook.xsl +++ b/xsl/docbook.xsl @@ -9,12 +9,16 @@ + + + + diff --git a/xsl/lookup.xsl b/xsl/lookup.xsl index efc4e8c..eabfff8 100644 --- a/xsl/lookup.xsl +++ b/xsl/lookup.xsl @@ -22,7 +22,7 @@ - + -bb @@ -185,7 +185,7 @@ - + @@ -234,10 +234,11 @@ translate($part, '.<>;\:*?"| ', '') != $part )"> + + substring($normalized, 1, $boost.max.id.part.length - string-length($id) - 1), + concat('_', $id))"/> diff --git a/xsl/macro.xsl b/xsl/macro.xsl index fcd97a2..6d0fd94 100644 --- a/xsl/macro.xsl +++ b/xsl/macro.xsl @@ -115,7 +115,7 @@ _ - + From 02619b765d69af9899e5171ce5bec75c713ea7e8 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 29 Oct 2017 12:03:22 +0000 Subject: [PATCH 04/10] Fix fast-elements In the last commit I changed it to store in fast-elements with the wrong id. Unfortunately this can't be picked up in testing, as the fallback still works correctly. Although it didn't make any notable difference to the build time, so maybe the fast-elements mechanism isn't needed? --- xsl/lookup.xsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xsl/lookup.xsl b/xsl/lookup.xsl index eabfff8..ad8b5e3 100644 --- a/xsl/lookup.xsl +++ b/xsl/lookup.xsl @@ -185,7 +185,7 @@ - + From c7208c85f7a843b3f83b8b857ec3aef46a1f6de1 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 29 Oct 2017 12:40:07 +0000 Subject: [PATCH 05/10] Run tests with and without consistent ids --- test/more/run-tests.py | 68 +- test/more/tests/book/boostbook.gold2 | 4 + test/more/tests/book/chapter.gold2 | 4 + test/more/tests/book/library-autoid.gold2 | 4 + test/more/tests/book/library.gold2 | 4 + test/more/tests/libs/array.gold2 | 311 ++++ test/more/tests/libs/hash-ref.gold2 | 397 +++++ test/more/tests/libs/unordered-ref.gold2 | 1508 +++++++++++++++++ test/more/tests/misc/processing.gold2 | 5 + test/more/tests/ref/methodname.gold2 | 26 + .../tests/syntax-highlight/comments.gold2 | 26 + .../syntax-highlight/language-attribute.gold2 | 13 + 12 files changed, 2343 insertions(+), 27 deletions(-) create mode 100644 test/more/tests/book/boostbook.gold2 create mode 100644 test/more/tests/book/chapter.gold2 create mode 100644 test/more/tests/book/library-autoid.gold2 create mode 100644 test/more/tests/book/library.gold2 create mode 100644 test/more/tests/libs/array.gold2 create mode 100644 test/more/tests/libs/hash-ref.gold2 create mode 100644 test/more/tests/libs/unordered-ref.gold2 create mode 100644 test/more/tests/misc/processing.gold2 create mode 100644 test/more/tests/ref/methodname.gold2 create mode 100644 test/more/tests/syntax-highlight/comments.gold2 create mode 100644 test/more/tests/syntax-highlight/language-attribute.gold2 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 <<ulink url="../../boost/array.hpp">boost/array.hpp</ulink>>namespace boost { + template<typename T, std::size_t N> class array; + template<typename T, std::size_t N> void swap(array<T, N>&, array<T, N>&); + template<typename T, std::size_t N> + bool operator==(const array<T, N>&, const array<T, N>&); + template<typename T, std::size_t N> + bool operator!=(const array<T, N>&, const array<T, N>&); + template<typename T, std::size_t N> + bool operator<(const array<T, N>&, const array<T, N>&); + template<typename T, std::size_t N> + bool operator>(const array<T, N>&, const array<T, N>&); + template<typename T, std::size_t N> + bool operator<=(const array<T, N>&, const array<T, N>&); + template<typename T, std::size_t N> + bool operator>=(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 + typedef T value_type; + typedef T* iterator; + typedef const T* const_iterator; + typedef std::reverse_iterator<iterator> reverse_iterator; + typedef std::reverse_iterator<const_iterator> const_reverse_iterator; + typedef T& reference; + typedef const T& const_reference; + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + + // static constants + static const size_type static_size = N; + + // construct/copy/destruct + template<typename U> array& operator=(const array<U, N>&); + + // iterator support + iterator begin(); + const_iterator begin() const; + iterator end(); + const_iterator end() const; + + // reverse iterator support + reverse_iterator rbegin(); + const_reverse_iterator rbegin() const; + reverse_iterator rend(); + const_reverse_iterator rend() const; + + // capacity + size_type size(); + bool empty(); + size_type max_size(); + + // element access + reference operator[](size_type); + const_reference operator[](size_type) const; + reference at(size_type); + const_reference at(size_type) const; + reference front(); + const_reference front() const; + reference back(); + const_reference back() const; + const T* data() const; + T* c_array(); + + // modifiers + void swap(array<T, N>&); + void assign(const T&); + + // public data members + T elems[N]; +}; + +// specialized algorithms +template<typename T, std::size_t N> void swap(array<T, N>&, array<T, N>&); + +// comparisons +template<typename T, std::size_t N> + bool operator==(const array<T, N>&, const array<T, N>&); +template<typename T, std::size_t N> + bool operator!=(const array<T, N>&, const array<T, N>&); +template<typename T, std::size_t N> + bool operator<(const array<T, N>&, const array<T, N>&); +template<typename T, std::size_t N> + bool operator>(const array<T, N>&, const array<T, N>&); +template<typename T, std::size_t N> + bool operator<=(const array<T, N>&, const array<T, N>&); +template<typename T, std::size_t N> + bool operator>=(const array<T, N>&, const array<T, N>&);Description<anchor id="boost.arrayconstruct-copy-destruct"/><computeroutput>array</computeroutput> + public + construct/copy/destructtemplate<typename U> array& operator=(const array<U, N>& other);Effects:std::copy(rhs.begin(),rhs.end(), begin())<anchor id="id-1.4.1.1.1.14-bb"/><computeroutput>array</computeroutput> iterator supportiterator begin(); +const_iterator begin() const;Returns:iterator for the first elementThrows:will not throwiterator end(); +const_iterator end() const;Returns:iterator for position after the last elementThrows:will not throw<anchor id="id-1.4.1.1.1.15-bb"/><computeroutput>array</computeroutput> reverse iterator supportreverse_iterator rbegin(); +const_reverse_iterator rbegin() const;Returns:reverse iterator for the first element of reverse iterationreverse_iterator rend(); +const_reverse_iterator rend() const;Returns:reverse iterator for position after the last element in reverse iteration<anchor id="id-1.4.1.1.1.16-bb"/><computeroutput>array</computeroutput> capacitysize_type size();Returns:Nbool empty();Returns:N==0Throws:will not throwsize_type max_size();Returns:NThrows:will not throw<anchor id="id-1.4.1.1.1.17-bb"/><computeroutput>array</computeroutput> element accessreference operator[](size_type i); +const_reference operator[](size_type i) const;Requires:i < NReturns:element with index iThrows:will not throw.reference at(size_type i); +const_reference at(size_type i) const;Returns:element with index iThrows:std::range_error if i >= Nreference front(); +const_reference front() const;Requires:N > 0Returns:the first elementThrows:will not throwreference back(); +const_reference back() const;Requires:N > 0Returns:the last elementThrows:will not throwconst T* data() const;Returns:elemsThrows:will not throwT* c_array();Returns:elemsThrows:will not throw<anchor id="id-1.4.1.1.1.18-bb"/><computeroutput>array</computeroutput> modifiersvoid swap(array<T, N>& other);Effects:std::swap_ranges(begin(), end(), other.begin())Complexity:linear in Nvoid assign(const T& value);Effects:std::fill_n(begin(), N, value)<anchor id="id-1.4.1.1.1.20-bb"/><computeroutput>array</computeroutput> specialized algorithmstemplate<typename T, std::size_t N> void swap(array<T, N>& x, array<T, N>& y);Effects:x.swap(y)Throws:will not throw.<anchor id="id-1.4.1.1.1.21-bb"/><computeroutput>array</computeroutput> comparisonstemplate<typename T, std::size_t N> + bool operator==(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> + bool operator!=(const array<T, N>& x, const array<T, N>& y);Returns:!(x == y)template<typename T, std::size_t N> + bool operator<(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> + bool operator>(const array<T, N>& x, const array<T, N>& y);Returns:y < xtemplate<typename T, std::size_t N> + bool operator<=(const array<T, N>& x, const array<T, N>& y);Returns:!(y < x)template<typename T, std::size_t N> + bool operator>=(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 <<ulink url="../../boost/functional/hash.hpp">boost/functional/hash.hpp</ulink>> + Defines boost::hash, + and helper functions. + namespace boost { + template<typename T> struct hash; + + template<> struct hash<bool>; + template<> struct hash<char>; + template<> struct hash<signed char>; + template<> struct hash<unsigned char>; + template<> struct hash<wchar_t>; + template<> struct hash<short>; + template<> struct hash<unsigned short>; + template<> struct hash<int>; + template<> struct hash<unsigned int>; + template<> struct hash<long>; + template<> struct hash<unsigned long>; + template<> struct hash<long long>; + template<> struct hash<unsigned long long>; + template<> struct hash<float>; + template<> struct hash<double>; + template<> struct hash<long double>; + template<> struct hash<std::string>; + template<> struct hash<std::wstring>; + template<typename T> struct hash<T*>; + + // Support functions (Boost extension). + template<typename T> void hash_combine(size_t &, T const&); + template<typename It> std::size_t hash_range(It, It); + template<typename It> void hash_range(std::size_t&, It, It); + + // Overloadable hash implementation (Boost extension). + std::size_t hash_value(bool); + std::size_t hash_value(char); + std::size_t hash_value(signed char); + std::size_t hash_value(unsigned char); + std::size_t hash_value(wchar_t); + std::size_t hash_value(short); + std::size_t hash_value(unsigned short); + std::size_t hash_value(int); + std::size_t hash_value(unsigned int); + std::size_t hash_value(long); + std::size_t hash_value(unsigned long); + std::size_t hash_value(long long); + std::size_t hash_value(unsigned long long); + std::size_t hash_value(float); + std::size_t hash_value(double); + std::size_t hash_value(long double); + template<typename T> std::size_t hash_value(T* const&); + template<typename T, unsigned N> std::size_t hash_value(T (&val)[N]); + template<typename T, unsigned N> std::size_t hash_value(const T (&val)[N]); + template<typename Ch, typename A> + std::size_t hash_value(std::basic_string<Ch, std::char_traits<Ch>, A> const&); + template<typename A, typename B> + std::size_t hash_value(std::pair<A, B> const&); + template<typename T, typename A> + std::size_t hash_value(std::vector<T, A> const&); + template<typename T, typename A> + std::size_t hash_value(std::list<T, A> const&); + template<typename T, typename A> + std::size_t hash_value(std::deque<T, A> const&); + template<typename K, typename C, typename A> + std::size_t hash_value(std::set<K, C, A> const&); + template<typename K, typename C, typename A> + std::size_t hash_value(std::multiset<K, C, A> const&); + template<typename K, typename T, typename C, typename A> + std::size_t hash_value(std::map<K, T, C, A> const&); + template<typename K, typename T, typename C, typename A> + std::size_t hash_value(std::multimap<K, T, C, A> const&); + template<typename T> std::size_t hash_value(std::complex<T> const&); +} + + + <anchor id="id-1.2.2.21-bb"/><computeroutput/> Support functions (Boost extension).template<typename T> void hash_combine(size_t & seed, T const& 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_t hash_range(It first, It last); +template<typename It> void hash_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_t seed = 0; + +for(; first != last; ++first) +{ + hash_combine(seed, *first); +} + +return seed; + + 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. + <anchor id="id-1.2.2.22-bb"/><computeroutput/> Overloadable hash implementation (Boost extension).std::size_t hash_value(bool val); +std::size_t hash_value(char val); +std::size_t hash_value(signed char val); +std::size_t hash_value(unsigned char val); +std::size_t hash_value(wchar_t val); +std::size_t hash_value(short val); +std::size_t hash_value(unsigned short val); +std::size_t hash_value(int val); +std::size_t hash_value(unsigned int val); +std::size_t hash_value(long val); +std::size_t hash_value(unsigned long val); +std::size_t hash_value(long long val); +std::size_t hash_value(unsigned long long val); +std::size_t hash_value(float val); +std::size_t hash_value(double val); +std::size_t hash_value(long double val); +template<typename T> std::size_t hash_value(T* const& val); +template<typename T, unsigned N> std::size_t hash_value(T (&val)[N]); +template<typename T, unsigned N> std::size_t hash_value(const T (&val)[N]); +template<typename Ch, typename A> + std::size_t hash_value(std::basic_string<Ch, std::char_traits<Ch>, A> const& val); +template<typename A, typename B> + std::size_t hash_value(std::pair<A, B> const& val); +template<typename T, typename A> + std::size_t hash_value(std::vector<T, A> const& val); +template<typename T, typename A> + std::size_t hash_value(std::list<T, A> const& val); +template<typename T, typename A> + std::size_t hash_value(std::deque<T, A> const& val); +template<typename K, typename C, typename A> + std::size_t hash_value(std::set<K, C, A> const& val); +template<typename K, typename C, typename A> + std::size_t hash_value(std::multiset<K, C, A> const& val); +template<typename K, typename T, typename C, typename A> + std::size_t hash_value(std::map<K, T, C, A> const& val); +template<typename K, typename T, typename C, typename A> + std::size_t hash_value(std::multimap<K, T, C, A> const& val); +template<typename T> std::size_t hash_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_t seed = 0; +hash_combine(seed, val.first); +hash_combine(seed, val.second); +return seed; + + + + 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_t operator()(T const&) const; +};Descriptionstd::size_t operator()(T const& 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_t operator()(bool) const; +};Descriptionstd::size_t operator()(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_t operator()(char) const; +};Descriptionstd::size_t operator()(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<signed char> { + std::size_t operator()(signed char) const; +};Descriptionstd::size_t operator()(signed 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<unsigned char>3boost::hash<unsigned char>// In header: <boost/functional/hash.hpp> + + +struct hash<unsigned char> { + std::size_t operator()(unsigned char) const; +};Descriptionstd::size_t operator()(unsigned 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<wchar_t>3boost::hash<wchar_t>// In header: <boost/functional/hash.hpp> + + +struct hash<wchar_t> { + std::size_t operator()(wchar_t) const; +};Descriptionstd::size_t operator()(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_t operator()(short) const; +};Descriptionstd::size_t operator()(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<unsigned short> { + std::size_t operator()(unsigned short) const; +};Descriptionstd::size_t operator()(unsigned 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<int>3boost::hash<int>// In header: <boost/functional/hash.hpp> + + +struct hash<int> { + std::size_t operator()(int) const; +};Descriptionstd::size_t operator()(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<unsigned int> { + std::size_t operator()(unsigned int) const; +};Descriptionstd::size_t operator()(unsigned 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<long>3boost::hash<long>// In header: <boost/functional/hash.hpp> + + +struct hash<long> { + std::size_t operator()(long) const; +};Descriptionstd::size_t operator()(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<unsigned long> { + std::size_t operator()(unsigned long) const; +};Descriptionstd::size_t operator()(unsigned 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<long long>3boost::hash<long long>// In header: <boost/functional/hash.hpp> + + +struct hash<long long> { + std::size_t operator()(long long) const; +};Descriptionstd::size_t operator()(long 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 long>3boost::hash<unsigned long long>// In header: <boost/functional/hash.hpp> + + +struct hash<unsigned long long> { + std::size_t operator()(unsigned long long) const; +};Descriptionstd::size_t operator()(unsigned long 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<float>3boost::hash<float>// In header: <boost/functional/hash.hpp> + + +struct hash<float> { + std::size_t operator()(float) const; +};Descriptionstd::size_t operator()(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_t operator()(double) const; +};Descriptionstd::size_t operator()(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<long double> { + std::size_t operator()(long double) const; +};Descriptionstd::size_t operator()(long 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<std::string>3boost::hash<std::string>// In header: <boost/functional/hash.hpp> + + +struct hash<std::string> { + std::size_t operator()(std::string const&) const; +};Descriptionstd::size_t operator()(std::string const& 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_t operator()(std::wstring const&) const; +};Descriptionstd::size_t operator()(std::wstring const& 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_t operator()(T*) const; +};Descriptionstd::size_t operator()(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 <<ulink url="../../boost/unordered_set.hpp">boost/unordered_set.hpp</ulink>>namespace boost { + 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> + bool operator==(unordered_set<Value, Hash, Pred, Alloc> const&, + unordered_set<Value, Hash, Pred, Alloc> const&); + template<typename Value, typename Hash, typename Pred, typename Alloc> + bool operator!=(unordered_set<Value, Hash, Pred, Alloc> const&, + unordered_set<Value, Hash, Pred, Alloc> const&); + template<typename Value, typename Hash, typename Pred, typename Alloc> + void swap(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> + bool operator==(unordered_multiset<Value, Hash, Pred, Alloc> const&, + unordered_multiset<Value, Hash, Pred, Alloc> const&); + template<typename Value, typename Hash, typename Pred, typename Alloc> + bool operator!=(unordered_multiset<Value, Hash, Pred, Alloc> const&, + unordered_multiset<Value, Hash, Pred, Alloc> const&); + template<typename Value, typename Hash, typename Pred, typename Alloc> + void swap(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 + typedef Value key_type; + typedef Value value_type; + typedef Hash hasher; + typedef Pred key_equal; + typedef Alloc allocator_type; + typedef typename allocator_type::pointer pointer; + typedef typename allocator_type::const_pointer const_pointer; + typedef typename allocator_type::reference reference; // lvalue of value_type. + typedef typename allocator_type::const_reference const_reference; // const lvalue of value_type. + typedef implementation-defined size_type; + typedef implementation-defined difference_type; + typedef implementation-defined iterator; + typedef implementation-defined const_iterator; + typedef implementation-defined local_iterator; + typedef implementation-defined const_local_iterator; + + // construct/copy/destruct + explicit unordered_set(size_type = implementation-defined, + hasher const& = hasher(), + key_equal const& = key_equal(), + allocator_type const& = allocator_type()); + template<typename InputIterator> + unordered_set(InputIterator, InputIterator, + size_type = implementation-defined, + hasher const& = hasher(), key_equal const& = key_equal(), + allocator_type const& = allocator_type()); + unordered_set(unordered_set const&); + unordered_set(unordered_set &&); + explicit unordered_set(Allocator const&); + unordered_set(unordered_set const&, Allocator const&); + ~unordered_set(); + unordered_set& operator=(unordered_set const&); + unordered_set& operator=(unordered_set &&); + allocator_type get_allocator() const; + + // size and capacity + bool empty() const; + size_type size() const; + size_type max_size() const; + + // iterators + iterator begin(); + const_iterator begin() const; + iterator end(); + const_iterator end() const; + const_iterator cbegin() const; + const_iterator cend() const; + + // modifiers + template<typename... Args> std::pair<iterator, bool> emplace(Args&&...); + template<typename... Args> iterator emplace_hint(const_iterator, Args&&...); + std::pair<iterator, bool> insert(value_type const&); + iterator insert(const_iterator, value_type const&); + template<typename InputIterator> void insert(InputIterator, InputIterator); + iterator erase(const_iterator); + size_type erase(key_type const&); + iterator erase(const_iterator, const_iterator); + void quick_erase(const_iterator); + void erase_return_void(const_iterator); + void clear(); + void swap(unordered_set&); + + // observers + hasher hash_function() const; + key_equal key_eq() const; + + // lookup + iterator find(key_type const&); + const_iterator find(key_type const&) const; + template<typename CompatibleKey, typename CompatibleHash, + typename CompatiblePredicate> + iterator find(CompatibleKey const&, CompatibleHash const&, + CompatiblePredicate const&); + template<typename CompatibleKey, typename CompatibleHash, + typename CompatiblePredicate> + const_iterator + find(CompatibleKey const&, CompatibleHash const&, + CompatiblePredicate const&) const; + size_type count(key_type const&) const; + std::pair<iterator, iterator> equal_range(key_type const&); + std::pair<const_iterator, const_iterator> equal_range(key_type const&) const; + + // bucket interface + size_type bucket_count() const; + size_type max_bucket_count() const; + size_type bucket_size(size_type) const; + size_type bucket(key_type const&) const; + local_iterator begin(size_type); + const_local_iterator begin(size_type) const; + local_iterator end(size_type); + const_local_iterator end(size_type) const; + const_local_iterator cbegin(size_type) const; + const_local_iterator cend(size_type); + + // hash policy + float load_factor() const; + float max_load_factor() const; + void max_load_factor(float); + void rehash(size_type); +}; + +// Equality Comparisons +template<typename Value, typename Hash, typename Pred, typename Alloc> + bool operator==(unordered_set<Value, Hash, Pred, Alloc> const&, + unordered_set<Value, Hash, Pred, Alloc> const&); +template<typename Value, typename Hash, typename Pred, typename Alloc> + bool operator!=(unordered_set<Value, Hash, Pred, Alloc> const&, + unordered_set<Value, Hash, Pred, Alloc> const&); + +// swap +template<typename Value, typename Hash, typename Pred, typename Alloc> + void swap(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. + <anchor id="boost.unordered_settypes"/><computeroutput>unordered_set</computeroutput> + public + types +typedef implementation-defined size_type; + An unsigned integral type. + size_type can represent any non-negative value of difference_type. + +typedef implementation-defined difference_type; + A signed integral type. + Is identical to the difference type of iterator and const_iterator. + +typedef implementation-defined iterator; + A constant iterator whose value type is value_type. + The iterator category is at least a forward iterator. + Convertible to const_iterator. + +typedef implementation-defined const_iterator; + A constant iterator whose value type is value_type. + The iterator category is at least a forward iterator. + +typedef implementation-defined local_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. + +typedef implementation-defined const_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. + <anchor id="boost.unordered_setconstruct-copy-destruct"/><computeroutput>unordered_set</computeroutput> + public + construct/copy/destructexplicit unordered_set(size_type n = implementation-defined, + hasher const& hf = hasher(), + key_equal const& eq = key_equal(), + allocator_type const& 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, + hasher const& hf = hasher(), + key_equal const& eq = key_equal(), + allocator_type const& 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_set const&);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). + explicit unordered_set(Allocator const& a);Constructs an empty container, using allocator a.unordered_set(unordered_set const& x, Allocator const& 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_set const&);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_type get_allocator() const;<anchor id="id-1.1.1.1.29-bb"/><computeroutput>unordered_set</computeroutput> size and capacitybool empty() const;Returns:size() == 0size_type size() const;Returns:std::distance(begin(), end())size_type max_size() const;Returns:size() of the largest possible container. + <anchor id="id-1.1.1.1.30-bb"/><computeroutput>unordered_set</computeroutput> iteratorsiterator begin(); +const_iterator begin() 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. + iterator end(); +const_iterator end() const;Returns:An iterator which refers to the past-the-end value for the container. + const_iterator cbegin() 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_iterator cend() const;Returns:A constant iterator which refers to the past-the-end value for the container. + <anchor id="id-1.1.1.1.31-bb"/><computeroutput>unordered_set</computeroutput> 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> + iterator emplace_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_type const& 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.iterator insert(const_iterator hint, value_type const& 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> + void insert(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.iterator erase(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_type erase(key_type const& 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.iterator erase(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.void quick_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. + void erase_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. + void clear();Erases all elements in the container.Postconditions:size() == 0Throws:Never throws an exception.void swap(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.<anchor id="id-1.1.1.1.32-bb"/><computeroutput>unordered_set</computeroutput> observershasher hash_function() const;Returns:The container's hash function. + key_equal key_eq() const;Returns:The container's key equality predicate. + <anchor id="id-1.1.1.1.33-bb"/><computeroutput>unordered_set</computeroutput> lookupiterator find(key_type const& k); +const_iterator find(key_type const& k) const; +template<typename CompatibleKey, typename CompatibleHash, + typename CompatiblePredicate> + iterator find(CompatibleKey const& k, CompatibleHash const& hash, + CompatiblePredicate const& eq); +template<typename CompatibleKey, typename CompatibleHash, + typename CompatiblePredicate> + const_iterator + find(CompatibleKey const& k, CompatibleHash const& hash, + CompatiblePredicate const& 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_type count(key_type const& k) const;Returns:The number of elements with key equivalent to k.std::pair<iterator, iterator> equal_range(key_type const& k); +std::pair<const_iterator, const_iterator> equal_range(key_type const& 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()). + <anchor id="id-1.1.1.1.34-bb"/><computeroutput>unordered_set</computeroutput> bucket interfacesize_type bucket_count() const;Returns:The number of buckets.size_type max_bucket_count() const;Returns:An upper bound on the number of buckets.size_type bucket_size(size_type n) const;Requires:n < bucket_count()Returns:The number of elements in bucket n.size_type bucket(key_type const& 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_iterator begin(size_type n); +const_local_iterator begin(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_iterator end(size_type n); +const_local_iterator end(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_iterator cbegin(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_iterator cend(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.<anchor id="id-1.1.1.1.35-bb"/><computeroutput>unordered_set</computeroutput> hash policyfloat load_factor() const;Returns:The average number of elements per bucket.float max_load_factor() const;Returns:Returns the current maximum load factor.void max_load_factor(float z);Effects:Changes the container's maximum load factor, using z as a hint.void rehash(size_type n);Changes the number of buckets so that there at least n buckets, and so that the load factor is less than the maximum load factor.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.<anchor id="id-1.1.1.1.36-bb"/><computeroutput>unordered_set</computeroutput> Equality Comparisonstemplate<typename Value, typename Hash, typename Pred, typename Alloc> + bool operator==(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> + bool operator!=(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.<anchor id="id-1.1.1.1.37-bb"/><computeroutput>unordered_set</computeroutput> swaptemplate<typename Value, typename Hash, typename Pred, typename Alloc> + void swap(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 + typedef Value key_type; + typedef Value value_type; + typedef Hash hasher; + typedef Pred key_equal; + typedef Alloc allocator_type; + typedef typename allocator_type::pointer pointer; + typedef typename allocator_type::const_pointer const_pointer; + typedef typename allocator_type::reference reference; // lvalue of value_type. + typedef typename allocator_type::const_reference const_reference; // const lvalue of value_type. + typedef implementation-defined size_type; + typedef implementation-defined difference_type; + typedef implementation-defined iterator; + typedef implementation-defined const_iterator; + typedef implementation-defined local_iterator; + typedef implementation-defined const_local_iterator; + + // construct/copy/destruct + explicit unordered_multiset(size_type = implementation-defined, + hasher const& = hasher(), + key_equal const& = key_equal(), + allocator_type const& = allocator_type()); + template<typename InputIterator> + unordered_multiset(InputIterator, InputIterator, + size_type = implementation-defined, + hasher const& = hasher(), + key_equal const& = key_equal(), + allocator_type const& = allocator_type()); + unordered_multiset(unordered_multiset const&); + unordered_multiset(unordered_multiset &&); + explicit unordered_multiset(Allocator const&); + unordered_multiset(unordered_multiset const&, Allocator const&); + ~unordered_multiset(); + unordered_multiset& operator=(unordered_multiset const&); + unordered_multiset& operator=(unordered_multiset &&); + allocator_type get_allocator() const; + + // size and capacity + bool empty() const; + size_type size() const; + size_type max_size() const; + + // iterators + iterator begin(); + const_iterator begin() const; + iterator end(); + const_iterator end() const; + const_iterator cbegin() const; + const_iterator cend() const; + + // modifiers + template<typename... Args> iterator emplace(Args&&...); + template<typename... Args> iterator emplace_hint(const_iterator, Args&&...); + iterator insert(value_type const&); + iterator insert(const_iterator, value_type const&); + template<typename InputIterator> void insert(InputIterator, InputIterator); + iterator erase(const_iterator); + size_type erase(key_type const&); + iterator erase(const_iterator, const_iterator); + void quick_erase(const_iterator); + void erase_return_void(const_iterator); + void clear(); + void swap(unordered_multiset&); + + // observers + hasher hash_function() const; + key_equal key_eq() const; + + // lookup + iterator find(key_type const&); + const_iterator find(key_type const&) const; + template<typename CompatibleKey, typename CompatibleHash, + typename CompatiblePredicate> + iterator find(CompatibleKey const&, CompatibleHash const&, + CompatiblePredicate const&); + template<typename CompatibleKey, typename CompatibleHash, + typename CompatiblePredicate> + const_iterator + find(CompatibleKey const&, CompatibleHash const&, + CompatiblePredicate const&) const; + size_type count(key_type const&) const; + std::pair<iterator, iterator> equal_range(key_type const&); + std::pair<const_iterator, const_iterator> equal_range(key_type const&) const; + + // bucket interface + size_type bucket_count() const; + size_type max_bucket_count() const; + size_type bucket_size(size_type) const; + size_type bucket(key_type const&) const; + local_iterator begin(size_type); + const_local_iterator begin(size_type) const; + local_iterator end(size_type); + const_local_iterator end(size_type) const; + const_local_iterator cbegin(size_type) const; + const_local_iterator cend(size_type); + + // hash policy + float load_factor() const; + float max_load_factor() const; + void max_load_factor(float); + void rehash(size_type); +}; + +// Equality Comparisons +template<typename Value, typename Hash, typename Pred, typename Alloc> + bool operator==(unordered_multiset<Value, Hash, Pred, Alloc> const&, + unordered_multiset<Value, Hash, Pred, Alloc> const&); +template<typename Value, typename Hash, typename Pred, typename Alloc> + bool operator!=(unordered_multiset<Value, Hash, Pred, Alloc> const&, + unordered_multiset<Value, Hash, Pred, Alloc> const&); + +// swap +template<typename Value, typename Hash, typename Pred, typename Alloc> + void swap(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. + <anchor id="boost.unordered_multisettypes"/><computeroutput>unordered_multiset</computeroutput> + public + types +typedef implementation-defined size_type; + An unsigned integral type. + size_type can represent any non-negative value of difference_type. + +typedef implementation-defined difference_type; + A signed integral type. + Is identical to the difference type of iterator and const_iterator. + +typedef implementation-defined iterator; + A constant iterator whose value type is value_type. + The iterator category is at least a forward iterator. + Convertible to const_iterator. + +typedef implementation-defined const_iterator; + A constant iterator whose value type is value_type. + The iterator category is at least a forward iterator. + +typedef implementation-defined local_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. + +typedef implementation-defined const_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. + <anchor id="boost.unordered_multisetconstruct-copy-destruct"/><computeroutput>unordered_multiset</computeroutput> + public + construct/copy/destructexplicit unordered_multiset(size_type n = implementation-defined, + hasher const& hf = hasher(), + key_equal const& eq = key_equal(), + allocator_type const& 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, + hasher const& hf = hasher(), + key_equal const& eq = key_equal(), + allocator_type const& 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_multiset const&);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). + explicit unordered_multiset(Allocator const& a);Constructs an empty container, using allocator a.unordered_multiset(unordered_multiset const& x, Allocator const& 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_multiset const&);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_type get_allocator() const;<anchor id="id-1.1.1.2.29-bb"/><computeroutput>unordered_multiset</computeroutput> size and capacitybool empty() const;Returns:size() == 0size_type size() const;Returns:std::distance(begin(), end())size_type max_size() const;Returns:size() of the largest possible container. + <anchor id="id-1.1.1.2.30-bb"/><computeroutput>unordered_multiset</computeroutput> iteratorsiterator begin(); +const_iterator begin() 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. + iterator end(); +const_iterator end() const;Returns:An iterator which refers to the past-the-end value for the container. + const_iterator cbegin() 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_iterator cend() const;Returns:A constant iterator which refers to the past-the-end value for the container. + <anchor id="id-1.1.1.2.31-bb"/><computeroutput>unordered_multiset</computeroutput> modifierstemplate<typename... Args> iterator emplace(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> + iterator emplace_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.iterator insert(value_type const& 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.iterator insert(const_iterator hint, value_type const& 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> + void insert(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.iterator erase(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_type erase(key_type const& 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.iterator erase(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.void quick_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. + void erase_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. + void clear();Erases all elements in the container.Postconditions:size() == 0Throws:Never throws an exception.void swap(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.<anchor id="id-1.1.1.2.32-bb"/><computeroutput>unordered_multiset</computeroutput> observershasher hash_function() const;Returns:The container's hash function. + key_equal key_eq() const;Returns:The container's key equality predicate. + <anchor id="id-1.1.1.2.33-bb"/><computeroutput>unordered_multiset</computeroutput> lookupiterator find(key_type const& k); +const_iterator find(key_type const& k) const; +template<typename CompatibleKey, typename CompatibleHash, + typename CompatiblePredicate> + iterator find(CompatibleKey const& k, CompatibleHash const& hash, + CompatiblePredicate const& eq); +template<typename CompatibleKey, typename CompatibleHash, + typename CompatiblePredicate> + const_iterator + find(CompatibleKey const& k, CompatibleHash const& hash, + CompatiblePredicate const& 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_type count(key_type const& k) const;Returns:The number of elements with key equivalent to k.std::pair<iterator, iterator> equal_range(key_type const& k); +std::pair<const_iterator, const_iterator> equal_range(key_type const& 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()). + <anchor id="id-1.1.1.2.34-bb"/><computeroutput>unordered_multiset</computeroutput> bucket interfacesize_type bucket_count() const;Returns:The number of buckets.size_type max_bucket_count() const;Returns:An upper bound on the number of buckets.size_type bucket_size(size_type n) const;Requires:n < bucket_count()Returns:The number of elements in bucket n.size_type bucket(key_type const& 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_iterator begin(size_type n); +const_local_iterator begin(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_iterator end(size_type n); +const_local_iterator end(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_iterator cbegin(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_iterator cend(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.<anchor id="id-1.1.1.2.35-bb"/><computeroutput>unordered_multiset</computeroutput> hash policyfloat load_factor() const;Returns:The average number of elements per bucket.float max_load_factor() const;Returns:Returns the current maximum load factor.void max_load_factor(float z);Effects:Changes the container's maximum load factor, using z as a hint.void rehash(size_type n);Changes the number of buckets so that there at least n buckets, and so that the load factor is less than the maximum load factor.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.<anchor id="id-1.1.1.2.36-bb"/><computeroutput>unordered_multiset</computeroutput> Equality Comparisonstemplate<typename Value, typename Hash, typename Pred, typename Alloc> + bool operator==(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> + bool operator!=(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.<anchor id="id-1.1.1.2.37-bb"/><computeroutput>unordered_multiset</computeroutput> swaptemplate<typename Value, typename Hash, typename Pred, typename Alloc> + void swap(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 <<ulink url="../../boost/unordered_map.hpp">boost/unordered_map.hpp</ulink>>namespace boost { + template<typename Key, typename Mapped, typename Hash = boost::hash<Key>, + typename Pred = std::equal_to<Key>, + typename Alloc = std::allocator<std::pair<Key const, Mapped> > > + class unordered_map; + template<typename Key, typename Mapped, typename Hash, typename Pred, + typename Alloc> + bool operator==(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> + bool operator!=(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> + void swap(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<Key const, Mapped> > > + class unordered_multimap; + template<typename Key, typename Mapped, typename Hash, typename Pred, + typename Alloc> + bool operator==(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> + bool operator!=(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> + void swap(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<Key const, Mapped> > > +class unordered_map { +public: + // types + typedef Key key_type; + typedef std::pair<Key const, Mapped> value_type; + typedef Mapped mapped_type; + typedef Hash hasher; + typedef Pred key_equal; + typedef Alloc allocator_type; + typedef typename allocator_type::pointer pointer; + typedef typename allocator_type::const_pointer const_pointer; + typedef typename allocator_type::reference reference; // lvalue of value_type. + typedef typename allocator_type::const_reference const_reference; // const lvalue of value_type. + typedef implementation-defined size_type; + typedef implementation-defined difference_type; + typedef implementation-defined iterator; + typedef implementation-defined const_iterator; + typedef implementation-defined local_iterator; + typedef implementation-defined const_local_iterator; + + // construct/copy/destruct + explicit unordered_map(size_type = implementation-defined, + hasher const& = hasher(), + key_equal const& = key_equal(), + allocator_type const& = allocator_type()); + template<typename InputIterator> + unordered_map(InputIterator, InputIterator, + size_type = implementation-defined, + hasher const& = hasher(), key_equal const& = key_equal(), + allocator_type const& = allocator_type()); + unordered_map(unordered_map const&); + unordered_map(unordered_map &&); + explicit unordered_map(Allocator const&); + unordered_map(unordered_map const&, Allocator const&); + ~unordered_map(); + unordered_map& operator=(unordered_map const&); + unordered_map& operator=(unordered_map &&); + allocator_type get_allocator() const; + + // size and capacity + bool empty() const; + size_type size() const; + size_type max_size() const; + + // iterators + iterator begin(); + const_iterator begin() const; + iterator end(); + const_iterator end() const; + const_iterator cbegin() const; + const_iterator cend() const; + + // modifiers + template<typename... Args> std::pair<iterator, bool> emplace(Args&&...); + template<typename... Args> iterator emplace_hint(const_iterator, Args&&...); + std::pair<iterator, bool> insert(value_type const&); + iterator insert(const_iterator, value_type const&); + template<typename InputIterator> void insert(InputIterator, InputIterator); + iterator erase(const_iterator); + size_type erase(key_type const&); + iterator erase(const_iterator, const_iterator); + void quick_erase(const_iterator); + void erase_return_void(const_iterator); + void clear(); + void swap(unordered_map&); + + // observers + hasher hash_function() const; + key_equal key_eq() const; + + // lookup + iterator find(key_type const&); + const_iterator find(key_type const&) const; + template<typename CompatibleKey, typename CompatibleHash, + typename CompatiblePredicate> + iterator find(CompatibleKey const&, CompatibleHash const&, + CompatiblePredicate const&); + template<typename CompatibleKey, typename CompatibleHash, + typename CompatiblePredicate> + const_iterator + find(CompatibleKey const&, CompatibleHash const&, + CompatiblePredicate const&) const; + size_type count(key_type const&) const; + std::pair<iterator, iterator> equal_range(key_type const&); + std::pair<const_iterator, const_iterator> equal_range(key_type const&) const; + mapped_type& operator[](key_type const&); + Mapped& at(key_type const&); + Mapped const& at(key_type const&) const; + + // bucket interface + size_type bucket_count() const; + size_type max_bucket_count() const; + size_type bucket_size(size_type) const; + size_type bucket(key_type const&) const; + local_iterator begin(size_type); + const_local_iterator begin(size_type) const; + local_iterator end(size_type); + const_local_iterator end(size_type) const; + const_local_iterator cbegin(size_type) const; + const_local_iterator cend(size_type); + + // hash policy + float load_factor() const; + float max_load_factor() const; + void max_load_factor(float); + void rehash(size_type); +}; + +// Equality Comparisons +template<typename Key, typename Mapped, typename Hash, typename Pred, + typename Alloc> + bool operator==(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> + bool operator!=(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> + void swap(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. + <anchor id="boost.unordered_maptypes"/><computeroutput>unordered_map</computeroutput> + public + types +typedef implementation-defined size_type; + An unsigned integral type. + size_type can represent any non-negative value of difference_type. + +typedef implementation-defined difference_type; + A signed integral type. + Is identical to the difference type of iterator and const_iterator. + +typedef implementation-defined iterator; + A iterator whose value type is value_type. + The iterator category is at least a forward iterator. + Convertible to const_iterator. + +typedef implementation-defined const_iterator; + A constant iterator whose value type is value_type. + The iterator category is at least a forward iterator. + +typedef implementation-defined local_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. + +typedef implementation-defined const_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. + <anchor id="boost.unordered_mapconstruct-copy-destruct"/><computeroutput>unordered_map</computeroutput> + public + construct/copy/destructexplicit unordered_map(size_type n = implementation-defined, + hasher const& hf = hasher(), + key_equal const& eq = key_equal(), + allocator_type const& 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, + hasher const& hf = hasher(), + key_equal const& eq = key_equal(), + allocator_type const& 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_map const&);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). + explicit unordered_map(Allocator const& a);Constructs an empty container, using allocator a.unordered_map(unordered_map const& x, Allocator const& 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_map const&);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_type get_allocator() const;<anchor id="id-1.2.1.1.30-bb"/><computeroutput>unordered_map</computeroutput> size and capacitybool empty() const;Returns:size() == 0size_type size() const;Returns:std::distance(begin(), end())size_type max_size() const;Returns:size() of the largest possible container. + <anchor id="id-1.2.1.1.31-bb"/><computeroutput>unordered_map</computeroutput> iteratorsiterator begin(); +const_iterator begin() 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. + iterator end(); +const_iterator end() const;Returns:An iterator which refers to the past-the-end value for the container. + const_iterator cbegin() 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_iterator cend() const;Returns:A constant iterator which refers to the past-the-end value for the container. + <anchor id="id-1.2.1.1.32-bb"/><computeroutput>unordered_map</computeroutput> 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> + iterator emplace_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_type const& 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.iterator insert(const_iterator hint, value_type const& 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> + void insert(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.iterator erase(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_type erase(key_type const& 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.iterator erase(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.void quick_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. + void erase_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. + void clear();Erases all elements in the container.Postconditions:size() == 0Throws:Never throws an exception.void swap(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.<anchor id="id-1.2.1.1.33-bb"/><computeroutput>unordered_map</computeroutput> observershasher hash_function() const;Returns:The container's hash function. + key_equal key_eq() const;Returns:The container's key equality predicate. + <anchor id="id-1.2.1.1.34-bb"/><computeroutput>unordered_map</computeroutput> lookupiterator find(key_type const& k); +const_iterator find(key_type const& k) const; +template<typename CompatibleKey, typename CompatibleHash, + typename CompatiblePredicate> + iterator find(CompatibleKey const& k, CompatibleHash const& hash, + CompatiblePredicate const& eq); +template<typename CompatibleKey, typename CompatibleHash, + typename CompatiblePredicate> + const_iterator + find(CompatibleKey const& k, CompatibleHash const& hash, + CompatiblePredicate const& 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_type count(key_type const& k) const;Returns:The number of elements with key equivalent to k.std::pair<iterator, iterator> equal_range(key_type const& k); +std::pair<const_iterator, const_iterator> equal_range(key_type const& 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_type const& 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_type const& k); +Mapped const& at(key_type const& 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++.<anchor id="id-1.2.1.1.35-bb"/><computeroutput>unordered_map</computeroutput> bucket interfacesize_type bucket_count() const;Returns:The number of buckets.size_type max_bucket_count() const;Returns:An upper bound on the number of buckets.size_type bucket_size(size_type n) const;Requires:n < bucket_count()Returns:The number of elements in bucket n.size_type bucket(key_type const& 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_iterator begin(size_type n); +const_local_iterator begin(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_iterator end(size_type n); +const_local_iterator end(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_iterator cbegin(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_iterator cend(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.<anchor id="id-1.2.1.1.36-bb"/><computeroutput>unordered_map</computeroutput> hash policyfloat load_factor() const;Returns:The average number of elements per bucket.float max_load_factor() const;Returns:Returns the current maximum load factor.void max_load_factor(float z);Effects:Changes the container's maximum load factor, using z as a hint.void rehash(size_type n);Changes the number of buckets so that there at least n buckets, and so that the load factor is less than the maximum load factor.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.<anchor id="id-1.2.1.1.37-bb"/><computeroutput>unordered_map</computeroutput> Equality Comparisonstemplate<typename Key, typename Mapped, typename Hash, typename Pred, + typename Alloc> + bool operator==(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> + bool operator!=(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.<anchor id="id-1.2.1.1.38-bb"/><computeroutput>unordered_map</computeroutput> swaptemplate<typename Key, typename Mapped, typename Hash, typename Pred, + typename Alloc> + void swap(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<Key const, Mapped> > > +class unordered_multimap { +public: + // types + typedef Key key_type; + typedef std::pair<Key const, Mapped> value_type; + typedef Mapped mapped_type; + typedef Hash hasher; + typedef Pred key_equal; + typedef Alloc allocator_type; + typedef typename allocator_type::pointer pointer; + typedef typename allocator_type::const_pointer const_pointer; + typedef typename allocator_type::reference reference; // lvalue of value_type. + typedef typename allocator_type::const_reference const_reference; // const lvalue of value_type. + typedef implementation-defined size_type; + typedef implementation-defined difference_type; + typedef implementation-defined iterator; + typedef implementation-defined const_iterator; + typedef implementation-defined local_iterator; + typedef implementation-defined const_local_iterator; + + // construct/copy/destruct + explicit unordered_multimap(size_type = implementation-defined, + hasher const& = hasher(), + key_equal const& = key_equal(), + allocator_type const& = allocator_type()); + template<typename InputIterator> + unordered_multimap(InputIterator, InputIterator, + size_type = implementation-defined, + hasher const& = hasher(), + key_equal const& = key_equal(), + allocator_type const& = allocator_type()); + unordered_multimap(unordered_multimap const&); + unordered_multimap(unordered_multimap &&); + explicit unordered_multimap(Allocator const&); + unordered_multimap(unordered_multimap const&, Allocator const&); + ~unordered_multimap(); + unordered_multimap& operator=(unordered_multimap const&); + unordered_multimap& operator=(unordered_multimap &&); + allocator_type get_allocator() const; + + // size and capacity + bool empty() const; + size_type size() const; + size_type max_size() const; + + // iterators + iterator begin(); + const_iterator begin() const; + iterator end(); + const_iterator end() const; + const_iterator cbegin() const; + const_iterator cend() const; + + // modifiers + template<typename... Args> iterator emplace(Args&&...); + template<typename... Args> iterator emplace_hint(const_iterator, Args&&...); + iterator insert(value_type const&); + iterator insert(const_iterator, value_type const&); + template<typename InputIterator> void insert(InputIterator, InputIterator); + iterator erase(const_iterator); + size_type erase(key_type const&); + iterator erase(const_iterator, const_iterator); + void quick_erase(const_iterator); + void erase_return_void(const_iterator); + void clear(); + void swap(unordered_multimap&); + + // observers + hasher hash_function() const; + key_equal key_eq() const; + + // lookup + iterator find(key_type const&); + const_iterator find(key_type const&) const; + template<typename CompatibleKey, typename CompatibleHash, + typename CompatiblePredicate> + iterator find(CompatibleKey const&, CompatibleHash const&, + CompatiblePredicate const&); + template<typename CompatibleKey, typename CompatibleHash, + typename CompatiblePredicate> + const_iterator + find(CompatibleKey const&, CompatibleHash const&, + CompatiblePredicate const&) const; + size_type count(key_type const&) const; + std::pair<iterator, iterator> equal_range(key_type const&); + std::pair<const_iterator, const_iterator> equal_range(key_type const&) const; + + // bucket interface + size_type bucket_count() const; + size_type max_bucket_count() const; + size_type bucket_size(size_type) const; + size_type bucket(key_type const&) const; + local_iterator begin(size_type); + const_local_iterator begin(size_type) const; + local_iterator end(size_type); + const_local_iterator end(size_type) const; + const_local_iterator cbegin(size_type) const; + const_local_iterator cend(size_type); + + // hash policy + float load_factor() const; + float max_load_factor() const; + void max_load_factor(float); + void rehash(size_type); +}; + +// Equality Comparisons +template<typename Key, typename Mapped, typename Hash, typename Pred, + typename Alloc> + bool operator==(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> + bool operator!=(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> + void swap(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. + <anchor id="boost.unordered_multimaptypes"/><computeroutput>unordered_multimap</computeroutput> + public + types +typedef implementation-defined size_type; + An unsigned integral type. + size_type can represent any non-negative value of difference_type. + +typedef implementation-defined difference_type; + A signed integral type. + Is identical to the difference type of iterator and const_iterator. + +typedef implementation-defined iterator; + A iterator whose value type is value_type. + The iterator category is at least a forward iterator. + Convertible to const_iterator. + +typedef implementation-defined const_iterator; + A constant iterator whose value type is value_type. + The iterator category is at least a forward iterator. + +typedef implementation-defined local_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. + +typedef implementation-defined const_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. + <anchor id="boost.unordered_multimapconstruct-copy-destruct"/><computeroutput>unordered_multimap</computeroutput> + public + construct/copy/destructexplicit unordered_multimap(size_type n = implementation-defined, + hasher const& hf = hasher(), + key_equal const& eq = key_equal(), + allocator_type const& 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, + hasher const& hf = hasher(), + key_equal const& eq = key_equal(), + allocator_type const& 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_multimap const&);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). + explicit unordered_multimap(Allocator const& a);Constructs an empty container, using allocator a.unordered_multimap(unordered_multimap const& x, Allocator const& 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_multimap const&);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_type get_allocator() const;<anchor id="id-1.2.1.2.30-bb"/><computeroutput>unordered_multimap</computeroutput> size and capacitybool empty() const;Returns:size() == 0size_type size() const;Returns:std::distance(begin(), end())size_type max_size() const;Returns:size() of the largest possible container. + <anchor id="id-1.2.1.2.31-bb"/><computeroutput>unordered_multimap</computeroutput> iteratorsiterator begin(); +const_iterator begin() 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. + iterator end(); +const_iterator end() const;Returns:An iterator which refers to the past-the-end value for the container. + const_iterator cbegin() 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_iterator cend() const;Returns:A constant iterator which refers to the past-the-end value for the container. + <anchor id="id-1.2.1.2.32-bb"/><computeroutput>unordered_multimap</computeroutput> modifierstemplate<typename... Args> iterator emplace(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> + iterator emplace_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.iterator insert(value_type const& 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.iterator insert(const_iterator hint, value_type const& 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> + void insert(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.iterator erase(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_type erase(key_type const& 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.iterator erase(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.void quick_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. + void erase_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. + void clear();Erases all elements in the container.Postconditions:size() == 0Throws:Never throws an exception.void swap(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.<anchor id="id-1.2.1.2.33-bb"/><computeroutput>unordered_multimap</computeroutput> observershasher hash_function() const;Returns:The container's hash function. + key_equal key_eq() const;Returns:The container's key equality predicate. + <anchor id="id-1.2.1.2.34-bb"/><computeroutput>unordered_multimap</computeroutput> lookupiterator find(key_type const& k); +const_iterator find(key_type const& k) const; +template<typename CompatibleKey, typename CompatibleHash, + typename CompatiblePredicate> + iterator find(CompatibleKey const& k, CompatibleHash const& hash, + CompatiblePredicate const& eq); +template<typename CompatibleKey, typename CompatibleHash, + typename CompatiblePredicate> + const_iterator + find(CompatibleKey const& k, CompatibleHash const& hash, + CompatiblePredicate const& 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_type count(key_type const& k) const;Returns:The number of elements with key equivalent to k.std::pair<iterator, iterator> equal_range(key_type const& k); +std::pair<const_iterator, const_iterator> equal_range(key_type const& 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()). + <anchor id="id-1.2.1.2.35-bb"/><computeroutput>unordered_multimap</computeroutput> bucket interfacesize_type bucket_count() const;Returns:The number of buckets.size_type max_bucket_count() const;Returns:An upper bound on the number of buckets.size_type bucket_size(size_type n) const;Requires:n < bucket_count()Returns:The number of elements in bucket n.size_type bucket(key_type const& 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_iterator begin(size_type n); +const_local_iterator begin(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_iterator end(size_type n); +const_local_iterator end(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_iterator cbegin(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_iterator cend(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.<anchor id="id-1.2.1.2.36-bb"/><computeroutput>unordered_multimap</computeroutput> hash policyfloat load_factor() const;Returns:The average number of elements per bucket.float max_load_factor() const;Returns:Returns the current maximum load factor.void max_load_factor(float z);Effects:Changes the container's maximum load factor, using z as a hint.void rehash(size_type n);Changes the number of buckets so that there at least n buckets, and so that the load factor is less than the maximum load factor.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.<anchor id="id-1.2.1.2.37-bb"/><computeroutput>unordered_multimap</computeroutput> Equality Comparisonstemplate<typename Key, typename Mapped, typename Hash, typename Pred, + typename Alloc> + bool operator==(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> + bool operator!=(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.<anchor id="id-1.2.1.2.38-bb"/><computeroutput>unordered_multimap</computeroutput> swaptemplate<typename Key, typename Mapped, typename Hash, typename Pred, + typename Alloc> + void swap(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 + +
Reference +
Header <<ulink url="../../boost/unordered_set.hpp">boost/unordered_set.hpp</ulink>>namespace thing { + class foo; +} + Class foo3thing::foo// In header: <boost/unordered_set.hpp> + + +class foo { +public: + void bar(int); + void operator()(int); +};Descriptionvoid bar(int);void operator()(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 <<ulink url="../../example.hpp">example.hpp</ulink>> + 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 + void main() {} + actions something ; + + + plain text + void main() {} + actions something ; + + \ No newline at end of file From ce2f9fd8ac8ac86236e37e63b53ab44ff5b79034 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 29 Oct 2017 12:45:11 +0000 Subject: [PATCH 06/10] Tweak some of the consistent ids in boostbook They use '.' as a separator which results in paths like 'as_fe_id-1/3/2/6/2/7/1/1/1.html'. --- test/more/tests/libs/array.gold2 | 148 ++-- test/more/tests/libs/hash-ref.gold2 | 324 ++++---- test/more/tests/libs/unordered-ref.gold2 | 972 +++++++++++------------ test/more/tests/ref/methodname.gold2 | 14 +- xsl/lookup.xsl | 17 +- 5 files changed, 744 insertions(+), 731 deletions(-) diff --git a/test/more/tests/libs/array.gold2 b/test/more/tests/libs/array.gold2 index 404f73b..0d0fb5e 100644 --- a/test/more/tests/libs/array.gold2 +++ b/test/more/tests/libs/array.gold2 @@ -65,15 +65,15 @@ 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. + 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. + front() and back() are provided. + operator[] and at() are provided. @@ -87,13 +87,13 @@ template<typename T, std::size_t N> bool operator!=(const array<T, N>&, const array<T, N>&); template<typename T, std::size_t N> - bool operator<(const array<T, N>&, const array<T, N>&); + bool operator<(const array<T, N>&, const array<T, N>&); template<typename T, std::size_t N> - bool operator>(const array<T, N>&, const array<T, N>&); + bool operator>(const array<T, N>&, const array<T, N>&); template<typename T, std::size_t N> - bool operator<=(const array<T, N>&, const array<T, N>&); + bool operator<=(const array<T, N>&, const array<T, N>&); template<typename T, std::size_t N> - bool operator>=(const array<T, N>&, const array<T, N>&); + bool operator>=(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> @@ -115,121 +115,121 @@ static const size_type static_size = N; // construct/copy/destruct - template<typename U> array& operator=(const array<U, N>&); + template<typename U> array& operator=(const array<U, N>&); - // iterator support - iterator begin(); - const_iterator begin() const; - iterator end(); - const_iterator end() const; + // iterator support + iterator begin(); + const_iterator begin() const; + iterator end(); + const_iterator end() const; - // reverse iterator support - reverse_iterator rbegin(); - const_reverse_iterator rbegin() const; - reverse_iterator rend(); - const_reverse_iterator rend() const; + // reverse iterator support + reverse_iterator rbegin(); + const_reverse_iterator rbegin() const; + reverse_iterator rend(); + const_reverse_iterator rend() const; - // capacity - size_type size(); - bool empty(); - size_type max_size(); + // capacity + size_type size(); + bool empty(); + size_type max_size(); - // element access - reference operator[](size_type); - const_reference operator[](size_type) const; - reference at(size_type); - const_reference at(size_type) const; - reference front(); - const_reference front() const; - reference back(); - const_reference back() const; - const T* data() const; - T* c_array(); + // element access + reference operator[](size_type); + const_reference operator[](size_type) const; + reference at(size_type); + const_reference at(size_type) const; + reference front(); + const_reference front() const; + reference back(); + const_reference back() const; + const T* data() const; + T* c_array(); - // modifiers - void swap(array<T, N>&); - void assign(const T&); + // modifiers + void swap(array<T, N>&); + void assign(const T&); // public data members T elems[N]; }; -// specialized algorithms +// specialized algorithms template<typename T, std::size_t N> void swap(array<T, N>&, array<T, N>&); -// comparisons +// comparisons template<typename T, std::size_t N> bool operator==(const array<T, N>&, const array<T, N>&); template<typename T, std::size_t N> bool operator!=(const array<T, N>&, const array<T, N>&); template<typename T, std::size_t N> - bool operator<(const array<T, N>&, const array<T, N>&); + bool operator<(const array<T, N>&, const array<T, N>&); template<typename T, std::size_t N> - bool operator>(const array<T, N>&, const array<T, N>&); + bool operator>(const array<T, N>&, const array<T, N>&); template<typename T, std::size_t N> - bool operator<=(const array<T, N>&, const array<T, N>&); + bool operator<=(const array<T, N>&, const array<T, N>&); template<typename T, std::size_t N> - bool operator>=(const array<T, N>&, const array<T, N>&);Description<anchor id="boost.arrayconstruct-copy-destruct"/><computeroutput>array</computeroutput> + <phrase role="keyword">bool</phrase> <link linkend="boost.array.operator_=_1_4_1_1_1_21_6"><phrase role="keyword">operator</phrase><phrase role="special">>=</phrase></link><phrase role="special">(</phrase><phrase role="keyword">const</phrase> <link linkend="boost.array">array</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="identifier">N</phrase><phrase role="special">></phrase><phrase role="special">&</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <link linkend="boost.array">array</link><phrase role="special"><</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="identifier">N</phrase><phrase role="special">></phrase><phrase role="special">&</phrase><phrase role="special">)</phrase><phrase role="special">;</phrase></synopsis></refsynopsisdiv><refsect1><title>Description<anchor id="boost.arrayconstruct-copy-destruct"/><computeroutput>array</computeroutput> public - construct/copy/destructtemplate<typename U> array& operator=(const array<U, N>& other);template<typename U> array& operator=(const array<U, N>& other);Effects:std::copy(rhs.begin(),rhs.end(), begin())<anchor id="id-1.4.1.1.1.14-bb"/><computeroutput>array</computeroutput> iterator supportiterator begin(); -const_iterator begin() const;Effects:std::copy(rhs.begin(),rhs.end(), begin())<anchor id="id-1_4_1_1_1_14-bb"/><computeroutput>array</computeroutput> iterator supportiterator begin(); +const_iterator begin() const;Returns:iterator for the first elementThrows:will not throwiterator end(); -const_iterator end() const;Returns:iterator for the first elementThrows:will not throwiterator end(); +const_iterator end() const;Returns:iterator for position after the last elementThrows:will not throw<anchor id="id-1.4.1.1.1.15-bb"/><computeroutput>array</computeroutput> reverse iterator supportreverse_iterator rbegin(); -const_reverse_iterator rbegin() const;Returns:iterator for position after the last elementThrows:will not throw<anchor id="id-1_4_1_1_1_15-bb"/><computeroutput>array</computeroutput> reverse iterator supportreverse_iterator rbegin(); +const_reverse_iterator rbegin() const;Returns:reverse iterator for the first element of reverse iterationreverse_iterator rend(); -const_reverse_iterator rend() const;Returns:reverse iterator for the first element of reverse iterationreverse_iterator rend(); +const_reverse_iterator rend() const;Returns:reverse iterator for position after the last element in reverse iteration<anchor id="id-1.4.1.1.1.16-bb"/><computeroutput>array</computeroutput> capacitysize_type size();Returns:reverse iterator for position after the last element in reverse iteration<anchor id="id-1_4_1_1_1_16-bb"/><computeroutput>array</computeroutput> capacitysize_type size();Returns:Nbool empty();Returns:Nbool empty();Returns:N==0Throws:will not throwsize_type max_size();Returns:N==0Throws:will not throwsize_type max_size();Returns:NThrows:will not throw<anchor id="id-1.4.1.1.1.17-bb"/><computeroutput>array</computeroutput> element accessreference operator[](size_type i); -const_reference operator[](size_type i) const;Returns:NThrows:will not throw<anchor id="id-1_4_1_1_1_17-bb"/><computeroutput>array</computeroutput> element accessreference operator[](size_type i); +const_reference operator[](size_type i) const;Requires:i < NReturns:element with index iThrows:will not throw.reference at(size_type i); -const_reference at(size_type i) const;Requires:i < NReturns:element with index iThrows:will not throw.reference at(size_type i); +const_reference at(size_type i) const;Returns:element with index iThrows:std::range_error if i >= Nreference front(); -const_reference front() const;Returns:element with index iThrows:std::range_error if i >= Nreference front(); +const_reference front() const;Requires:N > 0Returns:the first elementThrows:will not throwreference back(); -const_reference back() const;Requires:N > 0Returns:the first elementThrows:will not throwreference back(); +const_reference back() const;Requires:N > 0Returns:the last elementThrows:will not throwconst T* data() const;Requires:N > 0Returns:the last elementThrows:will not throwconst T* data() const;Returns:elemsThrows:will not throwT* c_array();Returns:elemsThrows:will not throwT* c_array();Returns:elemsThrows:will not throw<anchor id="id-1.4.1.1.1.18-bb"/><computeroutput>array</computeroutput> modifiersvoid swap(array<T, N>& other);Returns:elemsThrows:will not throw<anchor id="id-1_4_1_1_1_18-bb"/><computeroutput>array</computeroutput> modifiersvoid swap(array<T, N>& other);Effects:std::swap_ranges(begin(), end(), other.begin())Complexity:linear in Nvoid assign(const T& value);Effects:std::swap_ranges(begin(), end(), other.begin())Complexity:linear in Nvoid assign(const T& value);Effects:std::fill_n(begin(), N, value)<anchor id="id-1.4.1.1.1.20-bb"/><computeroutput>array</computeroutput> specialized algorithmstemplate<typename T, std::size_t N> void swap(array<T, N>& x, array<T, N>& y);Effects:std::fill_n(begin(), N, value)<anchor id="id-1_4_1_1_1_20-bb"/><computeroutput>array</computeroutput> specialized algorithmstemplate<typename T, std::size_t N> void swap(array<T, N>& x, array<T, N>& y);Effects:x.swap(y)Throws:will not throw.<anchor id="id-1.4.1.1.1.21-bb"/><computeroutput>array</computeroutput> comparisonstemplate<typename T, std::size_t N> + ?>Effects:x.swap(y)Throws:will not throw.<anchor id="id-1_4_1_1_1_21-bb"/><computeroutput>array</computeroutput> comparisonstemplate<typename T, std::size_t N> bool operator==(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> + ?>Returns:std::equal(x.begin(), x.end(), y.begin())template<typename T, std::size_t N> bool operator!=(const array<T, N>& x, const array<T, N>& y);Returns:!(x == y)template<typename T, std::size_t N> - bool operator<(const array<T, N>& x, const array<T, N>& y);bool operator<(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> - bool operator>(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> + bool operator>(const array<T, N>& x, const array<T, N>& y);Returns:y < xtemplate<typename T, std::size_t N> - bool operator<=(const array<T, N>& x, const array<T, N>& y);bool operator<=(const array<T, N>& x, const array<T, N>& y);Returns:!(y < x)template<typename T, std::size_t N> - bool operator>=(const array<T, N>& x, const array<T, N>& y);bool operator>=(const array<T, N>& x, const array<T, N>& y);Returns:!(x < y) diff --git a/test/more/tests/libs/hash-ref.gold2 b/test/more/tests/libs/hash-ref.gold2 index e3a08b4..cbd8e8f 100644 --- a/test/more/tests/libs/hash-ref.gold2 +++ b/test/more/tests/libs/hash-ref.gold2 @@ -13,74 +13,74 @@ namespace boost { template<typename T> struct hash; - template<> struct hash<bool>; - template<> struct hash<char>; - template<> struct hash<signed char>; - template<> struct hash<unsigned char>; - template<> struct hash<wchar_t>; - template<> struct hash<short>; - template<> struct hash<unsigned short>; - template<> struct hash<int>; - template<> struct hash<unsigned int>; - template<> struct hash<long>; - template<> struct hash<unsigned long>; - template<> struct hash<long long>; - template<> struct hash<unsigned long long>; - template<> struct hash<float>; - template<> struct hash<double>; - template<> struct hash<long double>; - template<> struct hash<std::string>; - template<> struct hash<std::wstring>; - template<typename T> struct hash<T*>; + template<> struct hash<bool>; + template<> struct hash<char>; + template<> struct hash<signed char>; + template<> struct hash<unsigned char>; + template<> struct hash<wchar_t>; + template<> struct hash<short>; + template<> struct hash<unsigned short>; + template<> struct hash<int>; + template<> struct hash<unsigned int>; + template<> struct hash<long>; + template<> struct hash<unsigned long>; + template<> struct hash<long long>; + template<> struct hash<unsigned long long>; + template<> struct hash<float>; + template<> struct hash<double>; + template<> struct hash<long double>; + template<> struct hash<std::string>; + template<> struct hash<std::wstring>; + template<typename T> struct hash<T*>; - // Support functions (Boost extension). + // Support functions (Boost extension). template<typename T> void hash_combine(size_t &, T const&); - template<typename It> std::size_t hash_range(It, It); - template<typename It> void hash_range(std::size_t&, It, It); + template<typename It> std::size_t hash_range(It, It); + template<typename It> void hash_range(std::size_t&, It, It); - // Overloadable hash implementation (Boost extension). - std::size_t hash_value(bool); - std::size_t hash_value(char); - std::size_t hash_value(signed char); - std::size_t hash_value(unsigned char); - std::size_t hash_value(wchar_t); - std::size_t hash_value(short); - std::size_t hash_value(unsigned short); - std::size_t hash_value(int); - std::size_t hash_value(unsigned int); - std::size_t hash_value(long); - std::size_t hash_value(unsigned long); - std::size_t hash_value(long long); - std::size_t hash_value(unsigned long long); - std::size_t hash_value(float); - std::size_t hash_value(double); - std::size_t hash_value(long double); - template<typename T> std::size_t hash_value(T* const&); - template<typename T, unsigned N> std::size_t hash_value(T (&val)[N]); - template<typename T, unsigned N> std::size_t hash_value(const T (&val)[N]); + // Overloadable hash implementation (Boost extension). + std::size_t hash_value(bool); + std::size_t hash_value(char); + std::size_t hash_value(signed char); + std::size_t hash_value(unsigned char); + std::size_t hash_value(wchar_t); + std::size_t hash_value(short); + std::size_t hash_value(unsigned short); + std::size_t hash_value(int); + std::size_t hash_value(unsigned int); + std::size_t hash_value(long); + std::size_t hash_value(unsigned long); + std::size_t hash_value(long long); + std::size_t hash_value(unsigned long long); + std::size_t hash_value(float); + std::size_t hash_value(double); + std::size_t hash_value(long double); + template<typename T> std::size_t hash_value(T* const&); + template<typename T, unsigned N> std::size_t hash_value(T (&val)[N]); + template<typename T, unsigned N> std::size_t hash_value(const T (&val)[N]); template<typename Ch, typename A> - std::size_t hash_value(std::basic_string<Ch, std::char_traits<Ch>, A> const&); + std::size_t hash_value(std::basic_string<Ch, std::char_traits<Ch>, A> const&); template<typename A, typename B> - std::size_t hash_value(std::pair<A, B> const&); + std::size_t hash_value(std::pair<A, B> const&); template<typename T, typename A> - std::size_t hash_value(std::vector<T, A> const&); + std::size_t hash_value(std::vector<T, A> const&); template<typename T, typename A> - std::size_t hash_value(std::list<T, A> const&); + std::size_t hash_value(std::list<T, A> const&); template<typename T, typename A> - std::size_t hash_value(std::deque<T, A> const&); + std::size_t hash_value(std::deque<T, A> const&); template<typename K, typename C, typename A> - std::size_t hash_value(std::set<K, C, A> const&); + std::size_t hash_value(std::set<K, C, A> const&); template<typename K, typename C, typename A> - std::size_t hash_value(std::multiset<K, C, A> const&); + std::size_t hash_value(std::multiset<K, C, A> const&); template<typename K, typename T, typename C, typename A> - std::size_t hash_value(std::map<K, T, C, A> const&); + std::size_t hash_value(std::map<K, T, C, A> const&); template<typename K, typename T, typename C, typename A> - std::size_t hash_value(std::multimap<K, T, C, A> const&); - template<typename T> std::size_t hash_value(std::complex<T> const&); + std::size_t hash_value(std::multimap<K, T, C, A> const&); + template<typename T> std::size_t hash_value(std::complex<T> const&); } - <anchor id="id-1.2.2.21-bb"/><computeroutput/> Support functions (Boost extension).template<typename T> void hash_combine(size_t & seed, T const& v); + <anchor id="id-1_2_2_21-bb"/><computeroutput/> Support functions (Boost extension).template<typename T> void hash_combine(size_t & seed, T const& v); Called repeatedly to incrementally create a hash value from several variables. hash_value(T) throws. Strong exception safety, as long as hash_value(T) also has strong exception safety. - template<typename It> std::size_t hash_range(It first, It last); -template<typename It> void hash_range(std::size_t& seed, It first, It last); + template<typename It> std::size_t hash_range(It first, It last); +template<typename It> void hash_range(std::size_t& seed, It first, It last); Calculate the combined hash value of the elements of an iterator range. 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. - <anchor id="id-1.2.2.22-bb"/><computeroutput/> Overloadable hash implementation (Boost extension).std::size_t hash_value(bool val); -std::size_t hash_value(char val); -std::size_t hash_value(signed char val); -std::size_t hash_value(unsigned char val); -std::size_t hash_value(wchar_t val); -std::size_t hash_value(short val); -std::size_t hash_value(unsigned short val); -std::size_t hash_value(int val); -std::size_t hash_value(unsigned int val); -std::size_t hash_value(long val); -std::size_t hash_value(unsigned long val); -std::size_t hash_value(long long val); -std::size_t hash_value(unsigned long long val); -std::size_t hash_value(float val); -std::size_t hash_value(double val); -std::size_t hash_value(long double val); -template<typename T> std::size_t hash_value(T* const& val); -template<typename T, unsigned N> std::size_t hash_value(T (&val)[N]); -template<typename T, unsigned N> std::size_t hash_value(const T (&val)[N]); + <anchor id="id-1_2_2_22-bb"/><computeroutput/> Overloadable hash implementation (Boost extension).std::size_t hash_value(bool val); +std::size_t hash_value(char val); +std::size_t hash_value(signed char val); +std::size_t hash_value(unsigned char val); +std::size_t hash_value(wchar_t val); +std::size_t hash_value(short val); +std::size_t hash_value(unsigned short val); +std::size_t hash_value(int val); +std::size_t hash_value(unsigned int val); +std::size_t hash_value(long val); +std::size_t hash_value(unsigned long val); +std::size_t hash_value(long long val); +std::size_t hash_value(unsigned long long val); +std::size_t hash_value(float val); +std::size_t hash_value(double val); +std::size_t hash_value(long double val); +template<typename T> std::size_t hash_value(T* const& val); +template<typename T, unsigned N> std::size_t hash_value(T (&val)[N]); +template<typename T, unsigned N> std::size_t hash_value(const T (&val)[N]); template<typename Ch, typename A> - std::size_t hash_value(std::basic_string<Ch, std::char_traits<Ch>, A> const& val); + std::size_t hash_value(std::basic_string<Ch, std::char_traits<Ch>, A> const& val); template<typename A, typename B> - std::size_t hash_value(std::pair<A, B> const& val); + std::size_t hash_value(std::pair<A, B> const& val); template<typename T, typename A> - std::size_t hash_value(std::vector<T, A> const& val); + std::size_t hash_value(std::vector<T, A> const& val); template<typename T, typename A> - std::size_t hash_value(std::list<T, A> const& val); + std::size_t hash_value(std::list<T, A> const& val); template<typename T, typename A> - std::size_t hash_value(std::deque<T, A> const& val); + std::size_t hash_value(std::deque<T, A> const& val); template<typename K, typename C, typename A> - std::size_t hash_value(std::set<K, C, A> const& val); + std::size_t hash_value(std::set<K, C, A> const& val); template<typename K, typename C, typename A> - std::size_t hash_value(std::multiset<K, C, A> const& val); + std::size_t hash_value(std::multiset<K, C, A> const& val); template<typename K, typename T, typename C, typename A> - std::size_t hash_value(std::map<K, T, C, A> const& val); + std::size_t hash_value(std::map<K, T, C, A> const& val); template<typename K, typename T, typename C, typename A> - std::size_t hash_value(std::multimap<K, T, C, A> const& val); -template<typename T> std::size_t hash_value(std::complex<T> const& val); + std::size_t hash_value(std::multimap<K, T, C, A> const& val); +template<typename T> std::size_t hash_value(std::complex<T> const& val); Implementation of the hash function. Generally shouldn't be called directly by users, instead they should use @@ -243,8 +243,8 @@ template<typename T> struct hash : public std::unary_function<T, std::size_t> { - std::size_t operator()(T const&) const; -};Descriptionstd::size_t operator()(T const& val) const;std::size_t operator()(T const&) const; +};Descriptionstd::size_t operator()(T const& val) const;Returns: hash_value(val) @@ -259,138 +259,138 @@ Throws: Only throws if hash_value(T) throws. - Struct hash<bool>3boost::hash<bool>// In header: <boost/functional/hash.hpp> + Struct hash<bool>3boost::hash<bool>// In header: <boost/functional/hash.hpp> -struct hash<bool> { - std::size_t operator()(bool) const; -};Descriptionstd::size_t operator()(bool val) const;struct hash<bool> { + std::size_t operator()(bool) const; +};Descriptionstd::size_t operator()(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> + ?>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_t operator()(char) const; -};Descriptionstd::size_t operator()(char val) const;struct hash<char> { + std::size_t operator()(char) const; +};Descriptionstd::size_t operator()(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> + ?>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<signed char> { - std::size_t operator()(signed char) const; -};Descriptionstd::size_t operator()(signed char val) const;struct hash<signed char> { + std::size_t operator()(signed char) const; +};Descriptionstd::size_t operator()(signed 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<unsigned char>3boost::hash<unsigned char>// In header: <boost/functional/hash.hpp> + ?>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<unsigned char> { - std::size_t operator()(unsigned char) const; -};Descriptionstd::size_t operator()(unsigned char val) const;struct hash<unsigned char> { + std::size_t operator()(unsigned char) const; +};Descriptionstd::size_t operator()(unsigned 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<wchar_t>3boost::hash<wchar_t>// In header: <boost/functional/hash.hpp> + ?>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_t operator()(wchar_t) const; -};Descriptionstd::size_t operator()(wchar_t val) const;struct hash<wchar_t> { + std::size_t operator()(wchar_t) const; +};Descriptionstd::size_t operator()(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> + ?>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_t operator()(short) const; -};Descriptionstd::size_t operator()(short val) const;struct hash<short> { + std::size_t operator()(short) const; +};Descriptionstd::size_t operator()(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> + ?>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<unsigned short> { - std::size_t operator()(unsigned short) const; -};Descriptionstd::size_t operator()(unsigned short val) const;struct hash<unsigned short> { + std::size_t operator()(unsigned short) const; +};Descriptionstd::size_t operator()(unsigned 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<int>3boost::hash<int>// In header: <boost/functional/hash.hpp> + ?>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_t operator()(int) const; -};Descriptionstd::size_t operator()(int val) const;struct hash<int> { + std::size_t operator()(int) const; +};Descriptionstd::size_t operator()(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> + ?>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<unsigned int> { - std::size_t operator()(unsigned int) const; -};Descriptionstd::size_t operator()(unsigned int val) const;struct hash<unsigned int> { + std::size_t operator()(unsigned int) const; +};Descriptionstd::size_t operator()(unsigned 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<long>3boost::hash<long>// In header: <boost/functional/hash.hpp> + ?>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_t operator()(long) const; -};Descriptionstd::size_t operator()(long val) const;struct hash<long> { + std::size_t operator()(long) const; +};Descriptionstd::size_t operator()(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> + ?>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<unsigned long> { - std::size_t operator()(unsigned long) const; -};Descriptionstd::size_t operator()(unsigned long val) const;struct hash<unsigned long> { + std::size_t operator()(unsigned long) const; +};Descriptionstd::size_t operator()(unsigned 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<long long>3boost::hash<long long>// In header: <boost/functional/hash.hpp> + ?>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<long long> { - std::size_t operator()(long long) const; -};Descriptionstd::size_t operator()(long long val) const;struct hash<long long> { + std::size_t operator()(long long) const; +};Descriptionstd::size_t operator()(long 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 long>3boost::hash<unsigned long long>// In header: <boost/functional/hash.hpp> + ?>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<unsigned long long> { - std::size_t operator()(unsigned long long) const; -};Descriptionstd::size_t operator()(unsigned long long val) const;struct hash<unsigned long long> { + std::size_t operator()(unsigned long long) const; +};Descriptionstd::size_t operator()(unsigned long 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<float>3boost::hash<float>// In header: <boost/functional/hash.hpp> + ?>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_t operator()(float) const; -};Descriptionstd::size_t operator()(float val) const;struct hash<float> { + std::size_t operator()(float) const; +};Descriptionstd::size_t operator()(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> + ?>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_t operator()(double) const; -};Descriptionstd::size_t operator()(double val) const;struct hash<double> { + std::size_t operator()(double) const; +};Descriptionstd::size_t operator()(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> + ?>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<long double> { - std::size_t operator()(long double) const; -};Descriptionstd::size_t operator()(long double val) const;struct hash<long double> { + std::size_t operator()(long double) const; +};Descriptionstd::size_t operator()(long 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<std::string>3boost::hash<std::string>// In header: <boost/functional/hash.hpp> + ?>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_t operator()(std::string const&) const; -};Descriptionstd::size_t operator()(std::string const& val) const;struct hash<std::string> { + std::size_t operator()(std::string const&) const; +};Descriptionstd::size_t operator()(std::string const& 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> + ?>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_t operator()(std::wstring const&) const; -};Descriptionstd::size_t operator()(std::wstring const& val) const;struct hash<std::wstring> { + std::size_t operator()(std::wstring const&) const; +};Descriptionstd::size_t operator()(std::wstring const& 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> + ?>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_t operator()(T*) const; -};Descriptionstd::size_t operator()(T* val) const;struct hash<T*> { + std::size_t operator()(T*) const; +};Descriptionstd::size_t operator()(T* val) const;Returns:Unspecified in TR1, except that equal arguments yield the same result.Throws:Doesn't throw diff --git a/test/more/tests/libs/unordered-ref.gold2 b/test/more/tests/libs/unordered-ref.gold2 index 0a501a2..72967eb 100644 --- a/test/more/tests/libs/unordered-ref.gold2 +++ b/test/more/tests/libs/unordered-ref.gold2 @@ -55,91 +55,91 @@ typedef implementation-defined const_local_iterator; // construct/copy/destruct - explicit unordered_set(size_type = implementation-defined, + explicit unordered_set(size_type = implementation-defined, hasher const& = hasher(), key_equal const& = key_equal(), allocator_type const& = allocator_type()); template<typename InputIterator> - unordered_set(InputIterator, InputIterator, + unordered_set(InputIterator, InputIterator, size_type = implementation-defined, hasher const& = hasher(), key_equal const& = key_equal(), allocator_type const& = allocator_type()); - unordered_set(unordered_set const&); - unordered_set(unordered_set &&); - explicit unordered_set(Allocator const&); - unordered_set(unordered_set const&, Allocator const&); - ~unordered_set(); - unordered_set& operator=(unordered_set const&); - unordered_set& operator=(unordered_set &&); - allocator_type get_allocator() const; + unordered_set(unordered_set const&); + unordered_set(unordered_set &&); + explicit unordered_set(Allocator const&); + unordered_set(unordered_set const&, Allocator const&); + ~unordered_set(); + unordered_set& operator=(unordered_set const&); + unordered_set& operator=(unordered_set &&); + allocator_type get_allocator() const; - // size and capacity - bool empty() const; - size_type size() const; - size_type max_size() const; + // size and capacity + bool empty() const; + size_type size() const; + size_type max_size() const; - // iterators - iterator begin(); - const_iterator begin() const; - iterator end(); - const_iterator end() const; - const_iterator cbegin() const; - const_iterator cend() const; + // iterators + iterator begin(); + const_iterator begin() const; + iterator end(); + const_iterator end() const; + const_iterator cbegin() const; + const_iterator cend() const; - // modifiers - template<typename... Args> std::pair<iterator, bool> emplace(Args&&...); - template<typename... Args> iterator emplace_hint(const_iterator, Args&&...); - std::pair<iterator, bool> insert(value_type const&); - iterator insert(const_iterator, value_type const&); - template<typename InputIterator> void insert(InputIterator, InputIterator); - iterator erase(const_iterator); - size_type erase(key_type const&); - iterator erase(const_iterator, const_iterator); - void quick_erase(const_iterator); - void erase_return_void(const_iterator); - void clear(); - void swap(unordered_set&); + // modifiers + template<typename... Args> std::pair<iterator, bool> emplace(Args&&...); + template<typename... Args> iterator emplace_hint(const_iterator, Args&&...); + std::pair<iterator, bool> insert(value_type const&); + iterator insert(const_iterator, value_type const&); + template<typename InputIterator> void insert(InputIterator, InputIterator); + iterator erase(const_iterator); + size_type erase(key_type const&); + iterator erase(const_iterator, const_iterator); + void quick_erase(const_iterator); + void erase_return_void(const_iterator); + void clear(); + void swap(unordered_set&); - // observers - hasher hash_function() const; - key_equal key_eq() const; + // observers + hasher hash_function() const; + key_equal key_eq() const; - // lookup - iterator find(key_type const&); - const_iterator find(key_type const&) const; + // lookup + iterator find(key_type const&); + const_iterator find(key_type const&) const; template<typename CompatibleKey, typename CompatibleHash, typename CompatiblePredicate> - iterator find(CompatibleKey const&, CompatibleHash const&, + iterator find(CompatibleKey const&, CompatibleHash const&, CompatiblePredicate const&); template<typename CompatibleKey, typename CompatibleHash, typename CompatiblePredicate> const_iterator - find(CompatibleKey const&, CompatibleHash const&, + find(CompatibleKey const&, CompatibleHash const&, CompatiblePredicate const&) const; - size_type count(key_type const&) const; - std::pair<iterator, iterator> equal_range(key_type const&); - std::pair<const_iterator, const_iterator> equal_range(key_type const&) const; + size_type count(key_type const&) const; + std::pair<iterator, iterator> equal_range(key_type const&); + std::pair<const_iterator, const_iterator> equal_range(key_type const&) const; - // bucket interface - size_type bucket_count() const; - size_type max_bucket_count() const; - size_type bucket_size(size_type) const; - size_type bucket(key_type const&) const; - local_iterator begin(size_type); - const_local_iterator begin(size_type) const; - local_iterator end(size_type); - const_local_iterator end(size_type) const; - const_local_iterator cbegin(size_type) const; - const_local_iterator cend(size_type); + // bucket interface + size_type bucket_count() const; + size_type max_bucket_count() const; + size_type bucket_size(size_type) const; + size_type bucket(key_type const&) const; + local_iterator begin(size_type); + const_local_iterator begin(size_type) const; + local_iterator end(size_type); + const_local_iterator end(size_type) const; + const_local_iterator cbegin(size_type) const; + const_local_iterator cend(size_type); - // hash policy - float load_factor() const; - float max_load_factor() const; - void max_load_factor(float); - void rehash(size_type); + // hash policy + float load_factor() const; + float max_load_factor() const; + void max_load_factor(float); + void rehash(size_type); }; -// Equality Comparisons +// Equality Comparisons template<typename Value, typename Hash, typename Pred, typename Alloc> bool operator==(unordered_set<Value, Hash, Pred, Alloc> const&, unordered_set<Value, Hash, Pred, Alloc> const&); @@ -147,7 +147,7 @@ bool operator!=(unordered_set<Value, Hash, Pred, Alloc> const&, unordered_set<Value, Hash, Pred, Alloc> const&); -// swap +// swap template<typename Value, typename Hash, typename Pred, typename Alloc> void swap(unordered_set<Value, Hash, Pred, Alloc>&, unordered_set<Value, Hash, Pred, Alloc>&);Description @@ -204,32 +204,32 @@ A const_local_iterator object can be used to iterate through a single bucket. <anchor id="boost.unordered_setconstruct-copy-destruct"/><computeroutput>unordered_set</computeroutput> public - construct/copy/destructexplicit unordered_set(size_type n = implementation-defined, + construct/copy/destructexplicit unordered_set(size_type n = implementation-defined, hasher const& hf = hasher(), key_equal const& eq = key_equal(), allocator_type const& 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, + ?>Postconditions:size() == 0template<typename InputIterator> + unordered_set(InputIterator f, InputIterator l, size_type n = implementation-defined, hasher const& hf = hasher(), key_equal const& eq = key_equal(), - allocator_type const& 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_set const&);The copy constructor. Copies the contained elements, hash function, predicate, maximum load factor and allocator.allocator_type const& 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_set const&);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.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). - explicit unordered_set(Allocator const& a);Constructs an empty container, using allocator a.unordered_set(unordered_set const& x, Allocator const& a);Constructs an container, copying x's contained elements, hash function, predicate, maximum load factor, but using allocator a.~unordered_set();explicit unordered_set(Allocator const& a);Constructs an empty container, using allocator a.unordered_set(unordered_set const& x, Allocator const& 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_set const&);The assignment operator. Copies the contained elements, hash function, predicate and maximum load factor but not the allocator.Notes:The destructor is applied to every element, and all memory is deallocatedunordered_set& operator=(unordered_set const&);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.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 @@ -238,92 +238,92 @@ Requires: value_type is move constructible. (TODO: This is not actually required in this implementation). - allocator_type get_allocator() const;<anchor id="id-1.1.1.1.29-bb"/><computeroutput>unordered_set</computeroutput> size and capacitybool empty() const;allocator_type get_allocator() const;<anchor id="id-1_1_1_1_29-bb"/><computeroutput>unordered_set</computeroutput> size and capacitybool empty() const;Returns:size() == 0size_type size() const;Returns:size() == 0size_type size() const;Returns:std::distance(begin(), end())size_type max_size() const;Returns:std::distance(begin(), end())size_type max_size() const;Returns:size() of the largest possible container. - <anchor id="id-1.1.1.1.30-bb"/><computeroutput>unordered_set</computeroutput> iteratorsiterator begin(); -const_iterator begin() const;Returns:size() of the largest possible container. + <anchor id="id-1_1_1_1_30-bb"/><computeroutput>unordered_set</computeroutput> iteratorsiterator begin(); +const_iterator begin() 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. - iterator end(); -const_iterator end() const;iterator end(); +const_iterator end() const;Returns:An iterator which refers to the past-the-end value for the container. - const_iterator cbegin() const;const_iterator cbegin() 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_iterator cend() const;const_iterator cend() const;Returns:A constant iterator which refers to the past-the-end value for the container. - <anchor id="id-1.1.1.1.31-bb"/><computeroutput>unordered_set</computeroutput> 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.<anchor id="id-1_1_1_1_31-bb"/><computeroutput>unordered_set</computeroutput> 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> - iterator emplace_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.iterator emplace_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_type const& obj);Inserts obj in the container if and only if there is no element in the container with an equivalent value.std::pair<iterator, bool> insert(value_type const& 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.iterator insert(const_iterator hint, value_type const& 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: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.iterator insert(const_iterator hint, value_type const& 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> - void insert(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.void insert(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.iterator erase(const_iterator position);Erase the element pointed to by position.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.iterator erase(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 + The method quick_erase is faster, but has yet to be standardized. - size_type erase(key_type const& k);Erase all elements with key equivalent to k.size_type erase(key_type const& 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.iterator erase(const_iterator first, const_iterator last);Erases the elements in the range from first to last.Returns:The number of elements erased.Throws:Only throws an exception if it is thrown by hasher or key_equal.iterator erase(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.void quick_erase(const_iterator position);Erase the element pointed to by position.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.void quick_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 + 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. - void erase_return_void(const_iterator position);Erase the element pointed to by position.void erase_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. - void clear();Erases all elements in the container.void clear();Erases all elements in the container.Postconditions:size() == 0Throws:Never throws an exception.void swap(unordered_set&);Postconditions:size() == 0Throws:Never throws an exception.void swap(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.<anchor id="id-1.1.1.1.32-bb"/><computeroutput>unordered_set</computeroutput> observershasher hash_function() const;the implementation details.<anchor id="id-1_1_1_1_32-bb"/><computeroutput>unordered_set</computeroutput> observershasher hash_function() const;Returns:The container's hash function. - key_equal key_eq() const;key_equal key_eq() const;Returns:The container's key equality predicate. - <anchor id="id-1.1.1.1.33-bb"/><computeroutput>unordered_set</computeroutput> lookupiterator find(key_type const& k); -const_iterator find(key_type const& k) const; + <anchor id="id-1_1_1_1_33-bb"/><computeroutput>unordered_set</computeroutput> lookupiterator find(key_type const& k); +const_iterator find(key_type const& k) const; template<typename CompatibleKey, typename CompatibleHash, typename CompatiblePredicate> - iterator find(CompatibleKey const& k, CompatibleHash const& hash, + iterator find(CompatibleKey const& k, CompatibleHash const& hash, CompatiblePredicate const& eq); template<typename CompatibleKey, typename CompatibleHash, typename CompatiblePredicate> const_iterator - find(CompatibleKey const& k, CompatibleHash const& hash, + find(CompatibleKey const& k, CompatibleHash const& hash, CompatiblePredicate const& eq) const;Returns:An iterator pointing to an element with key equivalent to k, or b.end() if no such element exists.Notes: @@ -331,41 +331,41 @@ 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_type count(key_type const& k) const;size_type count(key_type const& k) const;Returns:The number of elements with key equivalent to k.std::pair<iterator, iterator> equal_range(key_type const& k); -std::pair<const_iterator, const_iterator> equal_range(key_type const& k) const;Returns:The number of elements with key equivalent to k.std::pair<iterator, iterator> equal_range(key_type const& k); +std::pair<const_iterator, const_iterator> equal_range(key_type const& 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()). - <anchor id="id-1.1.1.1.34-bb"/><computeroutput>unordered_set</computeroutput> bucket interfacesize_type bucket_count() const;<anchor id="id-1_1_1_1_34-bb"/><computeroutput>unordered_set</computeroutput> bucket interfacesize_type bucket_count() const;Returns:The number of buckets.size_type max_bucket_count() const;Returns:The number of buckets.size_type max_bucket_count() const;Returns:An upper bound on the number of buckets.size_type bucket_size(size_type n) const;Returns:An upper bound on the number of buckets.size_type bucket_size(size_type n) const;Requires:n < bucket_count()Returns:The number of elements in bucket n.size_type bucket(key_type const& k) const;Requires:n < bucket_count()Returns:The number of elements in bucket n.size_type bucket(key_type const& 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_iterator begin(size_type n); -const_local_iterator begin(size_type n) 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_iterator begin(size_type n); +const_local_iterator begin(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_iterator end(size_type n); -const_local_iterator end(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_iterator end(size_type n); +const_local_iterator end(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_iterator cbegin(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_iterator cbegin(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_iterator cend(size_type n);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_iterator cend(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.<anchor id="id-1.1.1.1.35-bb"/><computeroutput>unordered_set</computeroutput> hash policyfloat load_factor() const;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.<anchor id="id-1_1_1_1_35-bb"/><computeroutput>unordered_set</computeroutput> hash policyfloat load_factor() const;Returns:The average number of elements per bucket.float max_load_factor() const;Returns:The average number of elements per bucket.float max_load_factor() const;Returns:Returns the current maximum load factor.void max_load_factor(float z);Returns:Returns the current maximum load factor.void max_load_factor(float z);Effects:Changes the container's maximum load factor, using z as a hint.void rehash(size_type n);Changes the number of buckets so that there at least n buckets, and so that the load factor is less than the maximum load factor.Invalidates iterators, and changes the order of elements. Pointers and references to elements are not invalidated.Effects:Changes the container's maximum load factor, using z as a hint.void rehash(size_type n);Changes the number of buckets so that there at least n buckets, and so that the load factor is less than the maximum load factor.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.<anchor id="id-1.1.1.1.36-bb"/><computeroutput>unordered_set</computeroutput> Equality Comparisonstemplate<typename Value, typename Hash, typename Pred, typename Alloc> + ?>Throws:The function has no effect if an exception is thrown, unless it is thrown by the container's hash function or comparison function.<anchor id="id-1_1_1_1_36-bb"/><computeroutput>unordered_set</computeroutput> Equality Comparisonstemplate<typename Value, typename Hash, typename Pred, typename Alloc> bool operator==(unordered_set<Value, Hash, Pred, Alloc> const& x, unordered_set<Value, Hash, Pred, Alloc> const& y);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.<anchor id="id-1.1.1.1.37-bb"/><computeroutput>unordered_set</computeroutput> swaptemplate<typename Value, typename Hash, typename Pred, typename Alloc> + equivalent equality predicates.<anchor id="id-1_1_1_1_37-bb"/><computeroutput>unordered_set</computeroutput> swaptemplate<typename Value, typename Hash, typename Pred, typename Alloc> void swap(unordered_set<Value, Hash, Pred, Alloc>& x, unordered_set<Value, Hash, Pred, Alloc>& y);typedef implementation-defined const_local_iterator; // construct/copy/destruct - explicit unordered_multiset(size_type = implementation-defined, + explicit unordered_multiset(size_type = implementation-defined, hasher const& = hasher(), key_equal const& = key_equal(), allocator_type const& = allocator_type()); template<typename InputIterator> - unordered_multiset(InputIterator, InputIterator, + unordered_multiset(InputIterator, InputIterator, size_type = implementation-defined, hasher const& = hasher(), key_equal const& = key_equal(), allocator_type const& = allocator_type()); - unordered_multiset(unordered_multiset const&); - unordered_multiset(unordered_multiset &&); - explicit unordered_multiset(Allocator const&); - unordered_multiset(unordered_multiset const&, Allocator const&); - ~unordered_multiset(); - unordered_multiset& operator=(unordered_multiset const&); - unordered_multiset& operator=(unordered_multiset &&); - allocator_type get_allocator() const; + unordered_multiset(unordered_multiset const&); + unordered_multiset(unordered_multiset &&); + explicit unordered_multiset(Allocator const&); + unordered_multiset(unordered_multiset const&, Allocator const&); + ~unordered_multiset(); + unordered_multiset& operator=(unordered_multiset const&); + unordered_multiset& operator=(unordered_multiset &&); + allocator_type get_allocator() const; - // size and capacity - bool empty() const; - size_type size() const; - size_type max_size() const; + // size and capacity + bool empty() const; + size_type size() const; + size_type max_size() const; - // iterators - iterator begin(); - const_iterator begin() const; - iterator end(); - const_iterator end() const; - const_iterator cbegin() const; - const_iterator cend() const; + // iterators + iterator begin(); + const_iterator begin() const; + iterator end(); + const_iterator end() const; + const_iterator cbegin() const; + const_iterator cend() const; - // modifiers - template<typename... Args> iterator emplace(Args&&...); - template<typename... Args> iterator emplace_hint(const_iterator, Args&&...); - iterator insert(value_type const&); - iterator insert(const_iterator, value_type const&); - template<typename InputIterator> void insert(InputIterator, InputIterator); - iterator erase(const_iterator); - size_type erase(key_type const&); - iterator erase(const_iterator, const_iterator); - void quick_erase(const_iterator); - void erase_return_void(const_iterator); - void clear(); - void swap(unordered_multiset&); + // modifiers + template<typename... Args> iterator emplace(Args&&...); + template<typename... Args> iterator emplace_hint(const_iterator, Args&&...); + iterator insert(value_type const&); + iterator insert(const_iterator, value_type const&); + template<typename InputIterator> void insert(InputIterator, InputIterator); + iterator erase(const_iterator); + size_type erase(key_type const&); + iterator erase(const_iterator, const_iterator); + void quick_erase(const_iterator); + void erase_return_void(const_iterator); + void clear(); + void swap(unordered_multiset&); - // observers - hasher hash_function() const; - key_equal key_eq() const; + // observers + hasher hash_function() const; + key_equal key_eq() const; - // lookup - iterator find(key_type const&); - const_iterator find(key_type const&) const; + // lookup + iterator find(key_type const&); + const_iterator find(key_type const&) const; template<typename CompatibleKey, typename CompatibleHash, typename CompatiblePredicate> - iterator find(CompatibleKey const&, CompatibleHash const&, + iterator find(CompatibleKey const&, CompatibleHash const&, CompatiblePredicate const&); template<typename CompatibleKey, typename CompatibleHash, typename CompatiblePredicate> const_iterator - find(CompatibleKey const&, CompatibleHash const&, + find(CompatibleKey const&, CompatibleHash const&, CompatiblePredicate const&) const; - size_type count(key_type const&) const; - std::pair<iterator, iterator> equal_range(key_type const&); - std::pair<const_iterator, const_iterator> equal_range(key_type const&) const; + size_type count(key_type const&) const; + std::pair<iterator, iterator> equal_range(key_type const&); + std::pair<const_iterator, const_iterator> equal_range(key_type const&) const; - // bucket interface - size_type bucket_count() const; - size_type max_bucket_count() const; - size_type bucket_size(size_type) const; - size_type bucket(key_type const&) const; - local_iterator begin(size_type); - const_local_iterator begin(size_type) const; - local_iterator end(size_type); - const_local_iterator end(size_type) const; - const_local_iterator cbegin(size_type) const; - const_local_iterator cend(size_type); + // bucket interface + size_type bucket_count() const; + size_type max_bucket_count() const; + size_type bucket_size(size_type) const; + size_type bucket(key_type const&) const; + local_iterator begin(size_type); + const_local_iterator begin(size_type) const; + local_iterator end(size_type); + const_local_iterator end(size_type) const; + const_local_iterator cbegin(size_type) const; + const_local_iterator cend(size_type); - // hash policy - float load_factor() const; - float max_load_factor() const; - void max_load_factor(float); - void rehash(size_type); + // hash policy + float load_factor() const; + float max_load_factor() const; + void max_load_factor(float); + void rehash(size_type); }; -// Equality Comparisons +// Equality Comparisons template<typename Value, typename Hash, typename Pred, typename Alloc> bool operator==(unordered_multiset<Value, Hash, Pred, Alloc> const&, unordered_multiset<Value, Hash, Pred, Alloc> const&); @@ -500,7 +500,7 @@ bool operator!=(unordered_multiset<Value, Hash, Pred, Alloc> const&, unordered_multiset<Value, Hash, Pred, Alloc> const&); -// swap +// swap template<typename Value, typename Hash, typename Pred, typename Alloc> void swap(unordered_multiset<Value, Hash, Pred, Alloc>&, unordered_multiset<Value, Hash, Pred, Alloc>&);Description @@ -557,32 +557,32 @@ A const_local_iterator object can be used to iterate through a single bucket. <anchor id="boost.unordered_multisetconstruct-copy-destruct"/><computeroutput>unordered_multiset</computeroutput> public - construct/copy/destructexplicit unordered_multiset(size_type n = implementation-defined, + construct/copy/destructexplicit unordered_multiset(size_type n = implementation-defined, hasher const& hf = hasher(), key_equal const& eq = key_equal(), allocator_type const& 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, + ?>Postconditions:size() == 0template<typename InputIterator> + unordered_multiset(InputIterator f, InputIterator l, size_type n = implementation-defined, hasher const& hf = hasher(), key_equal const& eq = key_equal(), - allocator_type const& 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_multiset const&);The copy constructor. Copies the contained elements, hash function, predicate, maximum load factor and allocator.allocator_type const& 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_multiset const&);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.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). - explicit unordered_multiset(Allocator const& a);Constructs an empty container, using allocator a.unordered_multiset(unordered_multiset const& x, Allocator const& a);Constructs an container, copying x's contained elements, hash function, predicate, maximum load factor, but using allocator a.~unordered_multiset();explicit unordered_multiset(Allocator const& a);Constructs an empty container, using allocator a.unordered_multiset(unordered_multiset const& x, Allocator const& 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_multiset const&);The assignment operator. Copies the contained elements, hash function, predicate and maximum load factor but not the allocator.Notes:The destructor is applied to every element, and all memory is deallocatedunordered_multiset& operator=(unordered_multiset const&);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.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 @@ -591,92 +591,92 @@ Requires: value_type is move constructible. (TODO: This is not actually required in this implementation). - allocator_type get_allocator() const;<anchor id="id-1.1.1.2.29-bb"/><computeroutput>unordered_multiset</computeroutput> size and capacitybool empty() const;allocator_type get_allocator() const;<anchor id="id-1_1_1_2_29-bb"/><computeroutput>unordered_multiset</computeroutput> size and capacitybool empty() const;Returns:size() == 0size_type size() const;Returns:size() == 0size_type size() const;Returns:std::distance(begin(), end())size_type max_size() const;Returns:std::distance(begin(), end())size_type max_size() const;Returns:size() of the largest possible container. - <anchor id="id-1.1.1.2.30-bb"/><computeroutput>unordered_multiset</computeroutput> iteratorsiterator begin(); -const_iterator begin() const;Returns:size() of the largest possible container. + <anchor id="id-1_1_1_2_30-bb"/><computeroutput>unordered_multiset</computeroutput> iteratorsiterator begin(); +const_iterator begin() 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. - iterator end(); -const_iterator end() const;iterator end(); +const_iterator end() const;Returns:An iterator which refers to the past-the-end value for the container. - const_iterator cbegin() const;const_iterator cbegin() 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_iterator cend() const;const_iterator cend() const;Returns:A constant iterator which refers to the past-the-end value for the container. - <anchor id="id-1.1.1.2.31-bb"/><computeroutput>unordered_multiset</computeroutput> modifierstemplate<typename... Args> iterator emplace(Args&&... args);Inserts an object, constructed with the arguments args, in the container.<anchor id="id-1_1_1_2_31-bb"/><computeroutput>unordered_multiset</computeroutput> modifierstemplate<typename... Args> iterator emplace(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> - iterator emplace_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.iterator emplace_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.iterator insert(value_type const& obj);Inserts obj in the container.iterator insert(value_type const& 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.iterator insert(const_iterator hint, value_type const& 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: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.iterator insert(const_iterator hint, value_type const& 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> - void insert(InputIterator first, InputIterator last);Inserts a range of elements into the container.void insert(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.iterator erase(const_iterator position);Erase the element pointed to by position.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.iterator erase(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 + The method quick_erase is faster, but has yet to be standardized. - size_type erase(key_type const& k);Erase all elements with key equivalent to k.size_type erase(key_type const& 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.iterator erase(const_iterator first, const_iterator last);Erases the elements in the range from first to last.Returns:The number of elements erased.Throws:Only throws an exception if it is thrown by hasher or key_equal.iterator erase(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.void quick_erase(const_iterator position);Erase the element pointed to by position.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.void quick_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 + 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. - void erase_return_void(const_iterator position);Erase the element pointed to by position.void erase_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. - void clear();Erases all elements in the container.void clear();Erases all elements in the container.Postconditions:size() == 0Throws:Never throws an exception.void swap(unordered_multiset&);Postconditions:size() == 0Throws:Never throws an exception.void swap(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.<anchor id="id-1.1.1.2.32-bb"/><computeroutput>unordered_multiset</computeroutput> observershasher hash_function() const;the implementation details.<anchor id="id-1_1_1_2_32-bb"/><computeroutput>unordered_multiset</computeroutput> observershasher hash_function() const;Returns:The container's hash function. - key_equal key_eq() const;key_equal key_eq() const;Returns:The container's key equality predicate. - <anchor id="id-1.1.1.2.33-bb"/><computeroutput>unordered_multiset</computeroutput> lookupiterator find(key_type const& k); -const_iterator find(key_type const& k) const; + <anchor id="id-1_1_1_2_33-bb"/><computeroutput>unordered_multiset</computeroutput> lookupiterator find(key_type const& k); +const_iterator find(key_type const& k) const; template<typename CompatibleKey, typename CompatibleHash, typename CompatiblePredicate> - iterator find(CompatibleKey const& k, CompatibleHash const& hash, + iterator find(CompatibleKey const& k, CompatibleHash const& hash, CompatiblePredicate const& eq); template<typename CompatibleKey, typename CompatibleHash, typename CompatiblePredicate> const_iterator - find(CompatibleKey const& k, CompatibleHash const& hash, + find(CompatibleKey const& k, CompatibleHash const& hash, CompatiblePredicate const& eq) const;Returns:An iterator pointing to an element with key equivalent to k, or b.end() if no such element exists.Notes: @@ -684,41 +684,41 @@ 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_type count(key_type const& k) const;size_type count(key_type const& k) const;Returns:The number of elements with key equivalent to k.std::pair<iterator, iterator> equal_range(key_type const& k); -std::pair<const_iterator, const_iterator> equal_range(key_type const& k) const;Returns:The number of elements with key equivalent to k.std::pair<iterator, iterator> equal_range(key_type const& k); +std::pair<const_iterator, const_iterator> equal_range(key_type const& 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()). - <anchor id="id-1.1.1.2.34-bb"/><computeroutput>unordered_multiset</computeroutput> bucket interfacesize_type bucket_count() const;<anchor id="id-1_1_1_2_34-bb"/><computeroutput>unordered_multiset</computeroutput> bucket interfacesize_type bucket_count() const;Returns:The number of buckets.size_type max_bucket_count() const;Returns:The number of buckets.size_type max_bucket_count() const;Returns:An upper bound on the number of buckets.size_type bucket_size(size_type n) const;Returns:An upper bound on the number of buckets.size_type bucket_size(size_type n) const;Requires:n < bucket_count()Returns:The number of elements in bucket n.size_type bucket(key_type const& k) const;Requires:n < bucket_count()Returns:The number of elements in bucket n.size_type bucket(key_type const& 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_iterator begin(size_type n); -const_local_iterator begin(size_type n) 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_iterator begin(size_type n); +const_local_iterator begin(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_iterator end(size_type n); -const_local_iterator end(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_iterator end(size_type n); +const_local_iterator end(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_iterator cbegin(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_iterator cbegin(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_iterator cend(size_type n);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_iterator cend(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.<anchor id="id-1.1.1.2.35-bb"/><computeroutput>unordered_multiset</computeroutput> hash policyfloat load_factor() const;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.<anchor id="id-1_1_1_2_35-bb"/><computeroutput>unordered_multiset</computeroutput> hash policyfloat load_factor() const;Returns:The average number of elements per bucket.float max_load_factor() const;Returns:The average number of elements per bucket.float max_load_factor() const;Returns:Returns the current maximum load factor.void max_load_factor(float z);Returns:Returns the current maximum load factor.void max_load_factor(float z);Effects:Changes the container's maximum load factor, using z as a hint.void rehash(size_type n);Changes the number of buckets so that there at least n buckets, and so that the load factor is less than the maximum load factor.Invalidates iterators, and changes the order of elements. Pointers and references to elements are not invalidated.Effects:Changes the container's maximum load factor, using z as a hint.void rehash(size_type n);Changes the number of buckets so that there at least n buckets, and so that the load factor is less than the maximum load factor.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.<anchor id="id-1.1.1.2.36-bb"/><computeroutput>unordered_multiset</computeroutput> Equality Comparisonstemplate<typename Value, typename Hash, typename Pred, typename Alloc> + ?>Throws:The function has no effect if an exception is thrown, unless it is thrown by the container's hash function or comparison function.<anchor id="id-1_1_1_2_36-bb"/><computeroutput>unordered_multiset</computeroutput> Equality Comparisonstemplate<typename Value, typename Hash, typename Pred, typename Alloc> bool operator==(unordered_multiset<Value, Hash, Pred, Alloc> const& x, unordered_multiset<Value, Hash, Pred, Alloc> const& y);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.<anchor id="id-1.1.1.2.37-bb"/><computeroutput>unordered_multiset</computeroutput> swaptemplate<typename Value, typename Hash, typename Pred, typename Alloc> + equivalent equality predicates.<anchor id="id-1_1_1_2_37-bb"/><computeroutput>unordered_multiset</computeroutput> swaptemplate<typename Value, typename Hash, typename Pred, typename Alloc> void swap(unordered_multiset<Value, Hash, Pred, Alloc>& x, unordered_multiset<Value, Hash, Pred, Alloc>& y);typedef implementation-defined const_local_iterator; // construct/copy/destruct - explicit unordered_map(size_type = implementation-defined, + explicit unordered_map(size_type = implementation-defined, hasher const& = hasher(), key_equal const& = key_equal(), allocator_type const& = allocator_type()); template<typename InputIterator> - unordered_map(InputIterator, InputIterator, + unordered_map(InputIterator, InputIterator, size_type = implementation-defined, hasher const& = hasher(), key_equal const& = key_equal(), allocator_type const& = allocator_type()); - unordered_map(unordered_map const&); - unordered_map(unordered_map &&); - explicit unordered_map(Allocator const&); - unordered_map(unordered_map const&, Allocator const&); - ~unordered_map(); - unordered_map& operator=(unordered_map const&); - unordered_map& operator=(unordered_map &&); - allocator_type get_allocator() const; + unordered_map(unordered_map const&); + unordered_map(unordered_map &&); + explicit unordered_map(Allocator const&); + unordered_map(unordered_map const&, Allocator const&); + ~unordered_map(); + unordered_map& operator=(unordered_map const&); + unordered_map& operator=(unordered_map &&); + allocator_type get_allocator() const; - // size and capacity - bool empty() const; - size_type size() const; - size_type max_size() const; + // size and capacity + bool empty() const; + size_type size() const; + size_type max_size() const; - // iterators - iterator begin(); - const_iterator begin() const; - iterator end(); - const_iterator end() const; - const_iterator cbegin() const; - const_iterator cend() const; + // iterators + iterator begin(); + const_iterator begin() const; + iterator end(); + const_iterator end() const; + const_iterator cbegin() const; + const_iterator cend() const; - // modifiers - template<typename... Args> std::pair<iterator, bool> emplace(Args&&...); - template<typename... Args> iterator emplace_hint(const_iterator, Args&&...); - std::pair<iterator, bool> insert(value_type const&); - iterator insert(const_iterator, value_type const&); - template<typename InputIterator> void insert(InputIterator, InputIterator); - iterator erase(const_iterator); - size_type erase(key_type const&); - iterator erase(const_iterator, const_iterator); - void quick_erase(const_iterator); - void erase_return_void(const_iterator); - void clear(); - void swap(unordered_map&); + // modifiers + template<typename... Args> std::pair<iterator, bool> emplace(Args&&...); + template<typename... Args> iterator emplace_hint(const_iterator, Args&&...); + std::pair<iterator, bool> insert(value_type const&); + iterator insert(const_iterator, value_type const&); + template<typename InputIterator> void insert(InputIterator, InputIterator); + iterator erase(const_iterator); + size_type erase(key_type const&); + iterator erase(const_iterator, const_iterator); + void quick_erase(const_iterator); + void erase_return_void(const_iterator); + void clear(); + void swap(unordered_map&); - // observers - hasher hash_function() const; - key_equal key_eq() const; + // observers + hasher hash_function() const; + key_equal key_eq() const; - // lookup - iterator find(key_type const&); - const_iterator find(key_type const&) const; + // lookup + iterator find(key_type const&); + const_iterator find(key_type const&) const; template<typename CompatibleKey, typename CompatibleHash, typename CompatiblePredicate> - iterator find(CompatibleKey const&, CompatibleHash const&, + iterator find(CompatibleKey const&, CompatibleHash const&, CompatiblePredicate const&); template<typename CompatibleKey, typename CompatibleHash, typename CompatiblePredicate> const_iterator - find(CompatibleKey const&, CompatibleHash const&, + find(CompatibleKey const&, CompatibleHash const&, CompatiblePredicate const&) const; - size_type count(key_type const&) const; - std::pair<iterator, iterator> equal_range(key_type const&); - std::pair<const_iterator, const_iterator> equal_range(key_type const&) const; - mapped_type& operator[](key_type const&); - Mapped& at(key_type const&); - Mapped const& at(key_type const&) const; + size_type count(key_type const&) const; + std::pair<iterator, iterator> equal_range(key_type const&); + std::pair<const_iterator, const_iterator> equal_range(key_type const&) const; + mapped_type& operator[](key_type const&); + Mapped& at(key_type const&); + Mapped const& at(key_type const&) const; - // bucket interface - size_type bucket_count() const; - size_type max_bucket_count() const; - size_type bucket_size(size_type) const; - size_type bucket(key_type const&) const; - local_iterator begin(size_type); - const_local_iterator begin(size_type) const; - local_iterator end(size_type); - const_local_iterator end(size_type) const; - const_local_iterator cbegin(size_type) const; - const_local_iterator cend(size_type); + // bucket interface + size_type bucket_count() const; + size_type max_bucket_count() const; + size_type bucket_size(size_type) const; + size_type bucket(key_type const&) const; + local_iterator begin(size_type); + const_local_iterator begin(size_type) const; + local_iterator end(size_type); + const_local_iterator end(size_type) const; + const_local_iterator cbegin(size_type) const; + const_local_iterator cend(size_type); - // hash policy - float load_factor() const; - float max_load_factor() const; - void max_load_factor(float); - void rehash(size_type); + // hash policy + float load_factor() const; + float max_load_factor() const; + void max_load_factor(float); + void rehash(size_type); }; -// Equality Comparisons +// Equality Comparisons template<typename Key, typename Mapped, typename Hash, typename Pred, typename Alloc> bool operator==(unordered_map<Key, Mapped, Hash, Pred, Alloc> const&, @@ -894,7 +894,7 @@ bool operator!=(unordered_map<Key, Mapped, Hash, Pred, Alloc> const&, unordered_map<Key, Mapped, Hash, Pred, Alloc> const&); -// swap +// swap template<typename Key, typename Mapped, typename Hash, typename Pred, typename Alloc> void swap(unordered_map<Key, Mapped, Hash, Pred, Alloc>&, @@ -955,32 +955,32 @@ A const_local_iterator object can be used to iterate through a single bucket. <anchor id="boost.unordered_mapconstruct-copy-destruct"/><computeroutput>unordered_map</computeroutput> public - construct/copy/destructexplicit unordered_map(size_type n = implementation-defined, + construct/copy/destructexplicit unordered_map(size_type n = implementation-defined, hasher const& hf = hasher(), key_equal const& eq = key_equal(), allocator_type const& 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, + ?>Postconditions:size() == 0template<typename InputIterator> + unordered_map(InputIterator f, InputIterator l, size_type n = implementation-defined, hasher const& hf = hasher(), key_equal const& eq = key_equal(), - allocator_type const& 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_map const&);The copy constructor. Copies the contained elements, hash function, predicate, maximum load factor and allocator.allocator_type const& 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_map const&);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.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). - explicit unordered_map(Allocator const& a);Constructs an empty container, using allocator a.unordered_map(unordered_map const& x, Allocator const& a);Constructs an container, copying x's contained elements, hash function, predicate, maximum load factor, but using allocator a.~unordered_map();explicit unordered_map(Allocator const& a);Constructs an empty container, using allocator a.unordered_map(unordered_map const& x, Allocator const& 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_map const&);The assignment operator. Copies the contained elements, hash function, predicate and maximum load factor but not the allocator.Notes:The destructor is applied to every element, and all memory is deallocatedunordered_map& operator=(unordered_map const&);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.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 @@ -989,92 +989,92 @@ Requires: value_type is move constructible. (TODO: This is not actually required in this implementation). - allocator_type get_allocator() const;<anchor id="id-1.2.1.1.30-bb"/><computeroutput>unordered_map</computeroutput> size and capacitybool empty() const;allocator_type get_allocator() const;<anchor id="id-1_2_1_1_30-bb"/><computeroutput>unordered_map</computeroutput> size and capacitybool empty() const;Returns:size() == 0size_type size() const;Returns:size() == 0size_type size() const;Returns:std::distance(begin(), end())size_type max_size() const;Returns:std::distance(begin(), end())size_type max_size() const;Returns:size() of the largest possible container. - <anchor id="id-1.2.1.1.31-bb"/><computeroutput>unordered_map</computeroutput> iteratorsiterator begin(); -const_iterator begin() const;Returns:size() of the largest possible container. + <anchor id="id-1_2_1_1_31-bb"/><computeroutput>unordered_map</computeroutput> iteratorsiterator begin(); +const_iterator begin() 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. - iterator end(); -const_iterator end() const;iterator end(); +const_iterator end() const;Returns:An iterator which refers to the past-the-end value for the container. - const_iterator cbegin() const;const_iterator cbegin() 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_iterator cend() const;const_iterator cend() const;Returns:A constant iterator which refers to the past-the-end value for the container. - <anchor id="id-1.2.1.1.32-bb"/><computeroutput>unordered_map</computeroutput> 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.<anchor id="id-1_2_1_1_32-bb"/><computeroutput>unordered_map</computeroutput> 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> - iterator emplace_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.iterator emplace_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_type const& obj);Inserts obj in the container if and only if there is no element in the container with an equivalent key.std::pair<iterator, bool> insert(value_type const& 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.iterator insert(const_iterator hint, value_type const& 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: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.iterator insert(const_iterator hint, value_type const& 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> - void insert(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.void insert(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.iterator erase(const_iterator position);Erase the element pointed to by position.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.iterator erase(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 + The method quick_erase is faster, but has yet to be standardized. - size_type erase(key_type const& k);Erase all elements with key equivalent to k.size_type erase(key_type const& 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.iterator erase(const_iterator first, const_iterator last);Erases the elements in the range from first to last.Returns:The number of elements erased.Throws:Only throws an exception if it is thrown by hasher or key_equal.iterator erase(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.void quick_erase(const_iterator position);Erase the element pointed to by position.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.void quick_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 + 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. - void erase_return_void(const_iterator position);Erase the element pointed to by position.void erase_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. - void clear();Erases all elements in the container.void clear();Erases all elements in the container.Postconditions:size() == 0Throws:Never throws an exception.void swap(unordered_map&);Postconditions:size() == 0Throws:Never throws an exception.void swap(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.<anchor id="id-1.2.1.1.33-bb"/><computeroutput>unordered_map</computeroutput> observershasher hash_function() const;the implementation details.<anchor id="id-1_2_1_1_33-bb"/><computeroutput>unordered_map</computeroutput> observershasher hash_function() const;Returns:The container's hash function. - key_equal key_eq() const;key_equal key_eq() const;Returns:The container's key equality predicate. - <anchor id="id-1.2.1.1.34-bb"/><computeroutput>unordered_map</computeroutput> lookupiterator find(key_type const& k); -const_iterator find(key_type const& k) const; + <anchor id="id-1_2_1_1_34-bb"/><computeroutput>unordered_map</computeroutput> lookupiterator find(key_type const& k); +const_iterator find(key_type const& k) const; template<typename CompatibleKey, typename CompatibleHash, typename CompatiblePredicate> - iterator find(CompatibleKey const& k, CompatibleHash const& hash, + iterator find(CompatibleKey const& k, CompatibleHash const& hash, CompatiblePredicate const& eq); template<typename CompatibleKey, typename CompatibleHash, typename CompatiblePredicate> const_iterator - find(CompatibleKey const& k, CompatibleHash const& hash, + find(CompatibleKey const& k, CompatibleHash const& hash, CompatiblePredicate const& eq) const;Returns:An iterator pointing to an element with key equivalent to k, or b.end() if no such element exists.Notes: @@ -1082,47 +1082,47 @@ 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_type count(key_type const& k) const;size_type count(key_type const& k) const;Returns:The number of elements with key equivalent to k.std::pair<iterator, iterator> equal_range(key_type const& k); -std::pair<const_iterator, const_iterator> equal_range(key_type const& k) const;Returns:The number of elements with key equivalent to k.std::pair<iterator, iterator> equal_range(key_type const& k); +std::pair<const_iterator, const_iterator> equal_range(key_type const& 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_type const& k);mapped_type& operator[](key_type const& 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_type const& k); -Mapped const& at(key_type const& k) const;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_type const& k); +Mapped const& at(key_type const& 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++.<anchor id="id-1.2.1.1.35-bb"/><computeroutput>unordered_map</computeroutput> bucket interfacesize_type bucket_count() const;comp.std.c++.<anchor id="id-1_2_1_1_35-bb"/><computeroutput>unordered_map</computeroutput> bucket interfacesize_type bucket_count() const;Returns:The number of buckets.size_type max_bucket_count() const;Returns:The number of buckets.size_type max_bucket_count() const;Returns:An upper bound on the number of buckets.size_type bucket_size(size_type n) const;Returns:An upper bound on the number of buckets.size_type bucket_size(size_type n) const;Requires:n < bucket_count()Returns:The number of elements in bucket n.size_type bucket(key_type const& k) const;Requires:n < bucket_count()Returns:The number of elements in bucket n.size_type bucket(key_type const& 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_iterator begin(size_type n); -const_local_iterator begin(size_type n) 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_iterator begin(size_type n); +const_local_iterator begin(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_iterator end(size_type n); -const_local_iterator end(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_iterator end(size_type n); +const_local_iterator end(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_iterator cbegin(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_iterator cbegin(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_iterator cend(size_type n);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_iterator cend(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.<anchor id="id-1.2.1.1.36-bb"/><computeroutput>unordered_map</computeroutput> hash policyfloat load_factor() const;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.<anchor id="id-1_2_1_1_36-bb"/><computeroutput>unordered_map</computeroutput> hash policyfloat load_factor() const;Returns:The average number of elements per bucket.float max_load_factor() const;Returns:The average number of elements per bucket.float max_load_factor() const;Returns:Returns the current maximum load factor.void max_load_factor(float z);Returns:Returns the current maximum load factor.void max_load_factor(float z);Effects:Changes the container's maximum load factor, using z as a hint.void rehash(size_type n);Changes the number of buckets so that there at least n buckets, and so that the load factor is less than the maximum load factor.Invalidates iterators, and changes the order of elements. Pointers and references to elements are not invalidated.Effects:Changes the container's maximum load factor, using z as a hint.void rehash(size_type n);Changes the number of buckets so that there at least n buckets, and so that the load factor is less than the maximum load factor.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.<anchor id="id-1.2.1.1.37-bb"/><computeroutput>unordered_map</computeroutput> Equality Comparisonstemplate<typename Key, typename Mapped, typename Hash, typename Pred, + ?>Throws:The function has no effect if an exception is thrown, unless it is thrown by the container's hash function or comparison function.<anchor id="id-1_2_1_1_37-bb"/><computeroutput>unordered_map</computeroutput> Equality Comparisonstemplate<typename Key, typename Mapped, typename Hash, typename Pred, typename Alloc> bool operator==(unordered_map<Key, Mapped, Hash, Pred, Alloc> const& x, unordered_map<Key, Mapped, Hash, Pred, Alloc> const& y);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.<anchor id="id-1.2.1.1.38-bb"/><computeroutput>unordered_map</computeroutput> swaptemplate<typename Key, typename Mapped, typename Hash, typename Pred, + equivalent equality predicates.<anchor id="id-1_2_1_1_38-bb"/><computeroutput>unordered_map</computeroutput> swaptemplate<typename Key, typename Mapped, typename Hash, typename Pred, typename Alloc> void swap(unordered_map<Key, Mapped, Hash, Pred, Alloc>& x, unordered_map<Key, Mapped, Hash, Pred, Alloc>& y);typedef implementation-defined const_local_iterator; // construct/copy/destruct - explicit unordered_multimap(size_type = implementation-defined, + explicit unordered_multimap(size_type = implementation-defined, hasher const& = hasher(), key_equal const& = key_equal(), allocator_type const& = allocator_type()); template<typename InputIterator> - unordered_multimap(InputIterator, InputIterator, + unordered_multimap(InputIterator, InputIterator, size_type = implementation-defined, hasher const& = hasher(), key_equal const& = key_equal(), allocator_type const& = allocator_type()); - unordered_multimap(unordered_multimap const&); - unordered_multimap(unordered_multimap &&); - explicit unordered_multimap(Allocator const&); - unordered_multimap(unordered_multimap const&, Allocator const&); - ~unordered_multimap(); - unordered_multimap& operator=(unordered_multimap const&); - unordered_multimap& operator=(unordered_multimap &&); - allocator_type get_allocator() const; + unordered_multimap(unordered_multimap const&); + unordered_multimap(unordered_multimap &&); + explicit unordered_multimap(Allocator const&); + unordered_multimap(unordered_multimap const&, Allocator const&); + ~unordered_multimap(); + unordered_multimap& operator=(unordered_multimap const&); + unordered_multimap& operator=(unordered_multimap &&); + allocator_type get_allocator() const; - // size and capacity - bool empty() const; - size_type size() const; - size_type max_size() const; + // size and capacity + bool empty() const; + size_type size() const; + size_type max_size() const; - // iterators - iterator begin(); - const_iterator begin() const; - iterator end(); - const_iterator end() const; - const_iterator cbegin() const; - const_iterator cend() const; + // iterators + iterator begin(); + const_iterator begin() const; + iterator end(); + const_iterator end() const; + const_iterator cbegin() const; + const_iterator cend() const; - // modifiers - template<typename... Args> iterator emplace(Args&&...); - template<typename... Args> iterator emplace_hint(const_iterator, Args&&...); - iterator insert(value_type const&); - iterator insert(const_iterator, value_type const&); - template<typename InputIterator> void insert(InputIterator, InputIterator); - iterator erase(const_iterator); - size_type erase(key_type const&); - iterator erase(const_iterator, const_iterator); - void quick_erase(const_iterator); - void erase_return_void(const_iterator); - void clear(); - void swap(unordered_multimap&); + // modifiers + template<typename... Args> iterator emplace(Args&&...); + template<typename... Args> iterator emplace_hint(const_iterator, Args&&...); + iterator insert(value_type const&); + iterator insert(const_iterator, value_type const&); + template<typename InputIterator> void insert(InputIterator, InputIterator); + iterator erase(const_iterator); + size_type erase(key_type const&); + iterator erase(const_iterator, const_iterator); + void quick_erase(const_iterator); + void erase_return_void(const_iterator); + void clear(); + void swap(unordered_multimap&); - // observers - hasher hash_function() const; - key_equal key_eq() const; + // observers + hasher hash_function() const; + key_equal key_eq() const; - // lookup - iterator find(key_type const&); - const_iterator find(key_type const&) const; + // lookup + iterator find(key_type const&); + const_iterator find(key_type const&) const; template<typename CompatibleKey, typename CompatibleHash, typename CompatiblePredicate> - iterator find(CompatibleKey const&, CompatibleHash const&, + iterator find(CompatibleKey const&, CompatibleHash const&, CompatiblePredicate const&); template<typename CompatibleKey, typename CompatibleHash, typename CompatiblePredicate> const_iterator - find(CompatibleKey const&, CompatibleHash const&, + find(CompatibleKey const&, CompatibleHash const&, CompatiblePredicate const&) const; - size_type count(key_type const&) const; - std::pair<iterator, iterator> equal_range(key_type const&); - std::pair<const_iterator, const_iterator> equal_range(key_type const&) const; + size_type count(key_type const&) const; + std::pair<iterator, iterator> equal_range(key_type const&); + std::pair<const_iterator, const_iterator> equal_range(key_type const&) const; - // bucket interface - size_type bucket_count() const; - size_type max_bucket_count() const; - size_type bucket_size(size_type) const; - size_type bucket(key_type const&) const; - local_iterator begin(size_type); - const_local_iterator begin(size_type) const; - local_iterator end(size_type); - const_local_iterator end(size_type) const; - const_local_iterator cbegin(size_type) const; - const_local_iterator cend(size_type); + // bucket interface + size_type bucket_count() const; + size_type max_bucket_count() const; + size_type bucket_size(size_type) const; + size_type bucket(key_type const&) const; + local_iterator begin(size_type); + const_local_iterator begin(size_type) const; + local_iterator end(size_type); + const_local_iterator end(size_type) const; + const_local_iterator cbegin(size_type) const; + const_local_iterator cend(size_type); - // hash policy - float load_factor() const; - float max_load_factor() const; - void max_load_factor(float); - void rehash(size_type); + // hash policy + float load_factor() const; + float max_load_factor() const; + void max_load_factor(float); + void rehash(size_type); }; -// Equality Comparisons +// Equality Comparisons template<typename Key, typename Mapped, typename Hash, typename Pred, typename Alloc> bool operator==(unordered_multimap<Key, Mapped, Hash, Pred, Alloc> const&, @@ -1263,7 +1263,7 @@ bool operator!=(unordered_multimap<Key, Mapped, Hash, Pred, Alloc> const&, unordered_multimap<Key, Mapped, Hash, Pred, Alloc> const&); -// swap +// swap template<typename Key, typename Mapped, typename Hash, typename Pred, typename Alloc> void swap(unordered_multimap<Key, Mapped, Hash, Pred, Alloc>&, @@ -1324,32 +1324,32 @@ A const_local_iterator object can be used to iterate through a single bucket. <anchor id="boost.unordered_multimapconstruct-copy-destruct"/><computeroutput>unordered_multimap</computeroutput> public - construct/copy/destructexplicit unordered_multimap(size_type n = implementation-defined, + construct/copy/destructexplicit unordered_multimap(size_type n = implementation-defined, hasher const& hf = hasher(), key_equal const& eq = key_equal(), allocator_type const& 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, + ?>Postconditions:size() == 0template<typename InputIterator> + unordered_multimap(InputIterator f, InputIterator l, size_type n = implementation-defined, hasher const& hf = hasher(), key_equal const& eq = key_equal(), - allocator_type const& 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_multimap const&);The copy constructor. Copies the contained elements, hash function, predicate, maximum load factor and allocator.allocator_type const& 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_multimap const&);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.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). - explicit unordered_multimap(Allocator const& a);Constructs an empty container, using allocator a.unordered_multimap(unordered_multimap const& x, Allocator const& a);Constructs an container, copying x's contained elements, hash function, predicate, maximum load factor, but using allocator a.~unordered_multimap();explicit unordered_multimap(Allocator const& a);Constructs an empty container, using allocator a.unordered_multimap(unordered_multimap const& x, Allocator const& 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_multimap const&);The assignment operator. Copies the contained elements, hash function, predicate and maximum load factor but not the allocator.Notes:The destructor is applied to every element, and all memory is deallocatedunordered_multimap& operator=(unordered_multimap const&);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.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 @@ -1358,92 +1358,92 @@ Requires: value_type is move constructible. (TODO: This is not actually required in this implementation). - allocator_type get_allocator() const;<anchor id="id-1.2.1.2.30-bb"/><computeroutput>unordered_multimap</computeroutput> size and capacitybool empty() const;allocator_type get_allocator() const;<anchor id="id-1_2_1_2_30-bb"/><computeroutput>unordered_multimap</computeroutput> size and capacitybool empty() const;Returns:size() == 0size_type size() const;Returns:size() == 0size_type size() const;Returns:std::distance(begin(), end())size_type max_size() const;Returns:std::distance(begin(), end())size_type max_size() const;Returns:size() of the largest possible container. - <anchor id="id-1.2.1.2.31-bb"/><computeroutput>unordered_multimap</computeroutput> iteratorsiterator begin(); -const_iterator begin() const;Returns:size() of the largest possible container. + <anchor id="id-1_2_1_2_31-bb"/><computeroutput>unordered_multimap</computeroutput> iteratorsiterator begin(); +const_iterator begin() 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. - iterator end(); -const_iterator end() const;iterator end(); +const_iterator end() const;Returns:An iterator which refers to the past-the-end value for the container. - const_iterator cbegin() const;const_iterator cbegin() 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_iterator cend() const;const_iterator cend() const;Returns:A constant iterator which refers to the past-the-end value for the container. - <anchor id="id-1.2.1.2.32-bb"/><computeroutput>unordered_multimap</computeroutput> modifierstemplate<typename... Args> iterator emplace(Args&&... args);Inserts an object, constructed with the arguments args, in the container.<anchor id="id-1_2_1_2_32-bb"/><computeroutput>unordered_multimap</computeroutput> modifierstemplate<typename... Args> iterator emplace(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> - iterator emplace_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.iterator emplace_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.iterator insert(value_type const& obj);Inserts obj in the container.iterator insert(value_type const& 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.iterator insert(const_iterator hint, value_type const& 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: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.iterator insert(const_iterator hint, value_type const& 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> - void insert(InputIterator first, InputIterator last);Inserts a range of elements into the container.void insert(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.iterator erase(const_iterator position);Erase the element pointed to by position.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.iterator erase(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 + The method quick_erase is faster, but has yet to be standardized. - size_type erase(key_type const& k);Erase all elements with key equivalent to k.size_type erase(key_type const& 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.iterator erase(const_iterator first, const_iterator last);Erases the elements in the range from first to last.Returns:The number of elements erased.Throws:Only throws an exception if it is thrown by hasher or key_equal.iterator erase(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.void quick_erase(const_iterator position);Erase the element pointed to by position.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.void quick_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 + 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. - void erase_return_void(const_iterator position);Erase the element pointed to by position.void erase_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. - void clear();Erases all elements in the container.void clear();Erases all elements in the container.Postconditions:size() == 0Throws:Never throws an exception.void swap(unordered_multimap&);Postconditions:size() == 0Throws:Never throws an exception.void swap(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.<anchor id="id-1.2.1.2.33-bb"/><computeroutput>unordered_multimap</computeroutput> observershasher hash_function() const;the implementation details.<anchor id="id-1_2_1_2_33-bb"/><computeroutput>unordered_multimap</computeroutput> observershasher hash_function() const;Returns:The container's hash function. - key_equal key_eq() const;key_equal key_eq() const;Returns:The container's key equality predicate. - <anchor id="id-1.2.1.2.34-bb"/><computeroutput>unordered_multimap</computeroutput> lookupiterator find(key_type const& k); -const_iterator find(key_type const& k) const; + <anchor id="id-1_2_1_2_34-bb"/><computeroutput>unordered_multimap</computeroutput> lookupiterator find(key_type const& k); +const_iterator find(key_type const& k) const; template<typename CompatibleKey, typename CompatibleHash, typename CompatiblePredicate> - iterator find(CompatibleKey const& k, CompatibleHash const& hash, + iterator find(CompatibleKey const& k, CompatibleHash const& hash, CompatiblePredicate const& eq); template<typename CompatibleKey, typename CompatibleHash, typename CompatiblePredicate> const_iterator - find(CompatibleKey const& k, CompatibleHash const& hash, + find(CompatibleKey const& k, CompatibleHash const& hash, CompatiblePredicate const& eq) const;Returns:An iterator pointing to an element with key equivalent to k, or b.end() if no such element exists.Notes: @@ -1451,41 +1451,41 @@ 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_type count(key_type const& k) const;size_type count(key_type const& k) const;Returns:The number of elements with key equivalent to k.std::pair<iterator, iterator> equal_range(key_type const& k); -std::pair<const_iterator, const_iterator> equal_range(key_type const& k) const;Returns:The number of elements with key equivalent to k.std::pair<iterator, iterator> equal_range(key_type const& k); +std::pair<const_iterator, const_iterator> equal_range(key_type const& 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()). - <anchor id="id-1.2.1.2.35-bb"/><computeroutput>unordered_multimap</computeroutput> bucket interfacesize_type bucket_count() const;<anchor id="id-1_2_1_2_35-bb"/><computeroutput>unordered_multimap</computeroutput> bucket interfacesize_type bucket_count() const;Returns:The number of buckets.size_type max_bucket_count() const;Returns:The number of buckets.size_type max_bucket_count() const;Returns:An upper bound on the number of buckets.size_type bucket_size(size_type n) const;Returns:An upper bound on the number of buckets.size_type bucket_size(size_type n) const;Requires:n < bucket_count()Returns:The number of elements in bucket n.size_type bucket(key_type const& k) const;Requires:n < bucket_count()Returns:The number of elements in bucket n.size_type bucket(key_type const& 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_iterator begin(size_type n); -const_local_iterator begin(size_type n) 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_iterator begin(size_type n); +const_local_iterator begin(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_iterator end(size_type n); -const_local_iterator end(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_iterator end(size_type n); +const_local_iterator end(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_iterator cbegin(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_iterator cbegin(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_iterator cend(size_type n);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_iterator cend(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.<anchor id="id-1.2.1.2.36-bb"/><computeroutput>unordered_multimap</computeroutput> hash policyfloat load_factor() const;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.<anchor id="id-1_2_1_2_36-bb"/><computeroutput>unordered_multimap</computeroutput> hash policyfloat load_factor() const;Returns:The average number of elements per bucket.float max_load_factor() const;Returns:The average number of elements per bucket.float max_load_factor() const;Returns:Returns the current maximum load factor.void max_load_factor(float z);Returns:Returns the current maximum load factor.void max_load_factor(float z);Effects:Changes the container's maximum load factor, using z as a hint.void rehash(size_type n);Changes the number of buckets so that there at least n buckets, and so that the load factor is less than the maximum load factor.Invalidates iterators, and changes the order of elements. Pointers and references to elements are not invalidated.Effects:Changes the container's maximum load factor, using z as a hint.void rehash(size_type n);Changes the number of buckets so that there at least n buckets, and so that the load factor is less than the maximum load factor.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.<anchor id="id-1.2.1.2.37-bb"/><computeroutput>unordered_multimap</computeroutput> Equality Comparisonstemplate<typename Key, typename Mapped, typename Hash, typename Pred, + ?>Throws:The function has no effect if an exception is thrown, unless it is thrown by the container's hash function or comparison function.<anchor id="id-1_2_1_2_37-bb"/><computeroutput>unordered_multimap</computeroutput> Equality Comparisonstemplate<typename Key, typename Mapped, typename Hash, typename Pred, typename Alloc> bool operator==(unordered_multimap<Key, Mapped, Hash, Pred, Alloc> const& x, unordered_multimap<Key, Mapped, Hash, Pred, Alloc> const& y);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.<anchor id="id-1.2.1.2.38-bb"/><computeroutput>unordered_multimap</computeroutput> swaptemplate<typename Key, typename Mapped, typename Hash, typename Pred, + equivalent equality predicates.<anchor id="id-1_2_1_2_38-bb"/><computeroutput>unordered_multimap</computeroutput> swaptemplate<typename Key, typename Mapped, typename Hash, typename Pred, typename Alloc> void swap(unordered_multimap<Key, Mapped, Hash, Pred, Alloc>& x, unordered_multimap<Key, Mapped, Hash, Pred, Alloc>& y);Methodname Test
Reference @@ -18,9 +18,9 @@ class foo { public: - void bar(int); - void operator()(int); -};Descriptionvoid bar(int);void operator()(int); + void bar(int); + void operator()(int); +};Descriptionvoid bar(int);void operator()(int);
\ No newline at end of file diff --git a/xsl/lookup.xsl b/xsl/lookup.xsl index ad8b5e3..91b4a59 100644 --- a/xsl/lookup.xsl +++ b/xsl/lookup.xsl @@ -22,10 +22,23 @@
- + + -bb + + + + + + + + + + + + @@ -234,7 +247,7 @@ translate($part, '.<>;\:*?"| ', '') != $part )"> - + +
Header <<ulink url="../../example.hpp">example.hpp</ulink>> + +foo +FOO +bar + Macro foo3foo// In header: <example.hpp> + +fooDescription + + Macro FOO3FOO// In header: <example.hpp> + +FOODescription + + Macro bar3bar// In header: <example.hpp> + +barDescription + +
\ No newline at end of file diff --git a/test/more/tests/ref/macro.gold2 b/test/more/tests/ref/macro.gold2 new file mode 100644 index 0000000..88780c1 --- /dev/null +++ b/test/more/tests/ref/macro.gold2 @@ -0,0 +1,19 @@ + +
Header <<ulink url="../../example.hpp">example.hpp</ulink>> + +foo +FOO +bar + Macro foo3foo// In header: <example.hpp> + +fooDescription + + Macro FOO3FOO// In header: <example.hpp> + +FOODescription + + Macro bar3bar// In header: <example.hpp> + +barDescription + +
\ No newline at end of file diff --git a/test/more/tests/ref/macro.xml b/test/more/tests/ref/macro.xml new file mode 100644 index 0000000..d93d529 --- /dev/null +++ b/test/more/tests/ref/macro.xml @@ -0,0 +1,22 @@ + + +
+ + + + + + + + + + + + +
From 34ad10b7dc2fce5fa2b616c30d1d88b6839e3132 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 29 Oct 2017 12:52:54 +0000 Subject: [PATCH 08/10] Better consistent macro ids --- test/more/tests/ref/macro.gold2 | 8 ++++---- xsl/macro.xsl | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/test/more/tests/ref/macro.gold2 b/test/more/tests/ref/macro.gold2 index 88780c1..4f202fc 100644 --- a/test/more/tests/ref/macro.gold2 +++ b/test/more/tests/ref/macro.gold2 @@ -1,14 +1,14 @@
Header <<ulink url="../../example.hpp">example.hpp</ulink>> -foo -FOO +foo +FOO bar - Macro foo3foo// In header: <example.hpp> + Macro foo3foo// In header: <example.hpp> fooDescription - Macro FOO3FOO// In header: <example.hpp> + Macro FOO3FOO// In header: <example.hpp> FOODescription diff --git a/xsl/macro.xsl b/xsl/macro.xsl index 6d0fd94..621b02a 100644 --- a/xsl/macro.xsl +++ b/xsl/macro.xsl @@ -114,8 +114,9 @@ + _ - + From d2b0125d71b68778c03084da9cdccbde0e8f3cbc Mon Sep 17 00:00:00 2001 From: Daniel James Date: Mon, 30 Oct 2017 16:47:51 +0000 Subject: [PATCH 09/10] Truncate macro ids, as for other symbols --- test/more/tests/ref/macro.gold | 7 ++++++- test/more/tests/ref/macro.gold2 | 15 ++++++++++----- test/more/tests/ref/macro.xml | 4 ++++ xsl/macro.xsl | 20 +++++++++++++------- 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/test/more/tests/ref/macro.gold b/test/more/tests/ref/macro.gold index ffe6187..e7f4377 100644 --- a/test/more/tests/ref/macro.gold +++ b/test/more/tests/ref/macro.gold @@ -3,7 +3,8 @@ foo FOO -bar +bar +REALLY_LONG_MACRO_NAME_WHICH_SHOULD_GET_TRUNCATED Macro foo3foo// In header: <example.hpp> fooDescription @@ -16,4 +17,8 @@ barDescription + Macro REALLY_LONG_MACRO_NAME_WHICH_SHOULD_GET_TRUNCATED3REALLY_LONG_MACRO_NAME_WHICH_SHOULD_GET_TRUNCATED// In header: <example.hpp> + +REALLY_LONG_MACRO_NAME_WHICH_SHOULD_GET_TRUNCATEDDescription +
\ No newline at end of file diff --git a/test/more/tests/ref/macro.gold2 b/test/more/tests/ref/macro.gold2 index 4f202fc..1ae5886 100644 --- a/test/more/tests/ref/macro.gold2 +++ b/test/more/tests/ref/macro.gold2 @@ -1,14 +1,15 @@
Header <<ulink url="../../example.hpp">example.hpp</ulink>> -foo -FOO -bar - Macro foo3foo// In header: <example.hpp> +foo +FOO +bar +REALLY_LONG_MACRO_NAME_WHICH_SHOULD_GET_TRUNCATED + Macro foo3foo// In header: <example.hpp> fooDescription - Macro FOO3FOO// In header: <example.hpp> + Macro FOO3FOO// In header: <example.hpp> FOODescription @@ -16,4 +17,8 @@ barDescription + Macro REALLY_LONG_MACRO_NAME_WHICH_SHOULD_GET_TRUNCATED3REALLY_LONG_MACRO_NAME_WHICH_SHOULD_GET_TRUNCATED// In header: <example.hpp> + +REALLY_LONG_MACRO_NAME_WHICH_SHOULD_GET_TRUNCATEDDescription +
\ No newline at end of file diff --git a/test/more/tests/ref/macro.xml b/test/more/tests/ref/macro.xml index d93d529..2412684 100644 --- a/test/more/tests/ref/macro.xml +++ b/test/more/tests/ref/macro.xml @@ -19,4 +19,8 @@ + + + + diff --git a/xsl/macro.xsl b/xsl/macro.xsl index 621b02a..40457a4 100644 --- a/xsl/macro.xsl +++ b/xsl/macro.xsl @@ -111,12 +111,18 @@
- - - - _ - - + + + + + _ + + + + + + From 7d3269558686162e950e2ad3995733aa896048c4 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Mon, 30 Oct 2017 17:08:03 +0000 Subject: [PATCH 10/10] Test case for deeply nested macro In this case the id is so long that there's nothing left of the macro name. --- test/more/tests/ref/macro.gold | 30 +++++++++++++++++++++++ test/more/tests/ref/macro.gold2 | 42 ++++++++++++++++++++++++++++----- test/more/tests/ref/macro.xml | 28 ++++++++++++++++++++++ 3 files changed, 94 insertions(+), 6 deletions(-) diff --git a/test/more/tests/ref/macro.gold b/test/more/tests/ref/macro.gold index e7f4377..fa77785 100644 --- a/test/more/tests/ref/macro.gold +++ b/test/more/tests/ref/macro.gold @@ -1,4 +1,5 @@ +
Header <<ulink url="../../example.hpp">example.hpp</ulink>> foo @@ -21,4 +22,33 @@ REALLY_LONG_MACRO_NAME_WHICH_SHOULD_GET_TRUNCATEDDescription +
+
+
+
+
+
+
+
+
+
+
+
Header <<ulink url="../../example2.hpp">example2.hpp</ulink>> + +REALLY_LONG_MACRO_NAME_WHICH_SHOULD_GET_TRUNCATED + Macro REALLY_LONG_MACRO_NAME_WHICH_SHOULD_GET_TRUNCATED3REALLY_LONG_MACRO_NAME_WHICH_SHOULD_GET_TRUNCATED// In header: <example2.hpp> + +REALLY_LONG_MACRO_NAME_WHICH_SHOULD_GET_TRUNCATEDDescription + +
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/test/more/tests/ref/macro.gold2 b/test/more/tests/ref/macro.gold2 index 1ae5886..2d363a9 100644 --- a/test/more/tests/ref/macro.gold2 +++ b/test/more/tests/ref/macro.gold2 @@ -1,15 +1,16 @@ +
Header <<ulink url="../../example.hpp">example.hpp</ulink>> -foo -FOO +foo +FOO bar -REALLY_LONG_MACRO_NAME_WHICH_SHOULD_GET_TRUNCATED - Macro foo3foo// In header: <example.hpp> +REALLY_LONG_MACRO_NAME_WHICH_SHOULD_GET_TRUNCATED + Macro foo3foo// In header: <example.hpp> fooDescription - Macro FOO3FOO// In header: <example.hpp> + Macro FOO3FOO// In header: <example.hpp> FOODescription @@ -17,8 +18,37 @@ barDescription - Macro REALLY_LONG_MACRO_NAME_WHICH_SHOULD_GET_TRUNCATED3REALLY_LONG_MACRO_NAME_WHICH_SHOULD_GET_TRUNCATED// In header: <example.hpp> + Macro REALLY_LONG_MACRO_NAME_WHICH_SHOULD_GET_TRUNCATED3REALLY_LONG_MACRO_NAME_WHICH_SHOULD_GET_TRUNCATED// In header: <example.hpp> REALLY_LONG_MACRO_NAME_WHICH_SHOULD_GET_TRUNCATEDDescription +
+
+
+
+
+
+
+
+
+
+
+
Header <<ulink url="../../example2.hpp">example2.hpp</ulink>> + +REALLY_LONG_MACRO_NAME_WHICH_SHOULD_GET_TRUNCATED + Macro REALLY_LONG_MACRO_NAME_WHICH_SHOULD_GET_TRUNCATED3REALLY_LONG_MACRO_NAME_WHICH_SHOULD_GET_TRUNCATED// In header: <example2.hpp> + +REALLY_LONG_MACRO_NAME_WHICH_SHOULD_GET_TRUNCATEDDescription + +
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/test/more/tests/ref/macro.xml b/test/more/tests/ref/macro.xml index 2412684..5a59491 100644 --- a/test/more/tests/ref/macro.xml +++ b/test/more/tests/ref/macro.xml @@ -6,6 +6,7 @@ (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) --> +
@@ -24,3 +25,30 @@
+
+
+
+
+
+
+
+
+
+
+
+ + + + +
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file