Compare commits

...

198 Commits

Author SHA1 Message Date
8f51dc6082 Fix some test warnings.
And turn on warnings as errors in Travis.
2016-08-19 11:41:19 +01:00
79deac97dd Merge branch 'develop' 2016-08-17 12:11:13 +01:00
e92f7d86c1 Remove array_constructor.
I was using SFINAE for everything because some old compilers had issues.
But that's hopefully in the distant past now.
2016-08-14 20:55:40 +01:00
93a33ba15f Remove a couple of unneeded includes. 2016-08-14 20:55:40 +01:00
ad353c8e3d Move some of the includes up into allocate.hpp 2016-08-14 20:55:40 +01:00
09717ffca4 Remove a few unnecessary internal includes. 2016-08-14 20:55:40 +01:00
ce4b840299 Map/set details types in individual headers. 2016-08-14 20:55:40 +01:00
5a8df0ebe4 Hopefully a bit more readable. 2016-08-14 20:55:40 +01:00
6029d1cfd0 Trim down node_tmp code. 2016-08-14 20:55:40 +01:00
3fe46a1769 Cleaner emplace_impl in equivalent. 2016-08-14 20:55:40 +01:00
5490bcfe95 Remove node_tmp overload of add_node. 2016-08-14 20:55:40 +01:00
078c562b6c Pull some common code into a function. 2016-08-14 20:55:40 +01:00
88612a8be4 Less faffing around with node_constructor. 2016-08-14 20:55:40 +01:00
37a6903831 Move node construction into allocate.hpp 2016-08-14 20:55:40 +01:00
8017d9e684 Change how node construction works.
Split node_constructor into two classes, one for constructing a node
without a value, and then another for holding it once the value is
constructed.

Do the work of constructing values in convenience functions in
allocate.hpp (construct_value_generic, construct_value, construct_pair).
2016-08-14 20:55:40 +01:00
609ae6cb4e Expand out fill_buckets. 2016-08-14 20:55:40 +01:00
603f785739 Merge branch 'develop' 2016-08-14 20:51:44 +01:00
992f9ccf21 Turn off memory sanitizer on travis.
It's not working at all.
2016-08-14 20:39:46 +01:00
e250fb44f6 Merge local develop branch develop
Oops, I merged the wrong 'develop' branch into master. Luckily, there's
not much of a difference, so I'm resolving the merge here, and will
merge into master soon.
2016-08-14 20:02:13 +01:00
9767d86d97 Merge branch 'develop' 2016-08-14 19:59:22 +01:00
7687c99708 Disable clang c++03 memory sanitizer tests. 2016-08-04 13:35:48 +01:00
81cc773013 Try to fix mem/std11 toolset. 2016-08-04 13:35:48 +01:00
cdb887e880 Clean up a memory leak in a test. 2016-08-04 13:35:47 +01:00
041fee64df Don't stop Boost.Build on error. 2016-08-04 13:35:46 +01:00
e3dd1f276e Use clang and gcc's sanitizers in travis. 2016-08-03 14:24:52 +01:00
0769ecd70d Some more checks.
The intel-linux failures I'm getting now are odd. This find test is
failing for iterator, but not const_iterator. So maybe it's a problem
with the iterator object. The failures I was getting before have
disappeared, so I'm not sure about that.
2016-07-29 12:19:50 +01:00
2be69b3eb9 A little more information in the find_tests.
Now the intel-linux tester that was failing for erase_tests is passing,
but has started failing for find_tests instead. Oddly the test for
non-const find is failing, but the const find is fine - this doesn't
make much sense as they should be the same. Not sure, but it suggests
the problem might be in the way iterators are handled, rather than the
data structure?

Checking the iterators before checking that the keys are equal in order
to tell which part of the test is failing.
2016-07-27 06:51:05 +01:00
bc601e34d2 More info on test failure on intel-linux.
The count check is reporting errors, but everything else appears to work
okay.
2016-07-25 15:03:39 +01:00
79e39d9d43 Copy build changes from the develop branch. 2016-07-03 21:36:14 +01:00
6bc57bd398 Typo 2016-07-03 08:46:40 +01:00
1bca2df642 Always explicitly specify standard for travis. 2016-07-03 08:42:25 +01:00
59cbe3d483 Also move exception tests into test/Jamfile.v2
Moving the tests successfully restored the test results, so do it for
the exception tests as well.
2016-07-03 08:42:17 +01:00
21f2522695 Try running the tests from unordered/test. 2016-07-02 22:11:43 +01:00
3720b0be58 Try creating a project for test.
For some reason the unordered test results are not showing up any more.
This is odd, as when I try locally they do run. I don't know why this
is, but it's possible that it's because there isn't an actual project in
the test directory, so try adding one.
2016-07-01 11:12:29 +01:00
413b45a62e Merge remote-tracking branch 'origin/develop' 2016-06-03 00:00:58 +01:00
7b8e3d01de Use argument SFINAE instead of return SFINAE 2016-06-03 00:00:51 +01:00
b4a3c6f460 Fix exception safety in assignment for multimap/multiset.
The assignment code seemed like a bit of a premature optimization, I
replaced it with a slightly slower but much simpler implementation.
2016-05-30 15:02:04 +01:00
1d4845d6b8 Stop using predef in test. 2016-05-26 22:39:47 +01:00
c26acdba15 Travis 2016-05-26 22:31:43 +01:00
3f42a56bae Remove old deprecated warning. 2016-05-26 09:25:10 +01:00
144a0c1791 Remove BOOST_NO_STD_DISTANCE workaround. 2016-05-26 09:24:25 +01:00
cc2b1a1ef1 Stop using deprecated boost::iterator. 2016-05-26 09:24:21 +01:00
84dd473a5d Merge remote-tracking branch 'origin/develop' 2015-02-22 15:12:28 +00:00
f014802eb6 Release note for pull request #4. 2015-02-22 15:08:46 +00:00
68eb654e7a Merge pull request #4 from tempoz/patch-2
Bounds-check after arithmetic is complete
2014-12-09 01:04:30 +00:00
3a507b4e39 Bounds-check after arithmetic is complete
double_to_size can return std::numeric_limits<size_t>max(), so we cannot add 1 to the return value of double_to_size. That addition should be done while still working with a double, as can be seen being done on line 850 of this file.
This was uncovered by Coverity, and addresses Coverity issues CID13443 and CID12664
2014-12-08 16:38:38 -05:00
0273ec59d7 Fix Visual C++ 9.0 workaround. 2014-12-03 18:28:40 +00:00
9090d87725 Restore ampersand workaround for Visual C++ 9 2014-11-16 10:01:29 +00:00
8ccde2e5a1 Move the allocators after copying the hash functions.
Just in case the hash functions throw.
2014-11-09 23:44:16 +00:00
31211a607f Remove assertion that used moved allocator. Fixes #10777. 2014-11-09 23:35:35 +00:00
56ab93d296 Merge pull request #3 from awulkiew/fix/iterators
Remove template patameters from friend declarations in interator.
2014-11-09 15:14:02 +00:00
1d8855da27 Remove template patameters from friend declarations in interator<>. 2014-11-09 13:36:27 +01:00
df5a7538b1 Changelog 2014-11-08 22:22:12 +00:00
0cedaf7ad6 Rename iterator typedef to n_iterator. 2014-11-08 22:22:11 +00:00
b4795f414d Remove unneeded ConstNodePointer template parameters. 2014-11-08 22:22:11 +00:00
2c9d209eef Remove incorrect changelog note.
A minor change that is not actually in this release, will be in the next one.
Probably too late to rebuild the documenation.
2014-11-02 17:35:05 +00:00
a81c86a90e Remove use of operator&.
Also reactivate operator& for minimal test classes. Apparently I
disabled them because of a problem in a type trait, but I'm not seeing
that now. Maybe it will appear on other compilers.
2014-10-26 22:21:12 +00:00
bf0f90ff03 Merge branch 'develop' 2014-10-26 12:18:38 +00:00
7c6f1ef227 Changelog 2014-10-26 12:17:58 +00:00
99985bb1b2 Fix pointer types in iterators.
https://svn.boost.org/trac/boost/ticket/10672
2014-10-22 22:03:32 +01:00
8c5aa5086d Initialize data_ in value_base default constructor
This means data_ should get initialized in the default constructor for boost::unordered::detail::unique_node (and any other inheritors), as this constructor will be called there.

This uninitialized data member was reported by Coverity (CID 49445), which unfortunately does not seem to have any convenient way to publicly, globally address issues.
2014-10-22 21:27:27 +01:00
b1232d8061 Revert some changes so that I can merge to master.
Revert "Rename iterator typedef to n_iterator." and "Combine some of the
headers."

This reverts commits: 2f6b81d8c1 and
e1b39bbbfb.
2014-10-22 21:24:36 +01:00
2f6b81d8c1 Rename iterator typedef to n_iterator. 2014-08-19 16:41:10 +01:00
e1b39bbbfb Combine some of the headers. 2014-08-19 16:41:10 +01:00
6b7cecb9d3 Workaround initialiser list bug in gcc 4.4. 2014-08-02 03:11:44 +01:00
79dcf7cbe8 Merge branch 'develop' 2014-07-28 23:33:28 +01:00
d4702754b7 The correct release notes.
The ones I entered were for hash.
2014-07-27 18:01:00 +01:00
98d90f26d7 Merge branch 'develop' 2014-07-27 12:20:58 +01:00
b97ceb6442 Release notes. 2014-07-27 12:20:56 +01:00
c18c645b92 Merge remote-tracking branch 'origin/develop' 2014-07-27 11:59:55 +01:00
15cb6d7d1b Tweak warning flags in tests. 2014-07-14 21:49:58 +01:00
2f5d98a0cd Don't use allocator to construct/destroy anything other than elements.
As specified in 23.2.1.3.
2014-07-12 19:12:46 +01:00
2216c987a0 Fixed direct use of allocator. 2014-07-11 09:13:47 +01:00
86d4d21250 Make value_base a member of pointer nodes. 2014-07-11 08:40:07 +01:00
3eb2355182 Merge branch 'develop' 2014-06-30 10:43:47 +01:00
9440395330 Fix swap link. 2014-06-16 22:45:04 +01:00
034f2c3779 Update metadata. 2014-06-16 22:43:54 +01:00
e93f5b0971 Update link to swap. 2014-06-08 15:33:40 +01:00
8c6f3e910b Merge branch 'develop' 2014-03-25 22:05:25 +00:00
78bd2c0736 Fix map allocators in introduction. Fixes trac #9719. 2014-03-11 03:48:26 +00:00
4e6ce91dd0 Regenerate libraries.json with latest script. 2014-02-27 22:46:07 +00:00
850d69738b Switch to latest meta/libraries.json 2014-02-27 22:30:01 +00:00
9c62f83e74 Add maintainers to metadata. 2014-02-24 22:22:09 +00:00
99fdce0b4d Fix policy typedefs. 2014-02-24 16:54:12 +00:00
06b6418044 Add metadata 2014-02-23 14:30:21 +00:00
57819d1dd9 Always use prime policy for integers. Fixes trac #9282. 2014-02-23 10:16:14 +00:00
80f3376894 Merge branch 'develop' - clean up warnings. 2014-02-11 08:10:13 +00:00
94071cc6e8 Clean up warnings. Fixes trac #9377. 2014-01-26 22:57:24 +00:00
038550a9df Fix some issues tests, and git tweak.
Merge branch 'develop'
2014-01-26 15:40:01 +00:00
9ca8c691ac Ignore html build files. 2014-01-26 13:44:38 +00:00
a4881436d2 Disable forward_as_tuple test for older Visual C++. 2014-01-23 22:49:05 +00:00
70190b3aa2 Disable test for compilers that emulate old Visual C++. 2014-01-15 00:04:13 +00:00
8ae166a2c3 Tweak compiler checks in unnecessary_copy_tests.
I'm running these tests by default now, which will probably break
several compilers, so I'll need to add extra conditions later.
2014-01-15 00:00:01 +00:00
7d0c6d2425 Unused typedef. 2013-12-15 17:11:26 +00:00
5995e5521f Account for extra moves/copies when using Visual Age. 2013-12-15 17:11:26 +00:00
59c83ab942 Reintroduce std::move test.
There used to be a std::move test here, but it was changed to
boost::test for a wider range of testing, but I'd quite like to test
with std::move regardless.
2013-12-15 17:11:25 +00:00
0a552a47cb Disable test for Visual C++ 12. 2013-12-15 17:11:25 +00:00
3b5cf359e7 Merge branch 'master' into develop
Using 'ours' strategy, so nothing actually changed.
2013-12-07 19:10:39 +00:00
bea92e8842 Merge unordered and hash from trunk.
- Only use Visual C++ pragma with appropriate compilers.
- Working link for Thomas Wang's hash function.
- Updated unordered rationale.
- Fix `unnecessary_copy_tests` for Visual C++ 12.
- Some extra insert tests.


[SVN r86728]
2013-11-16 20:36:27 +00:00
6ca8d5e0d9 Merge Visual C++ 12 fix for Unordered.
[SVN r86551]
2013-11-03 19:20:09 +00:00
9b9a1d21a6 Merge release notes + float hash fix. Ref #8822.
[SVN r86210]
2013-10-08 21:26:30 +00:00
a7c0ddb5b3 Merge unordered to release. Fixes #8851, #8874
Avoid some warnings, and move detail functions into a sub-namespace to avoid
exposing them via. ADL.


[SVN r85388]
2013-08-18 09:44:14 +00:00
c88126e1d2 Merge unordered from trunk.
Add `BOOST_NOEXPECT` to:

- Move constructors (when appropriate)
- Destructors
- Iterators

Also, fix some misleading documentation about the containers' move support.


[SVN r85048]
2013-07-15 21:32:45 +00:00
0c7c7cc6ad Merge some change log entries to release.
[SVN r84497]
2013-05-25 15:53:49 +00:00
bd10a8b5aa Merge initial unordered use of noexcept + friends.
Still more to come, hopefully in time for the release.


[SVN r84304]
2013-05-16 22:15:42 +00:00
0221f1a9bd Unordered: Merge assign fix.
[SVN r82651]
2013-01-27 23:10:29 +00:00
34b69e67ee Unordered: Merge test tweaks + inspect fixes from trunk.
[SVN r81922]
2012-12-13 22:39:44 +00:00
654fed166a Unordered: Remove and update various deprecated things.
[SVN r81727]
2012-12-05 22:06:57 +00:00
981f1e2acb Unordered: Merge code clean up.
[SVN r81358]
2012-11-15 13:43:37 +00:00
81897a6469 Unordered: Fix erasing ranges, and some tests. Fixes #7471
[SVN r80958]
2012-10-11 17:29:19 +00:00
ced2139eea Unordered/Hash: Merge change log.
[SVN r80778]
2012-09-30 11:58:06 +00:00
0a8037243b Unordered: Merge slightly simpler implementation.
[SVN r80632]
2012-09-22 17:28:55 +00:00
a0ceefc91a Unordered: Merge from trunk.
Faster assign, plus simplified some of the implementation.


[SVN r80558]
2012-09-17 18:53:30 +00:00
05f7c37f54 Unordered: Merge tests to release
[SVN r80435]
2012-09-07 19:51:10 +00:00
d5971171da Unordered: Merge from trunk.
- Some changes to the internals, including reverting some of the
  recent changes to constructing values which turned out to be
  more bother than it was worth.
- On C++11 compilers, better use of `construct` and `destroy`.
- Better testing.


[SVN r80350]
2012-09-01 15:50:36 +00:00
035396e89f Unordered: Merge reference documentation update.
[SVN r80294]
2012-08-28 21:56:18 +00:00
8683332b2c Unordered: Merge from trunk
- Avoid an incorrect MSVC unused variable warning in the tests.
- Remove a `try..catch`.
- Adjust SFINAE use to try to supprt g++ 3.4. Fixes #7175.
- Fix some use of rvalues.
- Extra info in `at_tests`.



[SVN r79868]
2012-08-05 08:34:44 +00:00
d77453b7ad Unordered: Merge allocator fix + improved tests. Fixes #7100.
[SVN r79547]
2012-07-15 23:58:02 +00:00
cf9930fe20 Unordered: Merge updated c++11 config macros.
[SVN r79546]
2012-07-15 23:47:12 +00:00
e30a99d2fc Unordered: Merge some of the older changes from trunk.
Code reorganization, simpler tests, better use of Boost.Move.


[SVN r79545]
2012-07-15 23:44:41 +00:00
c788780792 Unordered: Merge msvc 11 fix from trunk.
[SVN r78853]
2012-06-07 19:47:01 +00:00
e1416d0a3e Unordered: Fix bcp namespace fix. Fixes #6905.
[SVN r78534]
2012-05-21 22:08:19 +00:00
808f1f939f Unordered: Merge unordered from trunk.
- Activate `std::allocator_traits` for gcc 4.7 and Visual C++ 11.
- Implement variadic construct in `boost::unordered::detail::allocator_traits`
  when variadics, rvalue references and SFINAE expression are available.
- Use variadic construct from `allocator_traits`, or when not available move
  the logic for constructing `value_type` to a lower level, so the container
  code is a bit simpler.
- Avoid `-Wshadow` warnings. Fixes #6190.
- Implement `reserve`. Fixes #6857.


[SVN r78432]
2012-05-12 08:14:05 +00:00
880d778ab6 Unordered: Missing revision from last merge.
[SVN r78320]
2012-05-03 22:29:25 +00:00
a8cd8cdd0b Unordered/Hash: Merge from trunk.
[SVN r78319]
2012-05-03 22:05:21 +00:00
fa3d93ddbc Unordered: Merge to release. Fixes #6522.
Fixes undefined macros, removes some unused code and fix some potential issues
for when `std::allocator_traits` is used.


[SVN r76943]
2012-02-07 20:48:50 +00:00
5622afdafa Iostreams: Merge spelling fix.
[SVN r76787]
2012-01-29 22:54:03 +00:00
63d56953af Unordered: Merge move changes. Fixes #6311.
[SVN r76531]
2012-01-15 20:22:15 +00:00
280b1971b6 Unordered: merge from trunk.
[SVN r75908]
2011-12-11 21:39:18 +00:00
abc556950b Unordered: Remove support for TR1 tuples. Fixes #6111.
[SVN r75450]
2011-11-12 12:01:34 +00:00
a8f75b7cea Merge to release several changes for 1.48.
[SVN r75293]
2011-11-04 02:31:36 +00:00
1f111edec8 Merge unordered+hash documentation updates.
[SVN r75015]
2011-10-17 20:23:27 +00:00
8591c1f180 Unordered: merge from trunk.
[SVN r74932]
2011-10-12 22:30:02 +00:00
50e8df5e12 Unordered: Merge from trunk.
Anotehr overhaul. Can now use `void_pointer` for links between nodes, although
it doesn't as I don't think `void_pointer` support is strong enough in existing
allocators.

Also no longer relies on using base pointers for custome pointer types.  And
scaled back member function detection to just detect if an allocator has a
member, not what its signature is. I found that the trait could be confused by
ambiguous overloads. This might be fixable.

Better documentation of C++11 compliance to come.


[SVN r74859]
2011-10-09 18:30:10 +00:00
17ba6c9916 Unordered: Merge from trunk.
Remove some workarounds for old compilers, some documentation updates and tweak
some tests for problem compilers.


[SVN r74469]
2011-09-19 18:22:18 +00:00
0618d01f86 Unordered: Move from trunk.
[SVN r74308]
2011-09-08 07:33:34 +00:00
5867994b8c Unordered: Merge from trunk
- Remove use of BOOST_DEDUCED_TYPENAME and BOOST_UNORDERED_PAIR_CAST, it's
  unlikely that the compilers which require them will be able to cope with the
  new version of unordered.
- Use the old equality algorithm if BOOST_UNORDERED_DEPRECATED_EQUALITY is
  defined.
- Use SFINAE to control which overloads of `construct_impl` are available.
  Fixes problems with differing overload resolution on different compilers.
- Support for piecewise pair construction.
- Only support the old variadic pair construction when
  BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT is defined (also fixed some bugs).
- Avoid instantiating BOOST_RV_REF for non-classes.
- Support optional allocator member functions for compilers with SFINAE
  expressions and Visual C++ 9.0/10.0
- Follow boost macro naming conventions.
- Improved portability for `allocator_traits` emulation.

Current compiler support:

- Full support for GCC 4.4+, Visual C++ 9.0+, Clang.
- All other compilers odn't support optional allocator members.
- No other errors for GCC 3.4.6+, Visual C++ 8.0, Intel, Pathscale.
- Visual Age has a compile error if `select_on_container_copy_construction`
  isn't `const` (it should ignore it).
- `select_on_container_copy_construction` detection doesn't work on Sun.
- `unnecessary_copy_tests` is failling for vacpp on AIX, but not on linux.
- Warnings causing failures for Visual C++ with STLport and WM5.


[SVN r74234]
2011-09-04 19:37:45 +00:00
f6f19aaaaa Unordered: Merge from trunk.
Portability fixes, and fix some issues with constructing std::pair.


[SVN r74101]
2011-08-28 11:26:38 +00:00
a4372314c2 Unordered: Merge to release.
Using Boost.Move and better C++11 support.


[SVN r73987]
2011-08-21 19:19:12 +00:00
3fd5635d7d Unordered: Fix some overly strict tests.
[SVN r70443]
2011-03-23 00:07:17 +00:00
147181530d Add copy constructors and assignment operators when using rvalue references. Fixes #5119.
[SVN r69469]
2011-03-02 08:47:34 +00:00
54f9626c12 Merge unordered from trunk.
- Avoid using operator& with the value type.
- More comments in headers.
- Remove old clang workaround.
- Adjust use of inline to make Borland a little happier.
- Avoid `-Wconversion` warnings.


[SVN r67663]
2011-01-04 23:05:55 +00:00
dc8e65043b Merge fix for unordered container insertion bug.
[SVN r66151]
2010-10-23 12:02:18 +00:00
8b4c480d47 Merge unordered build and documentation tweaks.
[SVN r63503]
2010-07-01 21:42:52 +00:00
70ca44b503 Merge unordered.
[SVN r62610]
2010-06-08 23:23:43 +00:00
795d9f0aa7 Support for clang.
[SVN r61640]
2010-04-28 08:23:41 +00:00
ec97640b1b Merge some link fixes and release notes.
[SVN r61474]
2010-04-21 23:00:35 +00:00
d3ca85bdbd Merge throw_exception use in unordered.
[SVN r61063]
2010-04-05 08:08:25 +00:00
fe2a6c521b Merge from trunk.
- Add `quick_erase` for unordered. `erase_return_void` is now deprecated.
   Fixes #3966
 - Avoid collision between 0 and 0.5. Fixes #4038


[SVN r60980]
2010-03-31 21:39:07 +00:00
958738c7af Merge a warning fix for unordered.
[SVN r60668]
2010-03-17 00:34:26 +00:00
3fb7d15f5b Merge hash and unordered from trunk.
- Replace uses of deprecated C++0x macros
 - Set length of primes inside template on Sun C++. Fixes #3854
 - Missing newline at end of file.



[SVN r59911]
2010-02-25 19:05:01 +00:00
2b212d7c49 Merge unordered documentation.
[SVN r58844]
2010-01-09 17:17:53 +00:00
aa0e8eedd2 Merge unordered changes.
[SVN r58802]
2010-01-08 05:39:54 +00:00
f962857e68 Merge unordered.
[SVN r58605]
2009-12-30 22:17:48 +00:00
02bf8f288e Merge unordered and hash.
Improved Codegear support in unordered.
Another warning suppression in hash.


[SVN r58223]
2009-12-07 19:26:26 +00:00
144d8963a3 Merge unordered.
Warning fixes, support for incomplete types and tweak some test.


[SVN r57998]
2009-11-28 11:40:08 +00:00
f709c16d70 Merge [56844]: Correct macro checks for initializer lists.
[SVN r57801]
2009-11-20 09:16:36 +00:00
a3e57838ed Merged revisions 57126,57139,57150-57153 via svnmerge from
https://svn.boost.org/svn/boost/trunk

........
  r57126 | danieljames | 2009-10-24 12:56:30 +0100 (Sat, 24 Oct 2009) | 1 line
  
  Update the intel compile flags.
........
  r57139 | danieljames | 2009-10-24 18:53:03 +0100 (Sat, 24 Oct 2009) | 1 line
  
  Fix unordered for intel strict.
........
  r57150 | danieljames | 2009-10-25 10:54:28 +0000 (Sun, 25 Oct 2009) | 1 line
  
  Fix the intel strict flag.
........
  r57151 | danieljames | 2009-10-25 10:54:53 +0000 (Sun, 25 Oct 2009) | 1 line
  
  Remove insert empty initializer lists, as there's a bug in gcc.
........
  r57152 | danieljames | 2009-10-25 10:55:08 +0000 (Sun, 25 Oct 2009) | 1 line
  
  Slightly rearrange the unordered container headers so that prev_prime is defined before it's used.
........
  r57153 | danieljames | 2009-10-25 10:55:27 +0000 (Sun, 25 Oct 2009) | 1 line
  
  Remove 'grouped' from hash_table as it isn't used and is a bit confusing.
........


[SVN r57179]
2009-10-27 19:39:33 +00:00
2221c8334e Merge a couple of documentation changes.
Merged revisions 56988-56989 via svnmerge from 
https://svn.boost.org/svn/boost/trunk

........
  r56988 | danieljames | 2009-10-18 21:18:28 +0100 (Sun, 18 Oct 2009) | 1 line
  
  Add release notes for unordered.
........
  r56989 | danieljames | 2009-10-18 21:18:43 +0100 (Sun, 18 Oct 2009) | 1 line
  
  Mention that image attributes are supported.
........


[SVN r57028]
2009-10-20 23:13:33 +00:00
584eaad67a A couple of bug fixes for unordered containers.
Merged revisions 57005-57006 via svnmerge from 
https://svn.boost.org/svn/boost/trunk

........
  r57005 | danieljames | 2009-10-19 20:24:33 +0100 (Mon, 19 Oct 2009) | 6 lines
  
  Use normal emplace implementation for emplace_hint and insert with hint.
  
  There's a bug in the emplace_hint implementation for unordered
  containers with equivalent keys. Since my tests missed it, I'm just
  going to use the normal emplace implementation until I write better
  tests.
........
  r57006 | danieljames | 2009-10-19 20:32:09 +0100 (Mon, 19 Oct 2009) | 1 line
  
  Fix allocator for construct from initializer list.
........


[SVN r57027]
2009-10-20 23:05:28 +00:00
14e09a5456 rm cmake from the release branch before it goes out broken. Policy dictates that you never commit to release, you commit to trunk and merge to release.
[SVN r56941]
2009-10-17 01:10:45 +00:00
06b0b1d31c Merge some documentation changes and inspect fixes.
Merged revisions 55370,55729,56440,56570-56571,56603,56697-56699 via svnmerge from 
https://svn.boost.org/svn/boost/trunk

........
  r55370 | danieljames | 2009-08-02 19:18:14 +0100 (Sun, 02 Aug 2009) | 1 line
  
  Pass through more elements in doxygen2boostbook. Refs #3309.
........
  r55729 | danieljames | 2009-08-23 11:07:25 +0100 (Sun, 23 Aug 2009) | 3 lines
  
  Add depencies on doxygen documentation to standalone documentation targets.
  
  This seems to be needed for building pdfs.
........
  r56440 | danieljames | 2009-09-27 20:11:39 +0100 (Sun, 27 Sep 2009) | 1 line
  
  Fix silly error in doxygen test file.
........
  r56570 | danieljames | 2009-10-04 11:37:36 +0100 (Sun, 04 Oct 2009) | 1 line
  
  Clean up some unordered TODOs.
........
  r56571 | danieljames | 2009-10-04 11:37:56 +0100 (Sun, 04 Oct 2009) | 1 line
  
  Detab.
........
  r56603 | danieljames | 2009-10-05 22:29:39 +0100 (Mon, 05 Oct 2009) | 1 line
  
  Various inspect fixes.
........
  r56697 | danieljames | 2009-10-10 14:00:28 +0100 (Sat, 10 Oct 2009) | 1 line
  
  Add forwarding html file for accumulators.
........
  r56698 | danieljames | 2009-10-10 14:01:14 +0100 (Sat, 10 Oct 2009) | 1 line
  
  Missing newline.
........
  r56699 | danieljames | 2009-10-10 14:01:30 +0100 (Sat, 10 Oct 2009) | 1 line
  
  Add copyright to boostbook reference xml.
........


[SVN r56702]
2009-10-10 14:53:46 +00:00
3529bc00dc Merge unordred changes.
Merged revisions 56441,56461,56468,56557-56562 via svnmerge from 
https://svn.boost.org/svn/boost/trunk

........
  r56441 | danieljames | 2009-09-27 20:12:04 +0100 (Sun, 27 Sep 2009) | 1 line
  
  Try supporting reference parameters in pairs. Probably not required.
........
  r56461 | danieljames | 2009-09-29 00:06:03 +0100 (Tue, 29 Sep 2009) | 1 line
  
  Remove the optimization for std::pair with a key reference. It'll be too much hassle to get a very unusual use case to work on all compilers.
........
  r56468 | danieljames | 2009-09-29 08:46:44 +0100 (Tue, 29 Sep 2009) | 1 line
  
  Just remove the test since the test itself doesn't work on most compilers.
........
  r56557 | danieljames | 2009-10-03 17:40:26 +0100 (Sat, 03 Oct 2009) | 1 line
  
  Fix the iterator category.
........
  r56558 | danieljames | 2009-10-03 17:40:53 +0100 (Sat, 03 Oct 2009) | 2 lines
  
  Update reference docs to latest version of draft standard and fill in
  some missing details.
........
  r56559 | danieljames | 2009-10-03 17:41:11 +0100 (Sat, 03 Oct 2009) | 1 line
  
  Stricter insert exception tests.
........
  r56560 | danieljames | 2009-10-03 17:41:32 +0100 (Sat, 03 Oct 2009) | 1 line
  
  Insert using initializer lists.
........
  r56561 | danieljames | 2009-10-03 17:42:00 +0100 (Sat, 03 Oct 2009) | 1 line
  
  Update the unordered rationale.
........
  r56562 | danieljames | 2009-10-03 17:42:20 +0100 (Sat, 03 Oct 2009) | 1 line
  
  Make sure inserting from a range of types other than the value type is better tested.
........


[SVN r56700]
2009-10-10 13:52:53 +00:00
1e7fe6a2d0 New version of Boost.Unordered
Merged revisions 55470,55877-55878,55901-55902,55921-55922,55990-55992,56009-56010,56329,56346-56349,56362-56363,56374 via svnmerge from 
https://svn.boost.org/svn/boost/trunk

........
  r55470 | danieljames | 2009-08-08 19:50:00 +0100 (Sat, 08 Aug 2009) | 1 line
  
  Remove empty svn:mergeinfo properties. This should reduce the amount of differences between trunk and release.
........
  r55877 | danieljames | 2009-08-30 17:33:42 +0100 (Sun, 30 Aug 2009) | 1 line
  
  Remove allocator_constructor since it's never used.
........
  r55878 | danieljames | 2009-08-30 17:42:28 +0100 (Sun, 30 Aug 2009) | 6 lines
  
  Initial checkin of new version of Boost.Unordered.
  
   - More template use, less preprocessor use.
   - Removed some of the Visual C++ 6 workarounds.
   - Reduced memory use of the main object.
   - Split into smaller headers.
........
  r55901 | danieljames | 2009-08-31 11:39:25 +0100 (Mon, 31 Aug 2009) | 1 line
  
  Detab.
........
  r55902 | danieljames | 2009-08-31 11:39:40 +0100 (Mon, 31 Aug 2009) | 1 line
  
  Remove unnecessary BOOST_DEDUCED_TYPENAMEs
........
  r55921 | danieljames | 2009-08-31 16:33:28 +0100 (Mon, 31 Aug 2009) | 1 line
  
  Remove a few unused parameters.
........
  r55922 | danieljames | 2009-08-31 16:33:49 +0100 (Mon, 31 Aug 2009) | 1 line
  
  Remove 'static' from next_node and node_count. Will hopefully make vacpp happy.
........
  r55990 | danieljames | 2009-09-03 08:36:21 +0100 (Thu, 03 Sep 2009) | 1 line
  
  Combine hash_structure and hash_table_manager.
........
  r55991 | danieljames | 2009-09-03 08:37:14 +0100 (Thu, 03 Sep 2009) | 1 line
  
  Remove some old Visual C++ workarounds.
........
  r55992 | danieljames | 2009-09-03 08:37:30 +0100 (Thu, 03 Sep 2009) | 1 line
  
  Add a small test to see if the tested compilers support out of line template methods.
........
  r56009 | danieljames | 2009-09-04 08:02:28 +0100 (Fri, 04 Sep 2009) | 1 line
  
  Fix link to n2691.
........
  r56010 | danieljames | 2009-09-04 08:03:04 +0100 (Fri, 04 Sep 2009) | 1 line
  
  Move size_ and cached_begin_bucket_ into table, rename hash_table_manager hash_buckets.
........
  r56329 | danieljames | 2009-09-20 22:55:15 +0100 (Sun, 20 Sep 2009) | 2 lines
  
  Since all the compilers support out of line template members use them
  and lots of other things.
........
  r56346 | danieljames | 2009-09-21 22:17:19 +0100 (Mon, 21 Sep 2009) | 1 line
  
  Slightly more consistent variable names. In detail 'n' is now always a node pointer.
........
  r56347 | danieljames | 2009-09-21 22:17:40 +0100 (Mon, 21 Sep 2009) | 1 line
  
  Fix bug where container was reducing the number of buckets.
........
  r56348 | danieljames | 2009-09-21 22:18:01 +0100 (Mon, 21 Sep 2009) | 1 line
  
  Fix a bug that was causing unnecessary rehahes.
........
  r56349 | danieljames | 2009-09-21 22:18:21 +0100 (Mon, 21 Sep 2009) | 1 line
  
  Use std::max.
........
  r56362 | danieljames | 2009-09-22 23:39:00 +0100 (Tue, 22 Sep 2009) | 1 line
  
  Another std::max.
........
  r56363 | danieljames | 2009-09-22 23:39:17 +0100 (Tue, 22 Sep 2009) | 1 line
  
  Remove the emplace_hint implementation for unique containers as it isn't really used and seems to be causing sun 5.7 problems.
........
  r56374 | danieljames | 2009-09-24 21:42:19 +0100 (Thu, 24 Sep 2009) | 1 line
  
  Remove temporary test.
........


[SVN r56375]
2009-09-24 21:12:46 +00:00
df1dad5cb6 Merge an unordered documentation change that I missed before.
Merged revisions 54914 via svnmerge from 
https://svn.boost.org/svn/boost/trunk

........
  r54914 | danieljames | 2009-07-12 19:03:35 +0100 (Sun, 12 Jul 2009) | 1 line
  
  Add constructors to the methods for controlling bucket size in unordered containers.
........


[SVN r55211]
2009-07-27 20:46:40 +00:00
1bc3ae3d9d Merge unordered changes, including fixes for Boost.TR1.
Merged revisions 55099-55100,55132,55138,55184-55185 via svnmerge from 
https://svn.boost.org/svn/boost/trunk

........
  r55099 | danieljames | 2009-07-22 23:37:52 +0100 (Wed, 22 Jul 2009) | 1 line
  
  Fix the insert tests when there is a small number of buckets.
........
  r55100 | danieljames | 2009-07-22 23:38:08 +0100 (Wed, 22 Jul 2009) | 1 line
  
  Adjust the unordered defaults so that emplace takes more parameters and less buckets are created by default.
........
  r55132 | danieljames | 2009-07-23 18:53:59 +0100 (Thu, 23 Jul 2009) | 1 line
  
  Remove the emulation of single argument C++0x std::pair constructor.
........
  r55138 | danieljames | 2009-07-23 23:17:20 +0100 (Thu, 23 Jul 2009) | 1 line
  
  Try to work around an odd Visual C++ 8 bug.
........
  r55184 | danieljames | 2009-07-26 19:59:33 +0100 (Sun, 26 Jul 2009) | 1 line
  
  Some extra changelog notes.
........
  r55185 | danieljames | 2009-07-26 20:00:40 +0100 (Sun, 26 Jul 2009) | 1 line
  
  Update the reference documentation to mention that emplace is now emulated.
........


[SVN r55189]
2009-07-26 20:22:48 +00:00
60ecf12779 Add basic copyright/license to keep cmake out of the inspection report
[SVN r55095]
2009-07-22 21:51:01 +00:00
241316e0d9 Misc. unordered changes. Fixes #3082, #3119.
Merged revisions 53505-53506,53525,53550,53552,53614 via svnmerge from 
https://svn.boost.org/svn/boost/trunk

........
  r53505 | danieljames | 2009-05-31 16:50:56 +0100 (Sun, 31 May 2009) | 1 line
  
  Disable incorrect Visual C++ 64-bit warnings. Ref #3082.
........
  r53506 | danieljames | 2009-05-31 16:53:09 +0100 (Sun, 31 May 2009) | 1 line
  
  Remove misplaced visual C++ warning pragma.
........
  r53525 | danieljames | 2009-06-01 07:50:37 +0100 (Mon, 01 Jun 2009) | 1 line
  
  Fix tests for when the library has support for initializer lists but the compiler doesn't.
........
  r53550 | danieljames | 2009-06-01 20:17:49 +0100 (Mon, 01 Jun 2009) | 1 line
  
  Get the type of the initializer_list right.
........
  r53552 | danieljames | 2009-06-01 20:22:27 +0100 (Mon, 01 Jun 2009) | 1 line
  
  Fix the unordered_map declaration in the tutorial. Fixes #3119.
........
  r53614 | danieljames | 2009-06-03 23:48:49 +0100 (Wed, 03 Jun 2009) | 1 line
  
  The move tests pass on 64 bit visual c++.
........


[SVN r53687]
2009-06-06 14:05:54 +00:00
9c43533655 A couple more minor unordered changes.
Merged revisions 53312,53367 via svnmerge from 
https://svn.boost.org/svn/boost/trunk

........
  r53312 | danieljames | 2009-05-27 18:43:22 +0100 (Wed, 27 May 2009) | 1 line
  
  Remove obsolete comment.
........
  r53367 | danieljames | 2009-05-28 23:06:42 +0100 (Thu, 28 May 2009) | 1 line
  
  Remove a couple of old uses of BOOST_NO_INITIALIZER_LISTS.
........


[SVN r53466]
2009-05-30 17:41:05 +00:00
ae09b0dd24 Merge latest changes for unordered. Improved compatability and a few tweaks.
Merged revisions 53127,53253,53256,53311,53314,53316-53318 via svnmerge from 
https://svn.boost.org/svn/boost/trunk

........
  r53127 | danieljames | 2009-05-20 07:43:38 +0100 (Wed, 20 May 2009) | 1 line
  
  Better configuration for boost.unordered.
........
  r53253 | danieljames | 2009-05-25 20:14:07 +0100 (Mon, 25 May 2009) | 3 lines
  
  Add explicit destructors to the unordered containers. Refs #2908.
  
  Isn't really needed but it doesn't hurt.
........
  r53256 | danieljames | 2009-05-25 20:45:23 +0100 (Mon, 25 May 2009) | 1 line
  
  Unordered change log for explicit destructors.
........
  r53311 | danieljames | 2009-05-27 18:42:01 +0100 (Wed, 27 May 2009) | 1 line
  
  Missing changelog entry.
........
  r53314 | danieljames | 2009-05-27 18:44:09 +0100 (Wed, 27 May 2009) | 1 line
  
  Use lightweight_test for unordered.
........
  r53316 | danieljames | 2009-05-27 19:19:32 +0100 (Wed, 27 May 2009) | 1 line
  
  Some workarounds for old versions of Borland.
........
  r53317 | danieljames | 2009-05-27 19:32:22 +0100 (Wed, 27 May 2009) | 1 line
  
  Fix a change accidentally included in the last commit.
........
  r53318 | danieljames | 2009-05-27 19:32:38 +0100 (Wed, 27 May 2009) | 1 line
  
  Remove an unused function.
........


[SVN r53465]
2009-05-30 17:34:12 +00:00
b018f8b173 Second try at merging emplace support.
Note that the previously rolled back commit was [53257], not [52357].

Merged revisions 52393-52394,52397,52884-52885,53255 via svnmerge from 
https://svn.boost.org/svn/boost/trunk

........
  r52393 | danieljames | 2009-04-14 18:23:37 +0100 (Tue, 14 Apr 2009) | 2 lines
  
  Implement full extract_key for compilers without SFINAE and variadic
  templates.
........
  r52394 | danieljames | 2009-04-14 18:23:51 +0100 (Tue, 14 Apr 2009) | 1 line
  
  Use emplace instead of insert in the backend as it's more appropriate.
........
  r52397 | danieljames | 2009-04-14 18:51:34 +0100 (Tue, 14 Apr 2009) | 1 line
  
  Add stream output to the count test helper for unordered.
........
  r52884 | danieljames | 2009-05-10 22:24:41 +0100 (Sun, 10 May 2009) | 19 lines
  
  Cherrypick some unordered container changes from sandbox. Not including
  anything which depends on the new move library.
  
  ------------------------------------------------------------------------
  r52746 | danieljames | 2009-05-03 11:12:30 +0100 (Sun, 03 May 2009) | 1 line
  
  Merge latest unordered container changes.
  ------------------------------------------------------------------------
  r52747 | danieljames | 2009-05-03 11:15:35 +0100 (Sun, 03 May 2009) | 4 lines
  
  Put the C++0x emplace implementations before the non-C++0x versions.
  
  I'm going to change the non-C++0x to be macro heavy emulations of the
  C++0x versions, so this will put the readable version first.
  ------------------------------------------------------------------------
  r52748 | danieljames | 2009-05-03 11:15:44 +0100 (Sun, 03 May 2009) | 1 line
  
  Refactor the unordered implementation a tad, to make implementing emplace less painful.
  ------------------------------------------------------------------------
........
  r52885 | danieljames | 2009-05-10 22:25:09 +0100 (Sun, 10 May 2009) | 1 line
  
  Merge emplace support for sandbox - but without move support.
........
  r53255 | danieljames | 2009-05-25 20:45:06 +0100 (Mon, 25 May 2009) | 1 line
  
  Unordered change log.
........


[SVN r53328]
2009-05-27 21:31:08 +00:00
0b4241833d Rollback [52357] as it depends on macros that aren't in release.
Rolled back revisions 52393-52394,52397,52884-52885,53127,53255 via svnmerge from 
https://svn.boost.org/svn/boost/trunk


[SVN r53277]
2009-05-26 09:56:59 +00:00
e911a8011b Merge unordered changes:
* Support emplace for all compilers.
 * Better configuration of C++0x features for when the appropriate headers
   aren't available.

Merged revisions 52393-52394,52397,52884-52885,53127,53255 via svnmerge from 
https://svn.boost.org/svn/boost/trunk

........
  r52393 | danieljames | 2009-04-14 18:23:37 +0100 (Tue, 14 Apr 2009) | 2 lines
  
  Implement full extract_key for compilers without SFINAE and variadic
  templates.
........
  r52394 | danieljames | 2009-04-14 18:23:51 +0100 (Tue, 14 Apr 2009) | 1 line
  
  Use emplace instead of insert in the backend as it's more appropriate.
........
  r52397 | danieljames | 2009-04-14 18:51:34 +0100 (Tue, 14 Apr 2009) | 1 line
  
  Add stream output to the count test helper for unordered.
........
  r52884 | danieljames | 2009-05-10 22:24:41 +0100 (Sun, 10 May 2009) | 19 lines
  
  Cherrypick some unordered container changes from sandbox. Not including
  anything which depends on the new move library.
  
  ------------------------------------------------------------------------
  r52746 | danieljames | 2009-05-03 11:12:30 +0100 (Sun, 03 May 2009) | 1 line
  
  Merge latest unordered container changes.
  ------------------------------------------------------------------------
  r52747 | danieljames | 2009-05-03 11:15:35 +0100 (Sun, 03 May 2009) | 4 lines
  
  Put the C++0x emplace implementations before the non-C++0x versions.
  
  I'm going to change the non-C++0x to be macro heavy emulations of the
  C++0x versions, so this will put the readable version first.
  ------------------------------------------------------------------------
  r52748 | danieljames | 2009-05-03 11:15:44 +0100 (Sun, 03 May 2009) | 1 line
  
  Refactor the unordered implementation a tad, to make implementing emplace less painful.
  ------------------------------------------------------------------------
........
  r52885 | danieljames | 2009-05-10 22:25:09 +0100 (Sun, 10 May 2009) | 1 line
  
  Merge emplace support for sandbox - but without move support.
........
  r53127 | danieljames | 2009-05-20 07:43:38 +0100 (Wed, 20 May 2009) | 1 line
  
  Better configuration for boost.unordered.
........
  r53255 | danieljames | 2009-05-25 20:45:06 +0100 (Mon, 25 May 2009) | 1 line
  
  Unordered change log.
........


[SVN r53257]
2009-05-25 19:57:04 +00:00
f02cc7775d Long term fix for the incorrect length of prime list.
Merged revisions 52658,52669,52673,52711 via svnmerge from 
https://svn.boost.org/svn/boost/trunk

........
  r52658 | danieljames | 2009-04-29 11:05:17 +0100 (Wed, 29 Apr 2009) | 1 line
  
  Fix the length of the prime number list.
........
  r52669 | danieljames | 2009-04-29 22:43:41 +0100 (Wed, 29 Apr 2009) | 3 lines
  
  Don't test prime_list::length on Visual C++.
  
  Checking the array size doesn't seem to work on it.
........
  r52673 | danieljames | 2009-04-30 06:08:40 +0100 (Thu, 30 Apr 2009) | 1 line
  
  Revert changes to unordered, as the test fails on most compilers.
........
  r52711 | danieljames | 2009-05-01 21:50:32 +0100 (Fri, 01 May 2009) | 5 lines
  
  Use a preprocessor sequence for the primes.
  
  This feels like overkill but it seems to be the most reliable way to ensure
  that the length is correct. I obviously can't be trusted to get it right, and
  the template hack seems to prevent Boost.Range from working.
........


[SVN r53043]
2009-05-16 13:38:37 +00:00
4e6b5de196 tuning up cmakefiles for unordered, utility
[SVN r53008]
2009-05-15 00:21:14 +00:00
fb71e0618d Last minute merge, remove google analytics script tags and fixes #2975.
Merged revisions 52665,52674 via svnmerge from 
https://svn.boost.org/svn/boost/trunk

........
  r52665 | danieljames | 2009-04-29 22:16:10 +0100 (Wed, 29 Apr 2009) | 1 line
  
  Remove google analytics script tags.
........
  r52674 | danieljames | 2009-04-30 06:10:57 +0100 (Thu, 30 Apr 2009) | 1 line
  
  Fix the prime number list length in unordered.
........


[SVN r52707]
2009-05-01 19:00:57 +00:00
694398f0e1 Some small documentation fixes for the release.
Merged revisions 52348-52350 via svnmerge from 
https://svn.boost.org/svn/boost/trunk

........
  r52348 | danieljames | 2009-04-12 11:50:31 +0100 (Sun, 12 Apr 2009) | 1 line
  
  Use a test file that's actually valid C++.
........
  r52349 | danieljames | 2009-04-12 11:50:43 +0100 (Sun, 12 Apr 2009) | 3 lines
  
  Revert support for static mutable variables.
  
  Of course there's no such thing.
........
  r52350 | danieljames | 2009-04-12 11:50:57 +0100 (Sun, 12 Apr 2009) | 1 line
  
  Note change to operator[] in the unordered release notes.
........


[SVN r52351]
2009-04-12 10:54:44 +00:00
ab62d33495 Merged revisions 52224 via svnmerge from
https://svn.boost.org/svn/boost/trunk

........
  r52224 | danieljames | 2009-04-06 23:51:36 +0100 (Mon, 06 Apr 2009) | 1 line
  
  Avoid an unnecessary copy in 'operator[]'
........


[SVN r52346]
2009-04-12 10:25:38 +00:00
b475ba05c0 Merge quickbook and hash changelogs. Tweak gcc detection in container_fwd.hpp
Merged revisions 52084,52245-52246,52304,52320,52323 via svnmerge from 
https://svn.boost.org/svn/boost/trunk

........
  r52084 | danieljames | 2009-03-31 20:43:58 +0100 (Tue, 31 Mar 2009) | 1 line
  
  Changelog for unordered and hash.
........
  r52245 | danieljames | 2009-04-08 06:51:31 +0100 (Wed, 08 Apr 2009) | 5 lines
  
  Detect gcc stdlib for gcc 4.0.1.
  
  For some reason the normal macros aren't defined for the standard
  library that comes with gcc 4.0.1 (although maybe just on BSDs?). So try
  to detect the library for that compiler.
........
  r52246 | danieljames | 2009-04-08 11:56:22 +0100 (Wed, 08 Apr 2009) | 7 lines
  
  Include <utility> for some versions of gcc's library.
  
  Sometimes gcc's <cstddef> doesn't define the C++ macros, so check for it
  and include <utility> in that case. Also remove a workaround from
  container_fwd.hpp
  
  Fixes #2924.
........
  r52304 | danieljames | 2009-04-10 20:25:32 +0100 (Fri, 10 Apr 2009) | 4 lines
  
  Don't use debug containers on darwin.
  
  I'm getting errors from the darwin 4.2 debug containers which appear to
  a problem with its implementation.
........
  r52320 | danieljames | 2009-04-11 08:53:59 +0100 (Sat, 11 Apr 2009) | 1 line
  
  Don't need to include utility now that select_stdlib has been fixed.
........
  r52323 | danieljames | 2009-04-11 09:26:20 +0100 (Sat, 11 Apr 2009) | 1 line
  
  Also don't need to check for _GLIBCXX_CSTDDEF.
........


[SVN r52324]
2009-04-11 08:49:33 +00:00
60e3e96b48 Tweak unordered for some compilers.
Fixes #2756.

Merged revisions 51982-51983,51995 via svnmerge from 
https://svn.boost.org/svn/boost/trunk

........
  r51982 | danieljames | 2009-03-26 07:00:21 +0000 (Thu, 26 Mar 2009) | 3 lines
  
  Revert [51409]
  
  It isn't working on Borland.
........
  r51983 | danieljames | 2009-03-26 07:00:46 +0000 (Thu, 26 Mar 2009) | 1 line
  
  Try to destruct values in a way that all compilers might like.
........
  r51995 | danieljames | 2009-03-26 21:09:51 +0000 (Thu, 26 Mar 2009) | 1 line
  
  Give up and use another macro to destruct values.
........


[SVN r52065]
2009-03-30 17:54:49 +00:00
c0e472755e Merge misc. changes from trunk, mostly minor documentation fixes.
Merged revisions 48412,50921,51042,51369,51386-51387,51506-51507,51668,51802,51804,51881 via svnmerge from 
https://svn.boost.org/svn/boost/trunk

........
  r48412 | danieljames | 2008-08-28 11:23:33 +0100 (Thu, 28 Aug 2008) | 1 line
  
  Fix a typo. Thanks to Jon Biggar.
........
  r50921 | danieljames | 2009-01-31 09:36:38 +0000 (Sat, 31 Jan 2009) | 1 line
  
  Remove executable flag from preprocess.cmd. It was a mistake to add it.
........
  r51042 | danieljames | 2009-02-06 00:04:44 +0000 (Fri, 06 Feb 2009) | 1 line
  
  Ignore some version control files in inspect.
........
  r51369 | danieljames | 2009-02-21 18:49:48 +0000 (Sat, 21 Feb 2009) | 1 line
  
  Minor markup fix in concept check documentation.
........
  r51386 | danieljames | 2009-02-22 11:53:28 +0000 (Sun, 22 Feb 2009) | 1 line
  
  Add index.html file for compose, as our server setup doesn't support index.htm files.
........
  r51387 | danieljames | 2009-02-22 11:53:48 +0000 (Sun, 22 Feb 2009) | 5 lines
  
  Add missing index.html file for MPI and GIL.
  
  All the top level libraries now have index.html files but
  several sub-libraries don't. I'm not sure it's worth adding them as many
  of them don't have appropriate subdirectories anyway.
........
  r51506 | danieljames | 2009-03-01 14:16:00 +0000 (Sun, 01 Mar 2009) | 1 line
  
  Update links to command line invocation.
........
  r51507 | danieljames | 2009-03-01 14:16:24 +0000 (Sun, 01 Mar 2009) | 1 line
  
  Use xpointer attributes in the boost build documentation.
........
  r51668 | danieljames | 2009-03-09 20:56:51 +0000 (Mon, 09 Mar 2009) | 1 line
  
  Redirect to the Trac wiki instead of the old one.
........
  r51802 | danieljames | 2009-03-16 20:21:05 +0000 (Mon, 16 Mar 2009) | 1 line
  
  Use paragraphs inside purpose tags.
........
  r51804 | danieljames | 2009-03-16 20:21:46 +0000 (Mon, 16 Mar 2009) | 1 line
  
  Give the variablelist a margin.
........
  r51881 | danieljames | 2009-03-21 15:35:35 +0000 (Sat, 21 Mar 2009) | 1 line
  
  Fix html.
........


[SVN r51897]
2009-03-22 10:42:48 +00:00
6f45d36d97 Merge hash and unordered changes.
Remove deprecated headers, move hash_fwd.hpp into hash subdirectory. And
several minor internal changes.
Mostly minor internal details.

Merged revisions 51262-51263,51407-51409,51504-51505,51644-51646,51667 via svnmerge from 
https://svn.boost.org/svn/boost/trunk

........
  r51262 | danieljames | 2009-02-15 19:32:04 +0000 (Sun, 15 Feb 2009) | 1 line
  
  Use the new 'boost:' links for the hash, unordered and quickbook documentation.
........
  r51263 | danieljames | 2009-02-15 19:32:19 +0000 (Sun, 15 Feb 2009) | 2 lines
  
  Don't copy images for the standalone hash and unordered documentation, was only
  really required before the libraries were integrated into boost.
........
  r51407 | danieljames | 2009-02-22 23:49:51 +0000 (Sun, 22 Feb 2009) | 1 line
  
  Fix the hash dirname.
........
  r51408 | danieljames | 2009-02-22 23:50:04 +0000 (Sun, 22 Feb 2009) | 1 line
  
  Make copy_buckets and move_buckets member functions - so that calling them is a bit simpler.
........
  r51409 | danieljames | 2009-02-22 23:50:20 +0000 (Sun, 22 Feb 2009) | 1 line
  
  Move some of the data structure classes out of hash table data.
........
  r51504 | danieljames | 2009-03-01 14:15:09 +0000 (Sun, 01 Mar 2009) | 1 line
  
  Add missing return for operator=.
........
  r51505 | danieljames | 2009-03-01 14:15:39 +0000 (Sun, 01 Mar 2009) | 3 lines
  
  Make the sort stable.
  
  Doesn't really matter, but it might as well be.
........
  r51644 | danieljames | 2009-03-08 09:44:51 +0000 (Sun, 08 Mar 2009) | 1 line
  
  Detab.
........
  r51645 | danieljames | 2009-03-08 09:45:11 +0000 (Sun, 08 Mar 2009) | 4 lines
  
  Move hash_fwd into the hash subdirectory.
  
  I should have done this in the last release. But now all of the hash
  implementation is in the hash subdirectory.
........
  r51646 | danieljames | 2009-03-08 09:45:30 +0000 (Sun, 08 Mar 2009) | 3 lines
  
  Remove deprecated headers.
  
  Fixes #2412.
........
  r51667 | danieljames | 2009-03-09 20:56:23 +0000 (Mon, 09 Mar 2009) | 1 line
  
  Update copyright dates in hash and unordered.
........


[SVN r51729]
2009-03-11 22:51:09 +00:00
2e9cf20cd0 Merge PDF build changes from Trunk.
[SVN r51417]
2009-02-23 18:39:32 +00:00
f7c664a359 merge of cmake build files from trunk per beman
[SVN r50756]
2009-01-24 18:57:20 +00:00
0921f8076d Remove a tab.
Merged revisions 50452 via svnmerge from 
https://svn.boost.org/svn/boost/trunk

........
  r50452 | danieljames | 2009-01-03 23:26:00 +0000 (Sat, 03 Jan 2009) | 1 line
  
  Remove a tab.
........


[SVN r50506]
2009-01-07 21:50:23 +00:00
b8e8ffa242 Merge latest hash and unordered developments, and add support for initialiser
lists to config.

Merged revisions 49338,49924-49927,49955,50029,50118 via svnmerge from 
https://svn.boost.org/svn/boost/trunk

........
  r49338 | danieljames | 2008-10-15 10:44:41 +0100 (Wed, 15 Oct 2008) | 2 lines
  
  Revert [49229], it fixes the same problem as [48674].
........
  r49924 | danieljames | 2008-11-24 22:55:14 +0000 (Mon, 24 Nov 2008) | 1 line
  
  Extra tests for equality with different hash functions.
........
  r49925 | danieljames | 2008-11-24 22:55:47 +0000 (Mon, 24 Nov 2008) | 1 line
  
  Document operator==/operator!= as undefined if the equality predicates aren't equivalent.
........
  r49926 | danieljames | 2008-11-24 22:56:04 +0000 (Mon, 24 Nov 2008) | 1 line
  
  Use a larger prime number list.
........
  r49927 | danieljames | 2008-11-24 23:15:55 +0000 (Mon, 24 Nov 2008) | 1 line
  
  Use aligned storage for the value.
........
  r49955 | danieljames | 2008-11-27 11:42:13 +0000 (Thu, 27 Nov 2008) | 1 line
  
  Wild stab at getting destruction working on more compilers.
........
  r50029 | danieljames | 2008-11-29 21:47:55 +0000 (Sat, 29 Nov 2008) | 1 line
  
  Workaround another in-place destruction.
........
  r50118 | danieljames | 2008-12-04 21:30:19 +0000 (Thu, 04 Dec 2008) | 1 line
  
  Add support for initializer lists to config and the unordered containers.
........


[SVN r50451]
2009-01-03 23:18:33 +00:00
07e715fceb Merged revisions 49661-49662,49666,49669,49735,49756,49770,49811 via svnmerge from
https://svn.boost.org/svn/boost/trunk

........
  r49661 | danieljames | 2008-11-09 12:03:45 +0000 (Sun, 09 Nov 2008) | 1 line
  
  Move hash detail headers out of boost/functional/detail.
........
  r49662 | danieljames | 2008-11-09 12:11:50 +0000 (Sun, 09 Nov 2008) | 1 line
  
  Add a forwarding header for container_fwd.hpp
........
  r49666 | danieljames | 2008-11-09 19:12:05 +0000 (Sun, 09 Nov 2008) | 1 line
  
  Avoid comparing default initialised iterators in position_iterator.
........
  r49669 | danieljames | 2008-11-09 21:57:38 +0000 (Sun, 09 Nov 2008) | 2 lines
  
  Add link to the header to the synopsis in reference documentation.
  Refs #2214
........
  r49735 | danieljames | 2008-11-14 12:51:00 +0000 (Fri, 14 Nov 2008) | 1 line
  
  Explicitly specify the template parameters in the unordered container friend, in order to avoid some warnings.
........
  r49756 | danieljames | 2008-11-14 16:11:16 +0000 (Fri, 14 Nov 2008) | 1 line
  
  Use pragmas to suppress a Visual C++ warning.
........
  r49770 | danieljames | 2008-11-15 13:07:29 +0000 (Sat, 15 Nov 2008) | 1 line
  
  Use the new swap library.
........
  r49811 | danieljames | 2008-11-16 23:10:00 +0000 (Sun, 16 Nov 2008) | 1 line
  
  Fix a typo.
........


[SVN r49855]
2008-11-20 22:53:20 +00:00
89ab17cce5 Merge fixes from Trunk.
Fixes #2392.

Change includes of <cmath> to <boost/config/no_tr1/config.hpp>.

Previously if Boost.TR1 was in the include path then including <cmath> pulls in all the new TR1 math functions, which in turn also requires linking to an external library. With auto-linking support this requires that library to have been built and be present in the library search path, even if the actual library under use is header only. 

[SVN r49314]
2008-10-13 09:00:03 +00:00
517e39fc23 Merged revisions 48081-48082,48791,48802-48803,48853 via svnmerge from
https://svn.boost.org/svn/boost/trunk

........
  r48081 | danieljames | 2008-08-11 08:52:37 +0100 (Mon, 11 Aug 2008) | 2 lines
  
  Rename 'emplace' with hint to 'emplace_hint'.
........
  r48082 | danieljames | 2008-08-11 08:53:05 +0100 (Mon, 11 Aug 2008) | 2 lines
  
  More recent version of the working draft.
........
  r48791 | danieljames | 2008-09-15 22:48:46 +0100 (Mon, 15 Sep 2008) | 1 line
  
  Fix a workaround macro.
........
  r48802 | danieljames | 2008-09-16 22:45:53 +0100 (Tue, 16 Sep 2008) | 1 line
  
  Forward headers for the unordered containers.
........
  r48803 | danieljames | 2008-09-16 22:49:41 +0100 (Tue, 16 Sep 2008) | 1 line
  
  Move the unordered headers into the unordered directory.
........
  r48853 | danieljames | 2008-09-18 12:23:12 +0100 (Thu, 18 Sep 2008) | 1 line
  
  Update unordered changelog.
........


[SVN r48854]
2008-09-18 11:30:59 +00:00
93141c26b9 Merge a couple of simple documentation fixes.
Merged revisions 47881-47882 via svnmerge from 
https://svn.boost.org/svn/boost/trunk

........
  r47881 | danieljames | 2008-07-30 10:44:26 +0100 (Wed, 30 Jul 2008) | 1 line
  
  Fix a link and a header.
........
  r47882 | danieljames | 2008-07-30 11:46:27 +0100 (Wed, 30 Jul 2008) | 1 line
  
  Use the correct library page for the asio documentation.
........


[SVN r47900]
2008-07-30 22:29:27 +00:00
dd2a994874 Merge in some small documentation fixes.
Merged revisions 47054,47750,47766,47800,47807,47811-47813 via svnmerge from 
https://svn.boost.org/svn/boost/trunk

........
  r47750 | danieljames | 2008-07-24 11:14:15 +0100 (Thu, 24 Jul 2008) | 2 lines
  
  Remove some old information that's no longer true.
........
  r47766 | danieljames | 2008-07-24 19:16:09 +0100 (Thu, 24 Jul 2008) | 1 line
  
  Link to Igor Zlatkovic's xsltproc packages.
........
  r47800 | danieljames | 2008-07-25 11:24:50 +0100 (Fri, 25 Jul 2008) | 1 line
  
  Fix a link.
........
  r47807 | danieljames | 2008-07-25 18:52:11 +0100 (Fri, 25 Jul 2008) | 1 line
  
  Convert a few 'unacceptable' characters to underscores in generated documentation filenames.
........
  r47811 | danieljames | 2008-07-25 22:13:27 +0100 (Fri, 25 Jul 2008) | 1 line
  
  Avoid some more unacceptable characters.
........
  r47812 | danieljames | 2008-07-25 22:15:39 +0100 (Fri, 25 Jul 2008) | 1 line
  
  Merge asio details from the release branch.
........
  r47813 | danieljames | 2008-07-25 22:25:58 +0100 (Fri, 25 Jul 2008) | 1 line
  
  Fix a typo.
........


[SVN r47819]
2008-07-25 22:47:41 +00:00
6571648bac Remove hash_value for unordered containers.
Merged revisions 47463,47465,47522 via svnmerge from 
https://svn.boost.org/svn/boost/trunk

........
  r47463 | danieljames | 2008-07-15 22:26:54 +0100 (Tue, 15 Jul 2008) | 1 line
  
  Better hash function for unordered containers. Still a bit rubbish.
........
  r47465 | danieljames | 2008-07-15 23:03:15 +0100 (Tue, 15 Jul 2008) | 4 lines
  
  On second thoughts, I'll just completely remove hash_value for ordered
  containers. It's low quality and not very generic (it uses boost::hash for
  mapped values). Should be a painless change.
........
  r47522 | danieljames | 2008-07-18 00:08:32 +0100 (Fri, 18 Jul 2008) | 1 line
  
  Remove a mention of the hash functions which I missed before.
........


[SVN r47523]
2008-07-17 23:33:51 +00:00
f20f72bade Merge some documentation updates and fixes from trunk.
Merged revisions 47364,47402-47403 via svnmerge from 
https://svn.boost.org/svn/boost/trunk

........
  r47364 | danieljames | 2008-07-12 20:32:15 +0100 (Sat, 12 Jul 2008) | 1 line
  
  Fix a PDF link that I missed before. (in static assert)
........
  r47402 | danieljames | 2008-07-13 20:42:56 +0100 (Sun, 13 Jul 2008) | 2 lines
  
  Note that emplace is only available on a few compilers.
........
  r47403 | danieljames | 2008-07-13 21:07:45 +0100 (Sun, 13 Jul 2008) | 2 lines
  
  Update the implementation details.
........


[SVN r47405]
2008-07-13 21:08:33 +00:00
4e4f99d51f Make the unordered constructors from allocators explicit.
And clean of the FNV-1 example & documentation a little.

Merged revisions 47085,47132,47143-47146 via svnmerge from 
https://svn.boost.org/svn/boost/trunk

........
  r47085 | danieljames | 2008-07-04 23:57:20 +0100 (Fri, 04 Jul 2008) | 4 lines
  
  Require explicit conversion from allocators.
  
  (Not what it says in the draft standard, but I think that might be a defect).
........
  r47132 | danieljames | 2008-07-06 13:41:09 +0100 (Sun, 06 Jul 2008) | 2 lines
  
  'Bias' should be 'basis'.
........
  r47143 | danieljames | 2008-07-06 22:06:52 +0100 (Sun, 06 Jul 2008) | 1 line
  
  Clean up the FNV-1 comments.
........
  r47144 | danieljames | 2008-07-06 22:07:31 +0100 (Sun, 06 Jul 2008) | 1 line
  
  I've only got one hash function for release, so no need for its own directory.
........
  r47145 | danieljames | 2008-07-06 22:08:11 +0100 (Sun, 06 Jul 2008) | 1 line
  
  Remove the hash_functions directory (for now).
........
  r47146 | danieljames | 2008-07-06 22:29:47 +0100 (Sun, 06 Jul 2008) | 1 line
  
  Update the docs for the new location of FNV-1.
........


[SVN r47150]
2008-07-06 22:00:18 +00:00
56b9e0da1a Merge some small fixes from trunk.
Merged revisions 46740,46742,47002,47040 via svnmerge from 
https://svn.boost.org/svn/boost/trunk

........
  r46740 | danieljames | 2008-06-26 20:20:56 +0100 (Thu, 26 Jun 2008) | 1 line
  
  Fix a character encoding error.
........
  r46742 | danieljames | 2008-06-26 20:25:38 +0100 (Thu, 26 Jun 2008) | 6 lines
  
  Give the asio documentation its own target.
  
  The asio documentation is built with the rest of the combined documentation but
  is really separate. So give it its own target so that separate parts can be
  built separately.
........
  r47040 | danieljames | 2008-07-03 15:34:56 +0100 (Thu, 03 Jul 2008) | 1 line
  
  Workaround for some template syntax not supported in old versions of Visual C++ 6.5
........


[SVN r47078]
2008-07-04 17:04:47 +00:00
4f27a146ef Merge from trunk. Fix some inspect errors, try to avoid instantiating the
equality operators when not required, and some bookkeeping.

................
  r42539 | danieljames | 2008-01-06 17:48:11 +0000 (Sun, 06 Jan 2008) | 2 lines
  
  Add the unordered library to the maintainers list.
................
  r46579 | danieljames | 2008-06-21 16:32:11 +0100 (Sat, 21 Jun 2008) | 10 lines
  
  Define unordered containers' friend functions outside of the class.
  
  On some compilers, friend functions are being instantiated when the main class
  is explicitly instantiated. This is slightly problematic because the equality
  functions (which are an extension) put extra requirements on the types used. So
  I'm going to try defining the functions outside of the class, in the hope that
  they won't get instantiated. If someone wants non-member functions to be
  instantiated, I think it's reasonable to expect them to explicitly instantiate
  them, especially as compilers don't seem to be consistent about this.
................
  r46587 | danieljames | 2008-06-21 20:58:39 +0100 (Sat, 21 Jun 2008) | 8 lines
  
  Get the test to pass when pair's default constructor creates two instances of
  the member classes.
  
  With some standard libraries I was getting two copies of the object after
  creating a default pair, probably because it was creating an instance for its
  default parameter. So only test after creating the pair object - since it isn't
  our concern how many instances that creates.
................
  r46588 | danieljames | 2008-06-21 21:11:26 +0100 (Sat, 21 Jun 2008) | 1 line
  
  Markup an expected failure for unordered.
................
  r46594 | danieljames | 2008-06-21 23:02:15 +0100 (Sat, 21 Jun 2008) | 19 lines
  
  Merge inspect fixes for the unordered library.
  
  Merged revisions 46470-46592 via svnmerge from 
  https://svn.boost.org/svn/boost/branches/unordered/trunk
  
  ................
    r46589 | danieljames | 2008-06-21 21:37:42 +0100 (Sat, 21 Jun 2008) | 2 lines
    
    Fix some inspect errors (tabs and missing copyright/license).
  ................
    r46591 | danieljames | 2008-06-21 21:47:51 +0100 (Sat, 21 Jun 2008) | 1 line
    
    Move memory.hpp into the helpers subdirectory.
  ................
    r46592 | danieljames | 2008-06-21 22:08:53 +0100 (Sat, 21 Jun 2008) | 1 line
    
    Prevent inspect errors for unnamed namespaces in some of the test header files.
  ................
................
  r46607 | danieljames | 2008-06-22 14:54:45 +0100 (Sun, 22 Jun 2008) | 9 lines
  
  Extract the hash and equality functions from hash_table_data_*.
  
  As these are extensions and add extra requirements to the container elements,
  they shouldn't be part of hash_table_data_* so that they won't get instantiated
  if an unordered container is explicitly instantiated.
  
  Merged revisions 46594-46604 via svnmerge from 
  https://svn.boost.org/svn/boost/branches/unordered/trunk
................
  r46608 | danieljames | 2008-06-22 16:00:02 +0100 (Sun, 22 Jun 2008) | 5 lines
  
  Remove the svnmerge integration information for the unordered branch.
  
  Now that the unordered library is moving towards release, the main development
  version is in trunk. New features will be developed on a new branch.
................


[SVN r46629]
2008-06-23 17:44:53 +00:00
c8d0cb88ad Merge unordered 'move_from' fix from trunk [46410].
[SVN r46413]
2008-06-15 19:21:12 +00:00
5a898f2419 Add Boost.Unordered to release branch.
[SVN r46342]
2008-06-12 00:26:08 +00:00
40 changed files with 1155 additions and 852 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/doc/html/

38
.travis.yml Normal file
View File

@ -0,0 +1,38 @@
# Copyright (C) 2016 Daniel James.
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
# Use Trusty to get a reasonably recent version of Boost.
sudo: required
dist: trusty
language: c++
addons:
apt:
packages:
- libboost-dev
- libboost-tools-dev
matrix:
include:
- compiler: gcc
env: BJAM_TOOLSET=gcc
- compiler: gcc
env: BJAM_TOOLSET=gcc-std11
- compiler: clang
env: BJAM_TOOLSET=clang
- compiler: clang
env: BJAM_TOOLSET=clang-std11
before_script:
- |
echo "using gcc : : g++-4.8 -Werror --std=c++03 -fsanitize=address ;" > ~/user-config.jam
echo "using gcc : std11 : g++-4.8 -Werror --std=c++11 -fsanitize=address ;" >> ~/user-config.jam
echo "using clang : : clang++ -Werror --std=c++03 -fsanitize=address ;" >> ~/user-config.jam
echo "using clang : std11 : clang++ -Werror --std=c++11 -fsanitize=address ;" >> ~/user-config.jam
- cat ~/user-config.jam
- touch Jamroot.jam
script:
- cd test && bjam ${BJAM_TOOLSET} include=${TRAVIS_BUILD_DIR}/include

View File

@ -47,7 +47,7 @@ First official release.
[h2 Boost 1.38.0]
* Use [@boost:/libs/utility/swap.html `boost::swap`].
* Use [@boost:/libs/core/swap.html `boost::swap`].
* [@https://svn.boost.org/trac/boost/ticket/2237 Ticket 2237]:
Document that the equality and inequality operators are undefined for two
objects if their equality predicates aren't equivalent. Thanks to Daniel
@ -239,5 +239,44 @@ C++11 support has resulted in some breaking changes:
* Avoid some warnings ([ticket 8851], [ticket 8874]).
* Avoid exposing some detail functions via. ADL on the iterators.
* Follow the standard by only using the allocators' construct and destroy
methods to construct and destroy stored elements. Don't use them for internal
data like pointers.
[h2 Boost 1.56.0]
* Fix some shadowed variable warnings ([ticket 9377]).
* Fix allocator use in documentation ([ticket 9719]).
* Always use prime number of buckets for integers. Fixes performance
regression when inserting consecutive integers, although makes other
uses slower ([ticket 9282]).
* Only construct elements using allocators, as specified in C++11 standard.
[h2 Boost 1.57.0]
* Fix the `pointer` typedef in iterators ([ticket 10672]).
* Fix Coverity warning
([@https://github.com/boostorg/unordered/pull/2 GitHub #2]).
[h2 Boost 1.58.0]
* Remove unnecessary template parameter from const iterators.
* Rename private `iterator` typedef in some iterator classes, as it
confuses some traits classes.
* Fix move assignment with stateful, propagate_on_container_move_assign
allocators ([ticket 10777]).
* Fix rare exception safety issue in move assignment.
* Fix potential overflow when calculating number of buckets to allocate
([@https://github.com/boostorg/unordered/pull/4 GitHub #4]).
[h2 Boost 1.62.0]
* Remove use of deprecated `boost::iterator`.
* Remove `BOOST_NO_STD_DISTANCE` workaround.
* Remove `BOOST_UNORDERED_DEPRECATED_EQUALITY` warning.
* Simpler implementation of assignment, fixes an exception safety issue
for `unordered_multiset` and `unordered_multimap`. Might be a little slower.
* Stop using return value SFINAE which some older compilers have issues
with.
[endsect]

View File

@ -54,14 +54,14 @@ order to work with non-C++11 compilers and libraries.
class Key, class Mapped,
class Hash = ``[classref boost::hash]``<Key>,
class Pred = std::equal_to<Key>,
class Alloc = std::allocator<Key> >
class Alloc = std::allocator<std::pair<Key const, Mapped> > >
class ``[classref boost::unordered_map unordered_map]``;
template<
class Key, class Mapped,
class Hash = ``[classref boost::hash]``<Key>,
class Pred = std::equal_to<Key>,
class Alloc = std::allocator<Key> >
class Alloc = std::allocator<std::pair<Key const, Mapped> > >
class ``[classref boost::unordered_multimap unordered_multimap]``;
}

View File

@ -14,23 +14,31 @@
#pragma once
#endif
// Some of these includes are required for other detail headers.
#include <boost/unordered/detail/fwd.hpp>
#include <boost/move/move.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/inc.hpp>
#include <boost/preprocessor/dec.hpp>
#include <boost/preprocessor/repetition/enum.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
#include <boost/type_traits/is_class.hpp>
#include <boost/type_traits/add_lvalue_reference.hpp>
#include <boost/type_traits/aligned_storage.hpp>
#include <boost/type_traits/alignment_of.hpp>
#include <boost/type_traits/is_nothrow_move_constructible.hpp>
#include <boost/type_traits/is_nothrow_move_assignable.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/utility/addressof.hpp>
#include <boost/detail/no_exceptions_support.hpp>
#include <boost/detail/select_type.hpp>
#include <boost/swap.hpp>
#include <boost/assert.hpp>
#include <boost/limits.hpp>
#include <iterator>
#include <utility>
#include <cmath>
#if !defined(BOOST_NO_CXX11_HDR_TUPLE)
#include <tuple>
@ -808,6 +816,18 @@ namespace boost { namespace unordered { namespace detail { namespace func {
# endif
#else
template <typename Alloc, typename T>
inline void call_construct(Alloc&, T* address)
{
new ((void*) address) T();
}
template <typename Alloc, typename T, typename A0>
inline void call_construct(Alloc&, T* address,
BOOST_FWD_REF(A0) a0)
{
new ((void*) address) T(boost::forward<A0>(a0));
}
template <typename Alloc, typename T>
inline void destroy_value_impl(Alloc&, T* x) {
@ -1053,71 +1073,182 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, boost::)
namespace boost { namespace unordered { namespace detail {
////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
//
// array_constructor
//
// Allocate and construct an array in an exception safe manner, and
// clean up if an exception is thrown before the container takes charge
// of it.
// Node construction
template <typename Allocator>
struct array_constructor
template <typename NodeAlloc>
struct node_constructor
{
typedef boost::unordered::detail::allocator_traits<Allocator> traits;
typedef typename traits::pointer pointer;
typedef NodeAlloc node_allocator;
typedef boost::unordered::detail::allocator_traits<NodeAlloc>
node_allocator_traits;
typedef typename node_allocator_traits::value_type node;
typedef typename node_allocator_traits::pointer node_pointer;
typedef typename node::value_type value_type;
Allocator& alloc_;
pointer ptr_;
pointer constructed_;
std::size_t length_;
node_allocator& alloc_;
node_pointer node_;
bool node_constructed_;
array_constructor(Allocator& a)
: alloc_(a), ptr_(), constructed_(), length_(0)
node_constructor(node_allocator& n) :
alloc_(n),
node_(),
node_constructed_(false)
{
constructed_ = pointer();
ptr_ = pointer();
}
~array_constructor() {
if (ptr_) {
for(pointer p = ptr_; p != constructed_; ++p)
traits::destroy(alloc_, boost::addressof(*p));
~node_constructor();
traits::deallocate(alloc_, ptr_, length_);
}
}
void create_node();
template <typename V>
void construct(V const& v, std::size_t l)
// no throw
node_pointer release()
{
BOOST_ASSERT(!ptr_);
length_ = l;
ptr_ = traits::allocate(alloc_, length_);
pointer end = ptr_ + static_cast<std::ptrdiff_t>(length_);
for(constructed_ = ptr_; constructed_ != end; ++constructed_)
traits::construct(alloc_, boost::addressof(*constructed_), v);
}
pointer get() const
{
return ptr_;
}
pointer release()
{
pointer p(ptr_);
ptr_ = pointer();
BOOST_ASSERT(node_ && node_constructed_);
node_pointer p = node_;
node_ = node_pointer();
return p;
}
private:
void reclaim(node_pointer p) {
BOOST_ASSERT(!node_);
node_ = p;
node_constructed_ = true;
boost::unordered::detail::func::destroy_value_impl(alloc_,
node_->value_ptr());
}
array_constructor(array_constructor const&);
array_constructor& operator=(array_constructor const&);
private:
node_constructor(node_constructor const&);
node_constructor& operator=(node_constructor const&);
};
template <typename Alloc>
node_constructor<Alloc>::~node_constructor()
{
if (node_) {
if (node_constructed_) {
boost::unordered::detail::func::destroy(
boost::addressof(*node_));
}
node_allocator_traits::deallocate(alloc_, node_, 1);
}
}
template <typename Alloc>
void node_constructor<Alloc>::create_node()
{
BOOST_ASSERT(!node_);
node_constructed_ = false;
node_ = node_allocator_traits::allocate(alloc_, 1);
new ((void*) boost::addressof(*node_)) node();
node_->init(node_);
node_constructed_ = true;
}
template <typename NodeAlloc>
struct node_tmp
{
typedef boost::unordered::detail::allocator_traits<NodeAlloc>
node_allocator_traits;
typedef typename node_allocator_traits::pointer node_pointer;
NodeAlloc& alloc_;
node_pointer node_;
explicit node_tmp(node_pointer n, NodeAlloc& a):
alloc_(a),
node_(n)
{
}
~node_tmp();
// no throw
node_pointer release()
{
node_pointer p = node_;
node_ = node_pointer();
return p;
}
};
template <typename Alloc>
node_tmp<Alloc>::~node_tmp()
{
if (node_) {
boost::unordered::detail::func::destroy_value_impl(alloc_,
node_->value_ptr());
boost::unordered::detail::func::destroy(
boost::addressof(*node_));
node_allocator_traits::deallocate(alloc_, node_, 1);
}
}
}}}
namespace boost { namespace unordered { namespace detail { namespace func {
// Some nicer construct_value functions, might try to
// improve implementation later.
template <typename Alloc, BOOST_UNORDERED_EMPLACE_TEMPLATE>
inline typename boost::unordered::detail::allocator_traits<Alloc>::pointer
construct_value_generic(Alloc& alloc, BOOST_UNORDERED_EMPLACE_ARGS)
{
node_constructor<Alloc> a(alloc);
a.create_node();
construct_value_impl(alloc, a.node_->value_ptr(),
BOOST_UNORDERED_EMPLACE_FORWARD);
return a.release();
}
template <typename Alloc, typename U>
inline typename boost::unordered::detail::allocator_traits<Alloc>::pointer
construct_value(Alloc& alloc, BOOST_FWD_REF(U) x)
{
node_constructor<Alloc> a(alloc);
a.create_node();
boost::unordered::detail::func::call_construct(
alloc, a.node_->value_ptr(), boost::forward<U>(x));
return a.release();
}
// TODO: When possible, it might be better to use std::pair's
// constructor for std::piece_construct with std::tuple.
template <typename Alloc, typename Key>
inline typename boost::unordered::detail::allocator_traits<Alloc>::pointer
construct_pair(Alloc& alloc, BOOST_FWD_REF(Key) k)
{
node_constructor<Alloc> a(alloc);
a.create_node();
boost::unordered::detail::func::call_construct(
alloc, boost::addressof(a.node_->value_ptr()->first),
boost::forward<Key>(k));
boost::unordered::detail::func::call_construct(
alloc, boost::addressof(a.node_->value_ptr()->second));
return a.release();
}
template <typename Alloc, typename Key, typename Mapped>
inline typename boost::unordered::detail::allocator_traits<Alloc>::pointer
construct_pair(Alloc& alloc, BOOST_FWD_REF(Key) k, BOOST_FWD_REF(Mapped) m)
{
node_constructor<Alloc> a(alloc);
a.create_node();
boost::unordered::detail::func::call_construct(
alloc, boost::addressof(a.node_->value_ptr()->first),
boost::forward<Key>(k));
boost::unordered::detail::func::call_construct(
alloc, boost::addressof(a.node_->value_ptr()->second),
boost::forward<Mapped>(m));
return a.release();
}
}}}}
#if defined(BOOST_MSVC)
#pragma warning(pop)
#endif

View File

@ -14,14 +14,6 @@
#include <boost/unordered/detail/util.hpp>
#include <boost/unordered/detail/allocate.hpp>
#include <boost/type_traits/aligned_storage.hpp>
#include <boost/type_traits/alignment_of.hpp>
#include <boost/type_traits/is_nothrow_move_constructible.hpp>
#include <boost/type_traits/is_nothrow_move_assignable.hpp>
#include <boost/swap.hpp>
#include <boost/assert.hpp>
#include <boost/limits.hpp>
#include <boost/iterator.hpp>
namespace boost { namespace unordered { namespace detail {
@ -45,9 +37,9 @@ namespace boost { namespace unordered { namespace iterator_detail {
// all no throw
template <typename Node> struct iterator;
template <typename Node, typename ConstNodePointer> struct c_iterator;
template <typename Node> struct c_iterator;
template <typename Node, typename Policy> struct l_iterator;
template <typename Node, typename ConstNodePointer, typename Policy>
template <typename Node, typename Policy>
struct cl_iterator;
// Local Iterators
@ -56,20 +48,20 @@ namespace boost { namespace unordered { namespace iterator_detail {
template <typename Node, typename Policy>
struct l_iterator
: public boost::iterator<
: public std::iterator<
std::forward_iterator_tag,
typename Node::value_type,
std::ptrdiff_t,
typename Node::node_pointer,
typename Node::value_type*,
typename Node::value_type&>
{
#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
template <typename Node2, typename ConstNodePointer, typename Policy2>
template <typename Node2, typename Policy2>
friend struct boost::unordered::iterator_detail::cl_iterator;
private:
#endif
typedef typename Node::node_pointer node_pointer;
typedef boost::unordered::iterator_detail::iterator<Node> iterator;
typedef boost::unordered::iterator_detail::iterator<Node> n_iterator;
node_pointer ptr_;
std::size_t bucket_;
std::size_t bucket_count_;
@ -80,7 +72,7 @@ namespace boost { namespace unordered { namespace iterator_detail {
l_iterator() BOOST_NOEXCEPT : ptr_() {}
l_iterator(iterator x, std::size_t b, std::size_t c) BOOST_NOEXCEPT
l_iterator(n_iterator x, std::size_t b, std::size_t c) BOOST_NOEXCEPT
: ptr_(x.node_), bucket_(b), bucket_count_(c) {}
value_type& operator*() const {
@ -114,13 +106,13 @@ namespace boost { namespace unordered { namespace iterator_detail {
}
};
template <typename Node, typename ConstNodePointer, typename Policy>
template <typename Node, typename Policy>
struct cl_iterator
: public boost::iterator<
: public std::iterator<
std::forward_iterator_tag,
typename Node::value_type,
std::ptrdiff_t,
ConstNodePointer,
typename Node::value_type const*,
typename Node::value_type const&>
{
friend struct boost::unordered::iterator_detail::l_iterator
@ -128,7 +120,7 @@ namespace boost { namespace unordered { namespace iterator_detail {
private:
typedef typename Node::node_pointer node_pointer;
typedef boost::unordered::iterator_detail::iterator<Node> iterator;
typedef boost::unordered::iterator_detail::iterator<Node> n_iterator;
node_pointer ptr_;
std::size_t bucket_;
std::size_t bucket_count_;
@ -139,7 +131,7 @@ namespace boost { namespace unordered { namespace iterator_detail {
cl_iterator() BOOST_NOEXCEPT : ptr_() {}
cl_iterator(iterator x, std::size_t b, std::size_t c) BOOST_NOEXCEPT :
cl_iterator(n_iterator x, std::size_t b, std::size_t c) BOOST_NOEXCEPT :
ptr_(x.node_), bucket_(b), bucket_count_(c) {}
cl_iterator(boost::unordered::iterator_detail::l_iterator<
@ -184,19 +176,19 @@ namespace boost { namespace unordered { namespace iterator_detail {
template <typename Node>
struct iterator
: public boost::iterator<
: public std::iterator<
std::forward_iterator_tag,
typename Node::value_type,
std::ptrdiff_t,
typename Node::node_pointer,
typename Node::value_type*,
typename Node::value_type&>
{
#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
template <typename, typename>
template <typename>
friend struct boost::unordered::iterator_detail::c_iterator;
template <typename, typename>
friend struct boost::unordered::iterator_detail::l_iterator;
template <typename, typename, typename>
template <typename, typename>
friend struct boost::unordered::iterator_detail::cl_iterator;
template <typename>
friend struct boost::unordered::detail::table;
@ -223,7 +215,7 @@ namespace boost { namespace unordered { namespace iterator_detail {
}
value_type* operator->() const {
return &node_->value();
return node_->value_ptr();
}
iterator& operator++() {
@ -246,13 +238,13 @@ namespace boost { namespace unordered { namespace iterator_detail {
}
};
template <typename Node, typename ConstNodePointer>
template <typename Node>
struct c_iterator
: public boost::iterator<
: public std::iterator<
std::forward_iterator_tag,
typename Node::value_type,
std::ptrdiff_t,
ConstNodePointer,
typename Node::value_type const*,
typename Node::value_type const&>
{
friend struct boost::unordered::iterator_detail::iterator<Node>;
@ -268,7 +260,7 @@ namespace boost { namespace unordered { namespace iterator_detail {
private:
#endif
typedef typename Node::node_pointer node_pointer;
typedef boost::unordered::iterator_detail::iterator<Node> iterator;
typedef boost::unordered::iterator_detail::iterator<Node> n_iterator;
node_pointer node_;
public:
@ -280,14 +272,14 @@ namespace boost { namespace unordered { namespace iterator_detail {
explicit c_iterator(typename Node::link_pointer x) BOOST_NOEXCEPT :
node_(static_cast<node_pointer>(x)) {}
c_iterator(iterator const& x) BOOST_NOEXCEPT : node_(x.node_) {}
c_iterator(n_iterator const& x) BOOST_NOEXCEPT : node_(x.node_) {}
value_type const& operator*() const {
return node_->value();
}
value_type const* operator->() const {
return &node_->value();
return node_->value_ptr();
}
c_iterator& operator++() {
@ -317,125 +309,6 @@ namespace boost { namespace unordered { namespace iterator_detail {
namespace boost { namespace unordered { namespace detail {
///////////////////////////////////////////////////////////////////
//
// Node construction
template <typename NodeAlloc>
struct node_constructor
{
private:
typedef NodeAlloc node_allocator;
typedef boost::unordered::detail::allocator_traits<NodeAlloc>
node_allocator_traits;
typedef typename node_allocator_traits::value_type node;
typedef typename node_allocator_traits::pointer node_pointer;
typedef typename node::value_type value_type;
protected:
node_allocator& alloc_;
node_pointer node_;
bool node_constructed_;
bool value_constructed_;
public:
node_constructor(node_allocator& n) :
alloc_(n),
node_(),
node_constructed_(false),
value_constructed_(false)
{
}
~node_constructor();
void construct();
template <BOOST_UNORDERED_EMPLACE_TEMPLATE>
void construct_with_value(BOOST_UNORDERED_EMPLACE_ARGS)
{
construct();
boost::unordered::detail::func::construct_value_impl(
alloc_, node_->value_ptr(), BOOST_UNORDERED_EMPLACE_FORWARD);
value_constructed_ = true;
}
template <typename A0>
void construct_with_value2(BOOST_FWD_REF(A0) a0)
{
construct();
boost::unordered::detail::func::construct_value_impl(
alloc_, node_->value_ptr(),
BOOST_UNORDERED_EMPLACE_ARGS1(boost::forward<A0>(a0)));
value_constructed_ = true;
}
value_type const& value() const {
BOOST_ASSERT(node_ && node_constructed_ && value_constructed_);
return node_->value();
}
// no throw
node_pointer release()
{
BOOST_ASSERT(node_ && node_constructed_);
node_pointer p = node_;
node_ = node_pointer();
return p;
}
private:
node_constructor(node_constructor const&);
node_constructor& operator=(node_constructor const&);
};
template <typename Alloc>
node_constructor<Alloc>::~node_constructor()
{
if (node_) {
if (value_constructed_) {
boost::unordered::detail::func::destroy_value_impl(alloc_,
node_->value_ptr());
}
if (node_constructed_) {
node_allocator_traits::destroy(alloc_,
boost::addressof(*node_));
}
node_allocator_traits::deallocate(alloc_, node_, 1);
}
}
template <typename Alloc>
void node_constructor<Alloc>::construct()
{
if(!node_) {
node_constructed_ = false;
value_constructed_ = false;
node_ = node_allocator_traits::allocate(alloc_, 1);
node_allocator_traits::construct(alloc_,
boost::addressof(*node_), node());
node_->init(node_);
node_constructed_ = true;
}
else {
BOOST_ASSERT(node_constructed_);
if (value_constructed_)
{
boost::unordered::detail::func::destroy_value_impl(alloc_,
node_->value_ptr());
value_constructed_ = false;
}
}
}
///////////////////////////////////////////////////////////////////
//
// Node Holder
@ -443,11 +316,9 @@ namespace boost { namespace unordered { namespace detail {
// Temporary store for nodes. Deletes any that aren't used.
template <typename NodeAlloc>
struct node_holder : private node_constructor<NodeAlloc>
struct node_holder
{
private:
typedef node_constructor<NodeAlloc> base;
typedef NodeAlloc node_allocator;
typedef boost::unordered::detail::allocator_traits<NodeAlloc>
node_allocator_traits;
@ -457,13 +328,14 @@ namespace boost { namespace unordered { namespace detail {
typedef typename node::link_pointer link_pointer;
typedef boost::unordered::iterator_detail::iterator<node> iterator;
node_constructor<NodeAlloc> constructor_;
node_pointer nodes_;
public:
template <typename Table>
explicit node_holder(Table& b) :
base(b.node_alloc()),
constructor_(b.node_alloc()),
nodes_()
{
if (b.size_) {
@ -476,61 +348,71 @@ namespace boost { namespace unordered { namespace detail {
~node_holder();
void node_for_assignment()
node_pointer pop_node()
{
if (!this->node_ && nodes_) {
this->node_ = nodes_;
nodes_ = static_cast<node_pointer>(nodes_->next_);
this->node_->init(this->node_);
this->node_->next_ = link_pointer();
this->node_constructed_ = true;
this->value_constructed_ = true;
}
node_pointer n = nodes_;
nodes_ = static_cast<node_pointer>(nodes_->next_);
n->init(n);
n->next_ = link_pointer();
return n;
}
template <typename T>
inline void assign_impl(T const& v) {
if (this->node_ && this->value_constructed_) {
this->node_->value() = v;
inline node_pointer copy_of(T const& v) {
if (nodes_) {
node_tmp<NodeAlloc> a(pop_node(), constructor_.alloc_);
a.node_->value() = v;
return a.release();
}
else {
this->construct_with_value2(v);
constructor_.create_node();
boost::unordered::detail::func::call_construct(
constructor_.alloc_, constructor_.node_->value_ptr(), v);
return constructor_.release();
}
}
template <typename T1, typename T2>
inline void assign_impl(std::pair<T1 const, T2> const& v) {
this->construct_with_value2(v);
inline node_pointer copy_of(std::pair<T1 const, T2> const& v) {
if (nodes_) {
constructor_.reclaim(pop_node());
}
else {
constructor_.create_node();
}
boost::unordered::detail::func::call_construct(
constructor_.alloc_, constructor_.node_->value_ptr(), v);
return constructor_.release();
}
template <typename T>
inline void move_assign_impl(T& v) {
if (this->node_ && this->value_constructed_) {
this->node_->value() = boost::move(v);
inline node_pointer move_copy_of(T& v) {
if (nodes_) {
node_tmp<NodeAlloc> a(pop_node(), constructor_.alloc_);
a.node_->value() = boost::move(v);
return a.release();
}
else {
this->construct_with_value2(boost::move(v));
constructor_.create_node();
boost::unordered::detail::func::call_construct(
constructor_.alloc_, constructor_.node_->value_ptr(),
boost::move(v));
return constructor_.release();
}
}
template <typename T1, typename T2>
inline void move_assign_impl(std::pair<T1 const, T2>& v) {
this->construct_with_value2(boost::move(v));
}
node_pointer copy_of(value_type const& v)
{
node_for_assignment();
assign_impl(v);
return base::release();
}
node_pointer move_copy_of(value_type& v)
{
node_for_assignment();
move_assign_impl(v);
return base::release();
inline node_pointer move_copy_of(std::pair<T1 const, T2>& v) {
if (nodes_) {
constructor_.reclaim(pop_node());
}
else {
constructor_.create_node();
}
boost::unordered::detail::func::call_construct(
constructor_.alloc_, constructor_.node_->value_ptr(),
boost::move(v));
return constructor_.release();
}
iterator begin() const
@ -546,10 +428,10 @@ namespace boost { namespace unordered { namespace detail {
node_pointer p = nodes_;
nodes_ = static_cast<node_pointer>(p->next_);
boost::unordered::detail::func::destroy_value_impl(this->alloc_,
boost::unordered::detail::func::destroy_value_impl(constructor_.alloc_,
p->value_ptr());
node_allocator_traits::destroy(this->alloc_, boost::addressof(*p));
node_allocator_traits::deallocate(this->alloc_, p, 1);
boost::unordered::detail::func::destroy(boost::addressof(*p));
node_allocator_traits::deallocate(constructor_.alloc_, p, 1);
}
}
@ -666,11 +548,51 @@ namespace boost { namespace unordered { namespace detail {
typedef mix64_policy<std::size_t> type;
};
template <typename T>
struct pick_policy :
pick_policy_impl<
std::numeric_limits<std::size_t>::digits,
std::numeric_limits<std::size_t>::radix> {};
// While the mix policy is generally faster, the prime policy is a lot
// faster when a large number consecutive integers are used, because
// there are no collisions. Since that is probably quite common, use
// prime policy for integeral types. But not the smaller ones, as they
// don't have enough unique values for this to be an issue.
template <>
struct pick_policy<int> {
typedef prime_policy<std::size_t> type;
};
template <>
struct pick_policy<unsigned int> {
typedef prime_policy<std::size_t> type;
};
template <>
struct pick_policy<long> {
typedef prime_policy<std::size_t> type;
};
template <>
struct pick_policy<unsigned long> {
typedef prime_policy<std::size_t> type;
};
// TODO: Maybe not if std::size_t is smaller than long long.
#if !defined(BOOST_NO_LONG_LONG)
template <>
struct pick_policy<long long> {
typedef prime_policy<std::size_t> type;
};
template <>
struct pick_policy<unsigned long long> {
typedef prime_policy<std::size_t> type;
};
#endif
////////////////////////////////////////////////////////////////////////////
// Functions

View File

@ -12,7 +12,6 @@
#pragma once
#endif
#include <boost/unordered/detail/table.hpp>
#include <boost/unordered/detail/extract_key.hpp>
namespace boost { namespace unordered { namespace detail {
@ -52,15 +51,16 @@ namespace boost { namespace unordered { namespace detail {
template <typename T>
struct grouped_ptr_node :
boost::unordered::detail::value_base<T>,
boost::unordered::detail::ptr_bucket
{
typedef T value_type;
typedef boost::unordered::detail::ptr_bucket bucket_base;
typedef grouped_ptr_node<T>* node_pointer;
typedef ptr_bucket* link_pointer;
node_pointer group_prev_;
std::size_t hash_;
boost::unordered::detail::value_base<T> value_base_;
grouped_ptr_node() :
bucket_base(),
@ -73,6 +73,10 @@ namespace boost { namespace unordered { namespace detail {
group_prev_ = self;
}
void* address() { return value_base_.address(); }
value_type& value() { return value_base_.value(); }
value_type* value_ptr() { return value_base_.value_ptr(); }
private:
grouped_ptr_node& operator=(grouped_ptr_node const&);
};
@ -125,55 +129,6 @@ namespace boost { namespace unordered { namespace detail {
typedef typename pick::link_pointer link_pointer;
};
template <typename A, typename T, typename H, typename P>
struct multiset
{
typedef boost::unordered::detail::multiset<A, T, H, P> types;
typedef A allocator;
typedef T value_type;
typedef H hasher;
typedef P key_equal;
typedef T key_type;
typedef boost::unordered::detail::allocator_traits<allocator> traits;
typedef boost::unordered::detail::pick_grouped_node<allocator,
value_type> pick;
typedef typename pick::node node;
typedef typename pick::bucket bucket;
typedef typename pick::link_pointer link_pointer;
typedef boost::unordered::detail::grouped_table_impl<types> table;
typedef boost::unordered::detail::set_extractor<value_type> extractor;
typedef boost::unordered::detail::pick_policy::type policy;
};
template <typename A, typename K, typename M, typename H, typename P>
struct multimap
{
typedef boost::unordered::detail::multimap<A, K, M, H, P> types;
typedef A allocator;
typedef std::pair<K const, M> value_type;
typedef H hasher;
typedef P key_equal;
typedef K key_type;
typedef boost::unordered::detail::allocator_traits<allocator> traits;
typedef boost::unordered::detail::pick_grouped_node<allocator,
value_type> pick;
typedef typename pick::node node;
typedef typename pick::bucket bucket;
typedef typename pick::link_pointer link_pointer;
typedef boost::unordered::detail::grouped_table_impl<types> table;
typedef boost::unordered::detail::map_extractor<key_type, value_type>
extractor;
typedef boost::unordered::detail::pick_policy::type policy;
};
template <typename Types>
struct grouped_table_impl : boost::unordered::detail::table<Types>
{
@ -190,6 +145,7 @@ namespace boost { namespace unordered { namespace detail {
typedef typename table::key_equal key_equal;
typedef typename table::key_type key_type;
typedef typename table::node_constructor node_constructor;
typedef typename table::node_tmp node_tmp;
typedef typename table::extractor extractor;
typedef typename table::iterator iterator;
typedef typename table::c_iterator c_iterator;
@ -376,11 +332,10 @@ namespace boost { namespace unordered { namespace detail {
}
inline iterator add_node(
node_constructor& a,
node_pointer n,
std::size_t key_hash,
iterator pos)
{
node_pointer n = a.release();
n->hash_ = key_hash;
if (pos.node_) {
this->add_after_node(n, pos.node_);
@ -420,23 +375,23 @@ namespace boost { namespace unordered { namespace detail {
return iterator(n);
}
iterator emplace_impl(node_constructor& a)
iterator emplace_impl(node_pointer n)
{
key_type const& k = this->get_key(a.value());
node_tmp a(n, this->node_alloc());
key_type const& k = this->get_key(a.node_->value());
std::size_t key_hash = this->hash(k);
iterator position = this->find_node(key_hash, k);
// reserve has basic exception safety if the hash function
// throws, strong otherwise.
this->reserve_for_insert(this->size_ + 1);
return this->add_node(a, key_hash, position);
return this->add_node(a.release(), key_hash, position);
}
void emplace_impl_no_rehash(node_constructor& a)
void emplace_impl_no_rehash(node_pointer n)
{
key_type const& k = this->get_key(a.value());
node_tmp a(n, this->node_alloc());
key_type const& k = this->get_key(a.node_->value());
std::size_t key_hash = this->hash(k);
this->add_node(a, key_hash, this->find_node(key_hash, k));
iterator position = this->find_node(key_hash, k);
this->add_node(a.release(), key_hash, position);
}
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
@ -460,10 +415,9 @@ namespace boost { namespace unordered { namespace detail {
template <BOOST_UNORDERED_EMPLACE_TEMPLATE>
iterator emplace(BOOST_UNORDERED_EMPLACE_ARGS)
{
node_constructor a(this->node_alloc());
a.construct_with_value(BOOST_UNORDERED_EMPLACE_FORWARD);
return iterator(emplace_impl(a));
return iterator(emplace_impl(
boost::unordered::detail::func::construct_value_generic(
this->node_alloc(), BOOST_UNORDERED_EMPLACE_FORWARD)));
}
////////////////////////////////////////////////////////////////////////
@ -472,37 +426,37 @@ namespace boost { namespace unordered { namespace detail {
// if hash function throws, or inserting > 1 element, basic exception
// safety. Strong otherwise
template <class I>
typename boost::unordered::detail::enable_if_forward<I, void>::type
insert_range(I i, I j)
void insert_range(I i, I j, typename
boost::unordered::detail::enable_if_forward<I, void*>::type = 0)
{
if(i == j) return;
std::size_t distance = boost::unordered::detail::distance(i, j);
std::size_t distance = std::distance(i, j);
if(distance == 1) {
node_constructor a(this->node_alloc());
a.construct_with_value2(*i);
emplace_impl(a);
emplace_impl(
boost::unordered::detail::func::construct_value(
this->node_alloc(), *i));
}
else {
// Only require basic exception safety here
this->reserve_for_insert(this->size_ + distance);
node_constructor a(this->node_alloc());
for (; i != j; ++i) {
a.construct_with_value2(*i);
emplace_impl_no_rehash(a);
emplace_impl_no_rehash(
boost::unordered::detail::func::construct_value(
this->node_alloc(), *i));
}
}
}
template <class I>
typename boost::unordered::detail::disable_if_forward<I, void>::type
insert_range(I i, I j)
void insert_range(I i, I j, typename
boost::unordered::detail::disable_if_forward<I, void*>::type = 0)
{
node_constructor a(this->node_alloc());
for (; i != j; ++i) {
a.construct_with_value2(*i);
emplace_impl(a);
emplace_impl(
boost::unordered::detail::func::construct_value(
this->node_alloc(), *i));
}
}
@ -537,9 +491,9 @@ namespace boost { namespace unordered { namespace detail {
node_pointer first_node = static_cast<node_pointer>(prev->next_);
link_pointer end = first_node->group_prev_->next_;
std::size_t count = this->delete_nodes(prev, end);
std::size_t deleted_count = this->delete_nodes(prev, end);
this->fix_bucket(bucket_index, prev);
return count;
return deleted_count;
}
iterator erase(c_iterator r)
@ -558,21 +512,21 @@ namespace boost { namespace unordered { namespace detail {
return iterator(r2.node_);
}
link_pointer erase_nodes(node_pointer begin, node_pointer end)
link_pointer erase_nodes(node_pointer i, node_pointer j)
{
std::size_t bucket_index = this->hash_to_bucket(begin->hash_);
std::size_t bucket_index = this->hash_to_bucket(i->hash_);
// Split the groups containing 'begin' and 'end'.
// And get the pointer to the node before begin while
// Split the groups containing 'i' and 'j'.
// And get the pointer to the node before i while
// we're at it.
link_pointer prev = split_groups(begin, end);
link_pointer prev = split_groups(i, j);
// If we don't have a 'prev' it means that begin is at the
// If we don't have a 'prev' it means that i is at the
// beginning of a block, so search through the blocks in the
// same bucket.
if (!prev) {
prev = this->get_previous_start(bucket_index);
while (prev->next_ != begin)
while (prev->next_ != i)
prev = static_cast<node_pointer>(prev->next_)->group_prev_;
}
@ -582,24 +536,24 @@ namespace boost { namespace unordered { namespace detail {
static_cast<node_pointer>(prev->next_)->group_prev_->next_;
this->delete_nodes(prev, group_end);
bucket_index = this->fix_bucket(bucket_index, prev);
} while(prev->next_ != end);
} while(prev->next_ != j);
return prev;
}
static link_pointer split_groups(node_pointer begin, node_pointer end)
static link_pointer split_groups(node_pointer i, node_pointer j)
{
node_pointer prev = begin->group_prev_;
if (prev->next_ != begin) prev = node_pointer();
node_pointer prev = i->group_prev_;
if (prev->next_ != i) prev = node_pointer();
if (end) {
node_pointer first = end;
while (first != begin && first->group_prev_->next_ == first) {
if (j) {
node_pointer first = j;
while (first != i && first->group_prev_->next_ == first) {
first = first->group_prev_;
}
boost::swap(first->group_prev_, end->group_prev_);
if (first == begin) return prev;
boost::swap(first->group_prev_, j->group_prev_);
if (first == i) return prev;
}
if (prev) {
@ -607,7 +561,7 @@ namespace boost { namespace unordered { namespace detail {
while (first->group_prev_->next_ == first) {
first = first->group_prev_;
}
boost::swap(first->group_prev_, begin->group_prev_);
boost::swap(first->group_prev_, i->group_prev_);
}
return prev;
@ -616,31 +570,65 @@ namespace boost { namespace unordered { namespace detail {
////////////////////////////////////////////////////////////////////////
// fill_buckets
template <class NodeCreator>
static void fill_buckets(iterator n, table& dst,
NodeCreator& creator)
{
link_pointer prev = dst.get_previous_start();
void copy_buckets(table const& src) {
this->create_buckets(this->bucket_count_);
while (n.node_) {
for (iterator n = src.begin(); n.node_;) {
std::size_t key_hash = n.node_->hash_;
iterator group_end(n.node_->group_prev_->next_);
node_pointer first_node = creator.create(*n);
node_pointer end = first_node;
first_node->hash_ = key_hash;
prev->next_ = first_node;
++dst.size_;
iterator pos = this->add_node(
boost::unordered::detail::func::construct_value(
this->node_alloc(), *n), key_hash, iterator());
for (++n; n != group_end; ++n)
{
end = creator.create(*n);
end->hash_ = key_hash;
add_after_node(end, first_node);
++dst.size_;
this->add_node(
boost::unordered::detail::func::construct_value(
this->node_alloc(), *n), key_hash, pos);
}
}
}
prev = place_in_bucket(dst, prev, end);
void move_buckets(table const& src) {
this->create_buckets(this->bucket_count_);
for (iterator n = src.begin(); n.node_;) {
std::size_t key_hash = n.node_->hash_;
iterator group_end(n.node_->group_prev_->next_);
iterator pos = this->add_node(
boost::unordered::detail::func::construct_value(
this->node_alloc(), boost::move(*n)), key_hash, iterator());
for (++n; n != group_end; ++n)
{
this->add_node(
boost::unordered::detail::func::construct_value(
this->node_alloc(), boost::move(*n)), key_hash, pos);
}
}
}
void assign_buckets(table const& src) {
node_holder<node_allocator> holder(*this);
for (iterator n = src.begin(); n.node_;) {
std::size_t key_hash = n.node_->hash_;
iterator group_end(n.node_->group_prev_->next_);
iterator pos = this->add_node(holder.copy_of(*n), key_hash, iterator());
for (++n; n != group_end; ++n)
{
this->add_node(holder.copy_of(*n), key_hash, pos);
}
}
}
void move_assign_buckets(table& src) {
node_holder<node_allocator> holder(*this);
for (iterator n = src.begin(); n.node_;) {
std::size_t key_hash = n.node_->hash_;
iterator group_end(n.node_->group_prev_->next_);
iterator pos = this->add_node(holder.move_copy_of(*n), key_hash, iterator());
for (++n; n != group_end; ++n)
{
this->add_node(holder.move_copy_of(*n), key_hash, pos);
}
}
}

View File

@ -0,0 +1,61 @@
// Copyright (C) 2005-2016 Daniel James
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/unordered/unordered_map_fwd.hpp>
#include <boost/unordered/detail/equivalent.hpp>
#include <boost/unordered/detail/unique.hpp>
namespace boost { namespace unordered { namespace detail {
template <typename A, typename K, typename M, typename H, typename P>
struct map
{
typedef boost::unordered::detail::map<A, K, M, H, P> types;
typedef A allocator;
typedef std::pair<K const, M> value_type;
typedef H hasher;
typedef P key_equal;
typedef K key_type;
typedef boost::unordered::detail::allocator_traits<allocator>
traits;
typedef boost::unordered::detail::pick_node<allocator, value_type> pick;
typedef typename pick::node node;
typedef typename pick::bucket bucket;
typedef typename pick::link_pointer link_pointer;
typedef boost::unordered::detail::table_impl<types> table;
typedef boost::unordered::detail::map_extractor<key_type, value_type>
extractor;
typedef typename boost::unordered::detail::pick_policy<K>::type policy;
};
template <typename A, typename K, typename M, typename H, typename P>
struct multimap
{
typedef boost::unordered::detail::multimap<A, K, M, H, P> types;
typedef A allocator;
typedef std::pair<K const, M> value_type;
typedef H hasher;
typedef P key_equal;
typedef K key_type;
typedef boost::unordered::detail::allocator_traits<allocator> traits;
typedef boost::unordered::detail::pick_grouped_node<allocator,
value_type> pick;
typedef typename pick::node node;
typedef typename pick::bucket bucket;
typedef typename pick::link_pointer link_pointer;
typedef boost::unordered::detail::grouped_table_impl<types> table;
typedef boost::unordered::detail::map_extractor<key_type, value_type>
extractor;
typedef typename boost::unordered::detail::pick_policy<K>::type policy;
};
}}}

View File

@ -0,0 +1,57 @@
// Copyright (C) 2005-2016 Daniel James
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/unordered/unordered_set_fwd.hpp>
#include <boost/unordered/detail/equivalent.hpp>
#include <boost/unordered/detail/unique.hpp>
namespace boost { namespace unordered { namespace detail {
template <typename A, typename T, typename H, typename P>
struct set
{
typedef boost::unordered::detail::set<A, T, H, P> types;
typedef A allocator;
typedef T value_type;
typedef H hasher;
typedef P key_equal;
typedef T key_type;
typedef boost::unordered::detail::allocator_traits<allocator> traits;
typedef boost::unordered::detail::pick_node<allocator, value_type> pick;
typedef typename pick::node node;
typedef typename pick::bucket bucket;
typedef typename pick::link_pointer link_pointer;
typedef boost::unordered::detail::table_impl<types> table;
typedef boost::unordered::detail::set_extractor<value_type> extractor;
typedef typename boost::unordered::detail::pick_policy<T>::type policy;
};
template <typename A, typename T, typename H, typename P>
struct multiset
{
typedef boost::unordered::detail::multiset<A, T, H, P> types;
typedef A allocator;
typedef T value_type;
typedef H hasher;
typedef P key_equal;
typedef T key_type;
typedef boost::unordered::detail::allocator_traits<allocator> traits;
typedef boost::unordered::detail::pick_grouped_node<allocator,
value_type> pick;
typedef typename pick::node node;
typedef typename pick::bucket bucket;
typedef typename pick::link_pointer link_pointer;
typedef boost::unordered::detail::grouped_table_impl<types> table;
typedef boost::unordered::detail::set_extractor<value_type> extractor;
typedef typename boost::unordered::detail::pick_policy<T>::type policy;
};
}}}

View File

@ -13,28 +13,12 @@
#endif
#include <boost/unordered/detail/buckets.hpp>
#include <boost/unordered/detail/util.hpp>
#include <boost/type_traits/aligned_storage.hpp>
#include <boost/type_traits/alignment_of.hpp>
#include <cmath>
#if defined(BOOST_MSVC)
#pragma warning(push)
#pragma warning(disable:4127) // conditional expression is constant
#endif
#if defined(BOOST_UNORDERED_DEPRECATED_EQUALITY)
#if defined(__EDG__)
#elif defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__)
#pragma message("Warning: BOOST_UNORDERED_DEPRECATED_EQUALITY is no longer supported.")
#elif defined(__GNUC__) || defined(__HP_aCC) || \
defined(__SUNPRO_CC) || defined(__IBMCPP__)
#warning "BOOST_UNORDERED_DEPRECATED_EQUALITY is no longer supported."
#endif
#endif
namespace boost { namespace unordered { namespace detail {
////////////////////////////////////////////////////////////////////////////
@ -59,6 +43,10 @@ namespace boost { namespace unordered { namespace detail {
sizeof(value_type),
boost::alignment_of<value_type>::value>::type data_;
value_base() :
data_()
{}
void* address() {
return this;
}
@ -76,70 +64,6 @@ namespace boost { namespace unordered { namespace detail {
value_base& operator=(value_base const&);
};
template <typename NodeAlloc>
struct copy_nodes
{
typedef boost::unordered::detail::allocator_traits<NodeAlloc>
node_allocator_traits;
node_constructor<NodeAlloc> constructor;
explicit copy_nodes(NodeAlloc& a) : constructor(a) {}
typename node_allocator_traits::pointer create(
typename node_allocator_traits::value_type::value_type const& v)
{
constructor.construct_with_value2(v);
return constructor.release();
}
};
template <typename NodeAlloc>
struct move_nodes
{
typedef boost::unordered::detail::allocator_traits<NodeAlloc>
node_allocator_traits;
node_constructor<NodeAlloc> constructor;
explicit move_nodes(NodeAlloc& a) : constructor(a) {}
typename node_allocator_traits::pointer create(
typename node_allocator_traits::value_type::value_type& v)
{
constructor.construct_with_value2(boost::move(v));
return constructor.release();
}
};
template <typename Buckets>
struct assign_nodes
{
node_holder<typename Buckets::node_allocator> holder;
explicit assign_nodes(Buckets& b) : holder(b) {}
typename Buckets::node_pointer create(
typename Buckets::value_type const& v)
{
return holder.copy_of(v);
}
};
template <typename Buckets>
struct move_assign_nodes
{
node_holder<typename Buckets::node_allocator> holder;
explicit move_assign_nodes(Buckets& b) : holder(b) {}
typename Buckets::node_pointer create(
typename Buckets::value_type& v)
{
return holder.move_copy_of(v);
}
};
template <typename Types>
struct table :
boost::unordered::detail::functions<
@ -183,15 +107,17 @@ namespace boost { namespace unordered { namespace detail {
bucket_pointer;
typedef boost::unordered::detail::node_constructor<node_allocator>
node_constructor;
typedef boost::unordered::detail::node_tmp<node_allocator>
node_tmp;
typedef boost::unordered::iterator_detail::
iterator<node> iterator;
typedef boost::unordered::iterator_detail::
c_iterator<node, const_node_pointer> c_iterator;
c_iterator<node> c_iterator;
typedef boost::unordered::iterator_detail::
l_iterator<node, policy> l_iterator;
typedef boost::unordered::iterator_detail::
cl_iterator<node, const_node_pointer, policy> cl_iterator;
cl_iterator<node, policy> cl_iterator;
////////////////////////////////////////////////////////////////////////
// Members
@ -262,9 +188,9 @@ namespace boost { namespace unordered { namespace detail {
return prev ? iterator(prev->next_) : iterator();
}
std::size_t hash_to_bucket(std::size_t hash) const
std::size_t hash_to_bucket(std::size_t hash_value) const
{
return policy::to_bucket(bucket_count_, hash);
return policy::to_bucket(bucket_count_, hash_value);
}
float load_factor() const
@ -339,7 +265,7 @@ namespace boost { namespace unordered { namespace detail {
return policy::new_bucket_count(
boost::unordered::detail::double_to_size(floor(
static_cast<double>(size) /
static_cast<double>(mlf_))) + 1);
static_cast<double>(mlf_)) + 1));
}
////////////////////////////////////////////////////////////////////////
@ -399,9 +325,7 @@ namespace boost { namespace unordered { namespace detail {
void init(table const& x)
{
if (x.size_) {
create_buckets(bucket_count_);
copy_nodes<node_allocator> copy(node_alloc());
table_impl::fill_buckets(x.begin(), *this, copy);
static_cast<table_impl*>(this)->copy_buckets(x);
}
}
@ -412,11 +336,7 @@ namespace boost { namespace unordered { namespace detail {
}
else if(x.size_) {
// TODO: Could pick new bucket size?
create_buckets(bucket_count_);
move_nodes<node_allocator> move(node_alloc());
node_holder<node_allocator> nodes(x);
table_impl::fill_buckets(nodes.begin(), *this, move);
static_cast<table_impl*>(this)->move_buckets(x);
}
}
@ -425,34 +345,53 @@ namespace boost { namespace unordered { namespace detail {
void create_buckets(std::size_t new_count)
{
boost::unordered::detail::array_constructor<bucket_allocator>
constructor(bucket_alloc());
// Creates an extra bucket to act as the start node.
constructor.construct(bucket(), new_count + 1);
std::size_t length = new_count + 1;
bucket_pointer new_buckets = bucket_allocator_traits::allocate(
bucket_alloc(), length);
bucket_pointer constructed = new_buckets;
if (buckets_)
{
// Copy the nodes to the new buckets, including the dummy
// node if there is one.
(constructor.get() +
static_cast<std::ptrdiff_t>(new_count))->next_ =
(buckets_ + static_cast<std::ptrdiff_t>(
bucket_count_))->next_;
destroy_buckets();
}
else if (bucket::extra_node)
{
node_constructor a(node_alloc());
a.construct();
BOOST_TRY {
bucket_pointer end = new_buckets
+ static_cast<std::ptrdiff_t>(length);
for(; constructed != end; ++constructed) {
new ((void*) boost::addressof(*constructed)) bucket();
}
(constructor.get() +
static_cast<std::ptrdiff_t>(new_count))->next_ =
a.release();
if (buckets_)
{
// Copy the nodes to the new buckets, including the dummy
// node if there is one.
(new_buckets +
static_cast<std::ptrdiff_t>(new_count))->next_ =
(buckets_ + static_cast<std::ptrdiff_t>(
bucket_count_))->next_;
destroy_buckets();
}
else if (bucket::extra_node)
{
node_constructor a(node_alloc());
a.create_node();
(new_buckets +
static_cast<std::ptrdiff_t>(new_count))->next_ =
a.release();
}
}
BOOST_CATCH(...) {
for(bucket_pointer p = new_buckets; p != constructed; ++p) {
boost::unordered::detail::func::destroy(
boost::addressof(*p));
}
bucket_allocator_traits::deallocate(bucket_alloc(),
new_buckets, length);
BOOST_RETHROW;
}
BOOST_CATCH_END
bucket_count_ = new_count;
buckets_ = constructor.release();
buckets_ = new_buckets;
recalculate_max_load();
}
@ -496,9 +435,11 @@ namespace boost { namespace unordered { namespace detail {
op2.commit();
}
// Only call with nodes allocated with the currect allocator, or
// one that is equal to it. (Can't assert because other's
// allocators might have already been moved).
void move_buckets_from(table& other)
{
BOOST_ASSERT(node_alloc() == other.node_alloc());
BOOST_ASSERT(!buckets_);
buckets_ = other.buckets_;
bucket_count_ = other.bucket_count_;
@ -523,8 +464,7 @@ namespace boost { namespace unordered { namespace detail {
boost::unordered::detail::func::destroy_value_impl(node_alloc(),
n->value_ptr());
node_allocator_traits::destroy(node_alloc(),
boost::addressof(*n));
boost::unordered::detail::func::destroy(boost::addressof(*n));
node_allocator_traits::deallocate(node_alloc(), n, 1);
--size_;
}
@ -551,7 +491,7 @@ namespace boost { namespace unordered { namespace detail {
if (bucket::extra_node) {
node_pointer n = static_cast<node_pointer>(
get_bucket(bucket_count_)->next_);
node_allocator_traits::destroy(node_alloc(),
boost::unordered::detail::func::destroy(
boost::addressof(*n));
node_allocator_traits::deallocate(node_alloc(), n, 1);
}
@ -588,7 +528,7 @@ namespace boost { namespace unordered { namespace detail {
bucket_pointer end = get_bucket(bucket_count_ + 1);
for(bucket_pointer it = buckets_; it != end; ++it)
{
bucket_allocator_traits::destroy(bucket_alloc(),
boost::unordered::detail::func::destroy(
boost::addressof(*it));
}
@ -657,11 +597,7 @@ namespace boost { namespace unordered { namespace detail {
clear_buckets();
}
// assign_nodes takes ownership of the container's elements,
// assigning to them if possible, and deleting any that are
// left over.
assign_nodes<table> assign(*this);
table_impl::fill_buckets(x.begin(), *this, assign);
static_cast<table_impl*>(this)->assign_buckets(x);
}
void assign(table const& x, true_type)
@ -686,9 +622,7 @@ namespace boost { namespace unordered { namespace detail {
// Finally copy the elements.
if (x.size_) {
create_buckets(bucket_count_);
copy_nodes<node_allocator> copy(node_alloc());
table_impl::fill_buckets(x.begin(), *this, copy);
static_cast<table_impl*>(this)->copy_buckets(x);
}
}
}
@ -707,15 +641,25 @@ namespace boost { namespace unordered { namespace detail {
void move_assign(table& x, true_type)
{
delete_buckets();
set_hash_functions new_func_this(*this, x);
allocators_.move_assign(x.allocators_);
move_assign_no_alloc(x);
// No throw from here.
mlf_ = x.mlf_;
max_load_ = x.max_load_;
move_buckets_from(x);
new_func_this.commit();
}
void move_assign(table& x, false_type)
{
if (node_alloc() == x.node_alloc()) {
delete_buckets();
move_assign_no_alloc(x);
set_hash_functions new_func_this(*this, x);
// No throw from here.
mlf_ = x.mlf_;
max_load_ = x.max_load_;
move_buckets_from(x);
new_func_this.commit();
}
else {
set_hash_functions new_func_this(*this, x);
@ -732,24 +676,9 @@ namespace boost { namespace unordered { namespace detail {
clear_buckets();
}
// move_assign_nodes takes ownership of the container's
// elements, assigning to them if possible, and deleting
// any that are left over.
move_assign_nodes<table> assign(*this);
node_holder<node_allocator> nodes(x);
table_impl::fill_buckets(nodes.begin(), *this, assign);
static_cast<table_impl*>(this)->move_assign_buckets(x);
}
}
void move_assign_no_alloc(table& x)
{
set_hash_functions new_func_this(*this, x);
// No throw from here.
mlf_ = x.mlf_;
max_load_ = x.max_load_;
move_buckets_from(x);
new_func_this.commit();
}
// Accessors

View File

@ -12,7 +12,6 @@
#pragma once
#endif
#include <boost/unordered/detail/table.hpp>
#include <boost/unordered/detail/extract_key.hpp>
#include <boost/throw_exception.hpp>
#include <stdexcept>
@ -28,7 +27,9 @@ namespace boost { namespace unordered { namespace detail {
boost::unordered::detail::value_base<T>
{
typedef typename ::boost::unordered::detail::rebind_wrap<
A, unique_node<A, T> >::type::pointer node_pointer;
A, unique_node<A, T> >::type allocator;
typedef typename ::boost::unordered::detail::
allocator_traits<allocator>::pointer node_pointer;
typedef node_pointer link_pointer;
link_pointer next_;
@ -49,14 +50,15 @@ namespace boost { namespace unordered { namespace detail {
template <typename T>
struct ptr_node :
boost::unordered::detail::value_base<T>,
boost::unordered::detail::ptr_bucket
{
typedef T value_type;
typedef boost::unordered::detail::ptr_bucket bucket_base;
typedef ptr_node<T>* node_pointer;
typedef ptr_bucket* link_pointer;
std::size_t hash_;
boost::unordered::detail::value_base<T> value_base_;
ptr_node() :
bucket_base(),
@ -67,6 +69,10 @@ namespace boost { namespace unordered { namespace detail {
{
}
void* address() { return value_base_.address(); }
value_type& value() { return value_base_.value(); }
value_type* value_ptr() { return value_base_.value_ptr(); }
private:
ptr_node& operator=(ptr_node const&);
};
@ -119,54 +125,6 @@ namespace boost { namespace unordered { namespace detail {
typedef typename pick::link_pointer link_pointer;
};
template <typename A, typename T, typename H, typename P>
struct set
{
typedef boost::unordered::detail::set<A, T, H, P> types;
typedef A allocator;
typedef T value_type;
typedef H hasher;
typedef P key_equal;
typedef T key_type;
typedef boost::unordered::detail::allocator_traits<allocator> traits;
typedef boost::unordered::detail::pick_node<allocator, value_type> pick;
typedef typename pick::node node;
typedef typename pick::bucket bucket;
typedef typename pick::link_pointer link_pointer;
typedef boost::unordered::detail::table_impl<types> table;
typedef boost::unordered::detail::set_extractor<value_type> extractor;
typedef boost::unordered::detail::pick_policy::type policy;
};
template <typename A, typename K, typename M, typename H, typename P>
struct map
{
typedef boost::unordered::detail::map<A, K, M, H, P> types;
typedef A allocator;
typedef std::pair<K const, M> value_type;
typedef H hasher;
typedef P key_equal;
typedef K key_type;
typedef boost::unordered::detail::allocator_traits<allocator>
traits;
typedef boost::unordered::detail::pick_node<allocator, value_type> pick;
typedef typename pick::node node;
typedef typename pick::bucket bucket;
typedef typename pick::link_pointer link_pointer;
typedef boost::unordered::detail::table_impl<types> table;
typedef boost::unordered::detail::map_extractor<key_type, value_type>
extractor;
typedef boost::unordered::detail::pick_policy::type policy;
};
template <typename Types>
struct table_impl : boost::unordered::detail::table<Types>
{
@ -183,6 +141,7 @@ namespace boost { namespace unordered { namespace detail {
typedef typename table::key_equal key_equal;
typedef typename table::key_type key_type;
typedef typename table::node_constructor node_constructor;
typedef typename table::node_tmp node_tmp;
typedef typename table::extractor extractor;
typedef typename table::iterator iterator;
typedef typename table::c_iterator c_iterator;
@ -301,10 +260,9 @@ namespace boost { namespace unordered { namespace detail {
// Emplace/Insert
inline iterator add_node(
node_constructor& a,
node_pointer n,
std::size_t key_hash)
{
node_pointer n = a.release();
n->hash_ = key_hash;
bucket_pointer b = this->get_bucket(this->hash_to_bucket(key_hash));
@ -333,23 +291,21 @@ namespace boost { namespace unordered { namespace detail {
return iterator(n);
}
inline iterator resize_and_add_node(node_pointer n, std::size_t key_hash)
{
node_tmp b(n, this->node_alloc());
this->reserve_for_insert(this->size_ + 1);
return this->add_node(b.release(), key_hash);
}
value_type& operator[](key_type const& k)
{
std::size_t key_hash = this->hash(k);
iterator pos = this->find_node(key_hash, k);
if (pos.node_) return *pos;
// Create the node before rehashing in case it throws an
// exception (need strong safety in such a case).
node_constructor a(this->node_alloc());
a.construct_with_value(BOOST_UNORDERED_EMPLACE_ARGS3(
boost::unordered::piecewise_construct,
boost::make_tuple(k),
boost::make_tuple()));
this->reserve_for_insert(this->size_ + 1);
return *add_node(a, key_hash);
return *this->resize_and_add_node(
boost::unordered::detail::func::construct_pair(this->node_alloc(), k),
key_hash);
}
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
@ -399,32 +355,17 @@ namespace boost { namespace unordered { namespace detail {
{
std::size_t key_hash = this->hash(k);
iterator pos = this->find_node(key_hash, k);
if (pos.node_) return emplace_return(pos, false);
// Create the node before rehashing in case it throws an
// exception (need strong safety in such a case).
node_constructor a(this->node_alloc());
a.construct_with_value(BOOST_UNORDERED_EMPLACE_FORWARD);
// reserve has basic exception safety if the hash function
// throws, strong otherwise.
this->reserve_for_insert(this->size_ + 1);
return emplace_return(this->add_node(a, key_hash), true);
}
emplace_return emplace_impl_with_node(node_constructor& a)
{
key_type const& k = this->get_key(a.value());
std::size_t key_hash = this->hash(k);
iterator pos = this->find_node(key_hash, k);
if (pos.node_) return emplace_return(pos, false);
// reserve has basic exception safety if the hash function
// throws, strong otherwise.
this->reserve_for_insert(this->size_ + 1);
return emplace_return(this->add_node(a, key_hash), true);
if (pos.node_) {
return emplace_return(pos, false);
}
else {
return emplace_return(
this->resize_and_add_node(
boost::unordered::detail::func::construct_value_generic(
this->node_alloc(), BOOST_UNORDERED_EMPLACE_FORWARD),
key_hash),
true);
}
}
template <BOOST_UNORDERED_EMPLACE_TEMPLATE>
@ -432,9 +373,21 @@ namespace boost { namespace unordered { namespace detail {
{
// Don't have a key, so construct the node first in order
// to be able to lookup the position.
node_constructor a(this->node_alloc());
a.construct_with_value(BOOST_UNORDERED_EMPLACE_FORWARD);
return emplace_impl_with_node(a);
node_tmp b(
boost::unordered::detail::func::construct_value_generic(
this->node_alloc(), BOOST_UNORDERED_EMPLACE_FORWARD),
this->node_alloc());
key_type const& k = this->get_key(b.node_->value());
std::size_t key_hash = this->hash(k);
iterator pos = this->find_node(key_hash, k);
if (pos.node_) {
return emplace_return(pos, false);
}
else {
return emplace_return(
this->resize_and_add_node(b.release(), key_hash),
true);
}
}
////////////////////////////////////////////////////////////////////////
@ -453,9 +406,7 @@ namespace boost { namespace unordered { namespace detail {
template <class InputIt>
void insert_range_impl(key_type const& k, InputIt i, InputIt j)
{
node_constructor a(this->node_alloc());
insert_range_impl2(a, k, i, j);
insert_range_impl2(k, i, j);
while(++i != j) {
// Note: can't use get_key as '*i' might not be value_type - it
@ -466,26 +417,25 @@ namespace boost { namespace unordered { namespace detail {
// key here. Could be more efficient if '*i' is expensive. Could
// be less efficient if copying the full value_type is
// expensive.
insert_range_impl2(a, extractor::extract(*i), i, j);
insert_range_impl2(extractor::extract(*i), i, j);
}
}
template <class InputIt>
void insert_range_impl2(node_constructor& a, key_type const& k,
InputIt i, InputIt j)
void insert_range_impl2(key_type const& k, InputIt i, InputIt j)
{
// No side effects in this initial code
std::size_t key_hash = this->hash(k);
iterator pos = this->find_node(key_hash, k);
if (!pos.node_) {
a.construct_with_value2(*i);
node_tmp b(
boost::unordered::detail::func::construct_value(this->node_alloc(), *i),
this->node_alloc());
if(this->size_ + 1 > this->max_load_)
this->reserve_for_insert(this->size_ +
boost::unordered::detail::insert_size(i, j));
// Nothing after this point can throw.
this->add_node(a, key_hash);
this->add_node(b.release(), key_hash);
}
}
@ -495,8 +445,24 @@ namespace boost { namespace unordered { namespace detail {
node_constructor a(this->node_alloc());
do {
a.construct_with_value2(*i);
emplace_impl_with_node(a);
if (!a.node_) { a.create_node(); }
boost::unordered::detail::func::call_construct(
a.alloc_, a.node_->value_ptr(), *i);
node_tmp b(a.release(), a.alloc_);
key_type const& k = this->get_key(b.node_->value());
std::size_t key_hash = this->hash(k);
iterator pos = this->find_node(key_hash, k);
if (pos.node_) {
a.reclaim(b.release());
}
else {
// reserve has basic exception safety if the hash function
// throws, strong otherwise.
this->reserve_for_insert(this->size_ + 1);
this->add_node(b.release(), key_hash);
}
} while(++i != j);
}
@ -530,9 +496,9 @@ namespace boost { namespace unordered { namespace detail {
link_pointer end = static_cast<node_pointer>(prev->next_)->next_;
std::size_t count = this->delete_nodes(prev, end);
std::size_t deleted_count = this->delete_nodes(prev, end);
this->fix_bucket(bucket_index, prev);
return count;
return deleted_count;
}
iterator erase(c_iterator r)
@ -551,38 +517,57 @@ namespace boost { namespace unordered { namespace detail {
return iterator(r2.node_);
}
void erase_nodes(node_pointer begin, node_pointer end)
void erase_nodes(node_pointer i, node_pointer j)
{
std::size_t bucket_index = this->hash_to_bucket(begin->hash_);
std::size_t bucket_index = this->hash_to_bucket(i->hash_);
// Find the node before begin.
// Find the node before i.
link_pointer prev = this->get_previous_start(bucket_index);
while(prev->next_ != begin) prev = prev->next_;
while(prev->next_ != i) prev = prev->next_;
// Delete the nodes.
do {
this->delete_node(prev);
bucket_index = this->fix_bucket(bucket_index, prev);
} while (prev->next_ != end);
} while (prev->next_ != j);
}
////////////////////////////////////////////////////////////////////////
// fill_buckets
template <class NodeCreator>
static void fill_buckets(iterator n, table& dst,
NodeCreator& creator)
void copy_buckets(table const& src) {
this->create_buckets(this->bucket_count_);
for(iterator n = src.begin(); n.node_; ++n) {
this->add_node(
boost::unordered::detail::func::construct_value(
this->node_alloc(), *n), n.node_->hash_);
}
}
void move_buckets(table const& src) {
this->create_buckets(this->bucket_count_);
for(iterator n = src.begin(); n.node_; ++n) {
this->add_node(
boost::unordered::detail::func::construct_value(
this->node_alloc(), boost::move(*n)), n.node_->hash_);
}
}
void assign_buckets(table const& src)
{
link_pointer prev = dst.get_previous_start();
node_holder<node_allocator> holder(*this);
for(iterator n = src.begin(); n.node_; ++n) {
this->add_node(holder.copy_of(*n), n.node_->hash_);
}
}
while (n.node_) {
node_pointer node = creator.create(*n);
node->hash_ = n.node_->hash_;
prev->next_ = node;
++dst.size_;
++n;
prev = place_in_bucket(dst, prev);
void move_assign_buckets(table& src)
{
node_holder<node_allocator> holder(*this);
for(iterator n = src.begin(); n.node_; ++n) {
this->add_node(holder.move_copy_of(*n), n.node_->hash_);
}
}

View File

@ -124,33 +124,16 @@ namespace boost { namespace unordered { namespace detail {
////////////////////////////////////////////////////////////////////////////
// insert_size/initial_size
#if !defined(BOOST_NO_STD_DISTANCE)
using ::std::distance;
#else
template <class ForwardIterator>
inline std::size_t distance(ForwardIterator i, ForwardIterator j) {
std::size_t x;
std::distance(i, j, x);
return x;
}
#endif
template <class I>
inline typename
boost::unordered::detail::enable_if_forward<I, std::size_t>::type
insert_size(I i, I j)
inline std::size_t insert_size(I i, I j, typename
boost::unordered::detail::enable_if_forward<I, void*>::type = 0)
{
return std::distance(i, j);
}
template <class I>
inline typename
boost::unordered::detail::disable_if_forward<I, std::size_t>::type
insert_size(I, I)
inline std::size_t insert_size(I, I, typename
boost::unordered::detail::disable_if_forward<I, void*>::type = 0)
{
return 1;
}

View File

@ -15,9 +15,7 @@
#endif
#include <boost/unordered/unordered_map_fwd.hpp>
#include <boost/unordered/detail/equivalent.hpp>
#include <boost/unordered/detail/unique.hpp>
#include <boost/unordered/detail/util.hpp>
#include <boost/unordered/detail/map.hpp>
#include <boost/functional/hash.hpp>
#include <boost/move/move.hpp>

View File

@ -14,10 +14,7 @@
#pragma once
#endif
#include <boost/unordered/unordered_set_fwd.hpp>
#include <boost/unordered/detail/equivalent.hpp>
#include <boost/unordered/detail/unique.hpp>
#include <boost/unordered/detail/util.hpp>
#include <boost/unordered/detail/set.hpp>
#include <boost/functional/hash.hpp>
#include <boost/move/move.hpp>

17
meta/libraries.json Normal file
View File

@ -0,0 +1,17 @@
{
"key": "unordered",
"name": "Unordered",
"authors": [
"Daniel James"
],
"maintainers": [
"Daniel James <dnljms -at- gmail.com>"
],
"description": "Unordered associative containers.",
"std": [
"tr1"
],
"category": [
"Containers"
]
}

View File

@ -5,5 +5,75 @@
import testing ;
build-project unordered ;
build-project exception ;
project unordered-test/unordered
: requirements
<warnings>all
<toolset>intel:<warnings>on
# Would be nice to define -Wundef, but I'm getting warnings from
# Boost.Preprocessor on trunk.
<toolset>gcc:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion -Wfloat-equal -Wshadow -Wno-long-long"
<toolset>darwin:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion -Wfloat-equal -Wshadow"
<toolset>clang:<cxxflags>"-pedantic -Wextra -Wno-long-long"
;
#alias framework : /boost/test//boost_unit_test_framework ;
alias framework : ;
test-suite unordered
:
[ run unordered/fwd_set_test.cpp ]
[ run unordered/fwd_map_test.cpp ]
[ run unordered/allocator_traits.cpp ]
[ run unordered/minimal_allocator.cpp ]
[ run unordered/compile_set.cpp ]
[ run unordered/compile_map.cpp ]
[ run unordered/noexcept_tests.cpp ]
[ run unordered/link_test_1.cpp unordered/link_test_2.cpp ]
[ run unordered/incomplete_test.cpp ]
[ run unordered/simple_tests.cpp ]
[ run unordered/equivalent_keys_tests.cpp ]
[ run unordered/constructor_tests.cpp ]
[ run unordered/copy_tests.cpp ]
[ run unordered/move_tests.cpp ]
[ run unordered/assign_tests.cpp ]
[ run unordered/insert_tests.cpp ]
[ run unordered/insert_stable_tests.cpp ]
[ run unordered/unnecessary_copy_tests.cpp ]
[ run unordered/erase_tests.cpp ]
[ run unordered/erase_equiv_tests.cpp ]
[ run unordered/find_tests.cpp ]
[ run unordered/at_tests.cpp ]
[ run unordered/bucket_tests.cpp ]
[ run unordered/load_factor_tests.cpp ]
[ run unordered/rehash_tests.cpp ]
[ run unordered/equality_tests.cpp ]
[ run unordered/swap_tests.cpp ]
[ run unordered/compile_set.cpp : :
: <define>BOOST_UNORDERED_USE_MOVE
: bmove_compile_set ]
[ run unordered/compile_map.cpp : :
: <define>BOOST_UNORDERED_USE_MOVE
: bmove_compile_map ]
[ run unordered/copy_tests.cpp : :
: <define>BOOST_UNORDERED_USE_MOVE
: bmove_copy ]
[ run unordered/move_tests.cpp : :
: <define>BOOST_UNORDERED_USE_MOVE
: bmove_move ]
[ run unordered/assign_tests.cpp : :
: <define>BOOST_UNORDERED_USE_MOVE
: bmove_assign ]
;
test-suite unordered-exception
:
[ run exception/constructor_exception_tests.cpp framework ]
[ run exception/copy_exception_tests.cpp framework ]
[ run exception/assign_exception_tests.cpp framework ]
[ run exception/insert_exception_tests.cpp framework ]
[ run exception/erase_exception_tests.cpp framework ]
[ run exception/rehash_exception_tests.cpp framework ]
[ run exception/swap_exception_tests.cpp framework : : :
<define>BOOST_UNORDERED_SWAP_METHOD=2 ]
;

View File

@ -1,34 +0,0 @@
# Copyright 2006-2008 Daniel James.
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
import testing ;
#alias framework : /boost/test//boost_unit_test_framework ;
alias framework : ;
project unordered-test/exception-tests
: requirements
<warnings>all
<toolset>intel:<warnings>on
<toolset>gcc:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter"
<toolset>darwin:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter"
#<toolset>gcc:<define>_GLIBCXX_DEBUG
#<toolset>darwin:<define>_GLIBCXX_DEBUG
#<toolset>msvc:<warnings-as-errors>on
#<toolset>gcc:<warnings-as-errors>on
#<toolset>darwin:<warnings-as-errors>on
;
test-suite unordered-exception
:
[ run constructor_exception_tests.cpp framework ]
[ run copy_exception_tests.cpp framework ]
[ run assign_exception_tests.cpp framework ]
[ run insert_exception_tests.cpp framework ]
[ run erase_exception_tests.cpp framework ]
[ run rehash_exception_tests.cpp framework ]
[ run swap_exception_tests.cpp framework : : :
<define>BOOST_UNORDERED_SWAP_METHOD=2 ]
;

View File

@ -38,21 +38,18 @@ struct self_assign_test2 : self_assign_base<T>
template <class T>
struct assign_base : public test::exception_base
{
const test::random_values<T> x_values, y_values;
test::random_values<T> x_values, y_values;
T x,y;
typedef BOOST_DEDUCED_TYPENAME T::hasher hasher;
typedef BOOST_DEDUCED_TYPENAME T::key_equal key_equal;
typedef BOOST_DEDUCED_TYPENAME T::allocator_type allocator_type;
assign_base(unsigned int count1, unsigned int count2, int tag1, int tag2,
float mlf1 = 1.0, float mlf2 = 1.0) :
x_values(count1),
y_values(count2),
x(x_values.begin(), x_values.end(), 0, hasher(tag1), key_equal(tag1),
allocator_type(tag1)),
y(y_values.begin(), y_values.end(), 0, hasher(tag2), key_equal(tag2),
allocator_type(tag2))
assign_base(int tag1, int tag2, float mlf1 = 1.0, float mlf2 = 1.0) :
x_values(),
y_values(),
x(0, hasher(tag1), key_equal(tag1), allocator_type(tag1)),
y(0, hasher(tag2), key_equal(tag2), allocator_type(tag2))
{
x.max_load_factor(mlf1);
y.max_load_factor(mlf2);
@ -66,47 +63,80 @@ struct assign_base : public test::exception_base
test::check_equivalent_keys(x1);
// If the container is empty at the point of the exception, the
// internal structure is hidden, this exposes it.
T& y = const_cast<T&>(x1);
// internal structure is hidden, this exposes it, at the cost of
// messing up the data.
if (x_values.size()) {
y.emplace(*x_values.begin());
test::check_equivalent_keys(y);
T& x2 = const_cast<T&>(x1);
x2.emplace(*x_values.begin());
test::check_equivalent_keys(x2);
}
}
};
template <class T>
struct assign_test1 : assign_base<T>
struct assign_values : assign_base<T>
{
assign_test1() : assign_base<T>(0, 0, 0, 0) {}
assign_values(unsigned int count1, unsigned int count2,
int tag1, int tag2, float mlf1 = 1.0, float mlf2 = 1.0) :
assign_base<T>(tag1, tag2, mlf1, mlf2)
{
this->x_values.fill(count1);
this->y_values.fill(count2);
this->x.insert(this->x_values.begin(), this->x_values.end());
this->y.insert(this->y_values.begin(), this->y_values.end());
}
};
template <class T>
struct assign_test2 : assign_base<T>
struct assign_test1 : assign_values<T>
{
assign_test2() : assign_base<T>(60, 0, 0, 0) {}
assign_test1() : assign_values<T>(0, 0, 0, 0) {}
};
template <class T>
struct assign_test3 : assign_base<T>
struct assign_test2 : assign_values<T>
{
assign_test3() : assign_base<T>(0, 60, 0, 0) {}
assign_test2() : assign_values<T>(60, 0, 0, 0) {}
};
template <class T>
struct assign_test4 : assign_base<T>
struct assign_test3 : assign_values<T>
{
assign_test4() : assign_base<T>(10, 10, 1, 2) {}
assign_test3() : assign_values<T>(0, 60, 0, 0) {}
};
template <class T>
struct assign_test5 : assign_base<T>
struct assign_test4 : assign_values<T>
{
assign_test5() : assign_base<T>(5, 60, 0, 0, 1.0, 0.1) {}
assign_test4() : assign_values<T>(10, 10, 1, 2) {}
};
template <class T>
struct assign_test5 : assign_values<T>
{
assign_test5() : assign_values<T>(5, 60, 0, 0, 1.0f, 0.1f) {}
};
template <class T>
struct equivalent_test1 : assign_base<T>
{
equivalent_test1() :
assign_base<T>(0, 0)
{
test::random_values<T> x_values2(10);
this->x_values.insert(x_values2.begin(), x_values2.end());
this->x_values.insert(x_values2.begin(), x_values2.end());
test::random_values<T> y_values2(10);
this->y_values.insert(y_values2.begin(), y_values2.end());
this->y_values.insert(y_values2.begin(), y_values2.end());
this->x.insert(this->x_values.begin(), this->x_values.end());
this->y.insert(this->y_values.begin(), this->y_values.end());
}
};
EXCEPTION_TESTS(
(self_assign_test1)(self_assign_test2)
(assign_test1)(assign_test2)(assign_test3)(assign_test4)(assign_test5),
(assign_test1)(assign_test2)(assign_test3)(assign_test4)(assign_test5)
(equivalent_test1),
CONTAINER_SEQ)
RUN_TESTS()

View File

@ -18,8 +18,8 @@ struct rehash_test_base : public test::exception_base
{
test::random_values<T> values;
unsigned int n;
rehash_test_base(unsigned int count = 100, unsigned int n = 0)
: values(count), n(n)
rehash_test_base(unsigned int count = 100, unsigned int n_ = 0)
: values(count), n(n_)
{}
typedef T data_type;

View File

@ -66,8 +66,8 @@ struct swap_base : public test::exception_base
{}
struct data_type {
data_type(T const& x, T const& y)
: x(x), y(y) {}
data_type(T const& x_, T const& y_)
: x(x_), y(y_) {}
T x, y;
};

View File

@ -7,8 +7,8 @@
#define BOOST_UNORDERED_TEST_HELPERS_INPUT_ITERATOR_HEADER
#include <boost/config.hpp>
#include <boost/iterator.hpp>
#include <boost/iterator/iterator_traits.hpp>
#include <iterator>
namespace test
{
@ -28,7 +28,7 @@ namespace test
template <class Iterator>
struct input_iterator_adaptor
: public boost::iterator<
: public std::iterator<
std::input_iterator_tag,
BOOST_DEDUCED_TYPENAME boost::iterator_value<Iterator>::type,
std::ptrdiff_t,
@ -72,7 +72,7 @@ namespace test
template <class Iterator>
struct copy_iterator_adaptor
: public boost::iterator<
: public std::iterator<
BOOST_DEDUCED_TYPENAME boost::iterator_category<Iterator>::type,
BOOST_DEDUCED_TYPENAME boost::iterator_value<Iterator>::type,
BOOST_DEDUCED_TYPENAME boost::iterator_difference<Iterator>::type,

View File

@ -105,7 +105,8 @@ namespace test
i = 0; i < x1.bucket_count(); ++i)
{
for (BOOST_DEDUCED_TYPENAME X::const_local_iterator
begin = x1.begin(i), end = x1.end(i); begin != end; ++begin)
begin2 = x1.begin(i), end2 = x1.end(i);
begin2 != end2; ++begin2)
{
++bucket_size;
}

View File

@ -11,8 +11,8 @@
#if !defined(UNORDERED_TEST_LIST_HEADER)
#define UNORDERED_TEST_LIST_HEADER
#include <boost/iterator.hpp>
#include <boost/limits.hpp>
#include <iterator>
#include <functional>
namespace test
@ -83,7 +83,7 @@ namespace test
template <typename T>
class list_iterator
: public boost::iterator<
: public std::iterator<
std::forward_iterator_tag, T,
int, T*, T&>
{
@ -109,7 +109,7 @@ namespace test
template <typename T>
class list_const_iterator
: public boost::iterator<
: public std::iterator<
std::forward_iterator_tag, T,
int, T const*, T const&>
{

View File

@ -41,7 +41,7 @@ namespace test
int count = type_ == generate_collisions ?
1 + (generate(int_ptr) % 5) : 1;
for(int i = 0; i < count; ++i) {
for(int j = 0; j < count; ++j) {
x.push_back(value);
}
}
@ -71,7 +71,7 @@ namespace test
int count = type_ == generate_collisions ?
1 + (generate(int_ptr) % 5) : 1;
for(int i = 0; i < count; ++i) {
for(int j = 0; j < count; ++j) {
x.push_back(std::pair<key_type const, mapped_type>(
key, generate(mapped_ptr)));
}
@ -103,8 +103,16 @@ namespace test
struct random_values
: public test::list<BOOST_DEDUCED_TYPENAME X::value_type>
{
random_values(int count, test::random_generator const& generator =
random_values() {}
explicit random_values(int count, test::random_generator const& generator =
test::default_generator)
{
fill(count, generator);
}
void fill(int count, test::random_generator const& generator =
test::default_generator)
{
test::unordered_generator<X> gen(generator);
gen.fill(*this, count);

View File

@ -148,7 +148,7 @@ namespace test
return ptr;
}
pointer allocate(size_type n, void const* u)
pointer allocate(size_type n, void const*)
{
pointer ptr(static_cast<T*>(::operator new(n * sizeof(T))));
detail::tracker.track_allocate((void*) ptr, n, sizeof(T), tag_);

View File

@ -314,7 +314,7 @@ namespace exception
//return pointer(static_cast<T*>(::operator new(n * sizeof(T))));
}
pointer allocate(size_type n, void const* u)
pointer allocate(size_type n, void const*)
{
T* ptr = 0;
UNORDERED_SCOPE(allocator::allocate(size_type, const_pointer)) {
@ -494,7 +494,7 @@ namespace exception
//return pointer(static_cast<T*>(::operator new(n * sizeof(T))));
}
pointer allocate(size_type n, void const* u)
pointer allocate(size_type n, void const*)
{
T* ptr = 0;
UNORDERED_SCOPE(allocator2::allocate(size_type, const_pointer)) {

View File

@ -19,6 +19,12 @@
#pragma warning(disable:4100) // unreferenced formal parameter
#endif
#if !BOOST_WORKAROUND(BOOST_MSVC, == 1500)
#define BOOST_UNORDERED_CHECK_ADDR_OPERATOR_NOT_USED 1
#else
#define BOOST_UNORDERED_CHECK_ADDR_OPERATOR_NOT_USED 0
#endif
namespace test
{
namespace minimal
@ -29,7 +35,9 @@ namespace minimal
class default_assignable;
class assignable;
struct ampersand_operator_used {};
struct ampersand_operator_used {
ampersand_operator_used() { BOOST_TEST(false); }
};
template <class T> class hash;
template <class T> class equal_to;
@ -48,6 +56,7 @@ namespace minimal
public:
destructible(constructor_param const&) {}
~destructible() {}
void dummy_member() const {}
private:
destructible(destructible const&);
destructible& operator=(destructible const&);
@ -59,6 +68,7 @@ namespace minimal
copy_constructible(constructor_param const&) {}
copy_constructible(copy_constructible const&) {}
~copy_constructible() {}
void dummy_member() const {}
private:
copy_constructible& operator=(copy_constructible const&);
copy_constructible() {}
@ -78,11 +88,15 @@ namespace minimal
{
}
void dummy_member() const {}
private:
copy_constructible_equality_comparable& operator=(
copy_constructible_equality_comparable const&);
copy_constructible_equality_comparable() {}
ampersand_operator_used operator&() const { return ampersand_operator_used(); }
#if BOOST_UNORDERED_CHECK_ADDR_OPERATOR_NOT_USED
ampersand_operator_used operator&() const {
return ampersand_operator_used(); }
#endif
};
bool operator==(
@ -121,9 +135,12 @@ namespace minimal
{
}
private:
void dummy_member() const {}
#if BOOST_UNORDERED_CHECK_ADDR_OPERATOR_NOT_USED
ampersand_operator_used operator&() const {
return ampersand_operator_used(); }
#endif
};
class assignable
@ -133,11 +150,13 @@ namespace minimal
assignable(assignable const&) {}
assignable& operator=(assignable const&) { return *this; }
~assignable() {}
void dummy_member() const {}
private:
assignable() {}
// TODO: This messes up a concept check in the tests.
//ampersand_operator_used operator&() const { return ampersand_operator_used(); }
#if BOOST_UNORDERED_CHECK_ADDR_OPERATOR_NOT_USED
ampersand_operator_used operator&() const {
return ampersand_operator_used(); }
#endif
};
struct movable_init {};
@ -153,6 +172,7 @@ namespace minimal
movable1(BOOST_RV_REF(movable1)) {}
movable1& operator=(BOOST_RV_REF(movable1)) { return *this; }
~movable1() {}
void dummy_member() const {}
};
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
@ -164,6 +184,7 @@ namespace minimal
movable2(movable2&&) {}
~movable2() {}
movable2& operator=(movable2&&) { return *this; }
void dummy_member() const {}
private:
movable2() {}
movable2(movable2 const&);
@ -184,8 +205,10 @@ namespace minimal
~hash() {}
std::size_t operator()(T const&) const { return 0; }
private:
ampersand_operator_used operator&() const { return ampersand_operator_used(); }
#if BOOST_UNORDERED_CHECK_ADDR_OPERATOR_NOT_USED
ampersand_operator_used operator&() const {
return ampersand_operator_used(); }
#endif
};
template <class T>
@ -199,8 +222,10 @@ namespace minimal
~equal_to() {}
bool operator()(T const&, T const&) const { return true; }
private:
ampersand_operator_used operator&() const { return ampersand_operator_used(); }
#if BOOST_UNORDERED_CHECK_ADDR_OPERATOR_NOT_USED
ampersand_operator_used operator&() const {
return ampersand_operator_used(); }
#endif
};
template <class T> class ptr;
@ -288,9 +313,10 @@ namespace minimal
bool operator>(ptr const& x) const { return ptr_ > x.ptr_; }
bool operator<=(ptr const& x) const { return ptr_ <= x.ptr_; }
bool operator>=(ptr const& x) const { return ptr_ >= x.ptr_; }
private:
// TODO:
//ampersand_operator_used operator&() const { return ampersand_operator_used(); }
#if BOOST_UNORDERED_CHECK_ADDR_OPERATOR_NOT_USED
ampersand_operator_used operator&() const {
return ampersand_operator_used(); }
#endif
};
template <class T>
@ -325,9 +351,10 @@ namespace minimal
bool operator>(const_ptr const& x) const { return ptr_ > x.ptr_; }
bool operator<=(const_ptr const& x) const { return ptr_ <= x.ptr_; }
bool operator>=(const_ptr const& x) const { return ptr_ >= x.ptr_; }
private:
// TODO:
//ampersand_operator_used operator&() const { return ampersand_operator_used(); }
#if BOOST_UNORDERED_CHECK_ADDR_OPERATOR_NOT_USED
ampersand_operator_used operator&() const {
return ampersand_operator_used(); }
#endif
};
template <class T>
@ -359,7 +386,7 @@ namespace minimal
}
template <class Y>
pointer allocate(size_type n, const_ptr<Y> u)
pointer allocate(size_type n, const_ptr<Y>)
{
return pointer(static_cast<T*>(::operator new(n * sizeof(T))));
}
@ -387,8 +414,10 @@ namespace minimal
#else
private: allocator& operator=(allocator const&);
#endif
private:
ampersand_operator_used operator&() const { return ampersand_operator_used(); }
#if BOOST_UNORDERED_CHECK_ADDR_OPERATOR_NOT_USED
ampersand_operator_used operator&() const {
return ampersand_operator_used(); }
#endif
};
template <class T>
@ -433,7 +462,7 @@ namespace minimal
}
template <class Y>
T* allocate(std::size_t n, const_ptr<Y> u) {
T* allocate(std::size_t n, const_ptr<Y>) {
return static_cast<T*>(::operator new(n * sizeof(T)));
}

View File

@ -347,7 +347,7 @@ namespace test
return ptr;
}
T* allocate(std::size_t n, void const* u)
T* allocate(std::size_t n, void const*)
{
T* ptr(static_cast<T*>(::operator new(n * sizeof(T))));
detail::tracker.track_allocate((void*) ptr, n, sizeof(T), tag_);
@ -573,7 +573,7 @@ namespace test
return p;
}
pointer allocate(size_type n, void const* u)
pointer allocate(size_type n, void const*)
{
pointer ptr(static_cast<T*>(::operator new(n * sizeof(T))));
detail::tracker.track_allocate((void*) ptr, n, sizeof(T), tag_);

View File

@ -1,65 +0,0 @@
# Copyright 2006-2008 Daniel James.
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
import testing ;
project unordered-test/unordered
: requirements
<warnings>all
<toolset>intel:<warnings>on
# Would be nice to define -Wundef, but I'm getting warnings from
# Boost.Preprocessor on trunk.
<toolset>gcc:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion -Wno-long-long -Wfloat-equal"
<toolset>darwin:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion -Wfloat-equal"
#<toolset>gcc:<define>_GLIBCXX_DEBUG
#<toolset>darwin:<define>_GLIBCXX_DEBUG
;
test-suite unordered
:
[ run fwd_set_test.cpp ]
[ run fwd_map_test.cpp ]
[ run allocator_traits.cpp ]
[ run minimal_allocator.cpp ]
[ run compile_set.cpp ]
[ run compile_map.cpp ]
[ run noexcept_tests.cpp ]
[ run link_test_1.cpp link_test_2.cpp ]
[ run incomplete_test.cpp ]
[ run simple_tests.cpp ]
[ run equivalent_keys_tests.cpp ]
[ run constructor_tests.cpp ]
[ run copy_tests.cpp ]
[ run move_tests.cpp ]
[ run assign_tests.cpp ]
[ run insert_tests.cpp ]
[ run insert_stable_tests.cpp ]
[ run unnecessary_copy_tests.cpp ]
[ run erase_tests.cpp ]
[ run erase_equiv_tests.cpp ]
[ run find_tests.cpp ]
[ run at_tests.cpp ]
[ run bucket_tests.cpp ]
[ run load_factor_tests.cpp ]
[ run rehash_tests.cpp ]
[ run equality_tests.cpp ]
[ run swap_tests.cpp ]
[ run compile_set.cpp : :
: <define>BOOST_UNORDERED_USE_MOVE
: bmove_compile_set ]
[ run compile_map.cpp : :
: <define>BOOST_UNORDERED_USE_MOVE
: bmove_compile_map ]
[ run copy_tests.cpp : :
: <define>BOOST_UNORDERED_USE_MOVE
: bmove_copy ]
[ run move_tests.cpp : :
: <define>BOOST_UNORDERED_USE_MOVE
: bmove_move ]
[ run assign_tests.cpp : :
: <define>BOOST_UNORDERED_USE_MOVE
: bmove_assign ]
;

View File

@ -22,9 +22,9 @@
T const* address(T const& r) { return &r; } \
T* allocate(std::size_t n) \
{ return static_cast<T*>(::operator new(n * sizeof(T))); } \
T* allocate(std::size_t n, void const* u) \
T* allocate(std::size_t n, void const*) \
{ return static_cast<T*>(::operator new(n * sizeof(T))); } \
void deallocate(T* p, std::size_t n) { ::operator delete((void*) p); } \
void deallocate(T* p, std::size_t) { ::operator delete((void*) p); } \
void construct(T* p, T const& t) { new(p) T(t); } \
void destroy(T* p) { p->~T(); } \
std::size_t max_size() const \
@ -44,9 +44,9 @@
const_pointer address(T const& r) { return &r; } \
pointer allocate(std::size_t n) \
{ return pointer(::operator new(n * sizeof(T))); } \
pointer allocate(std::size_t n, void const* u) \
pointer allocate(std::size_t n, void const*) \
{ return pointer(::operator new(n * sizeof(T))); } \
void deallocate(pointer p, std::size_t n) \
void deallocate(pointer p, std::size_t) \
{ ::operator delete((void*) p); } \
void construct(T* p, T const& t) { new(p) T(t); } \
void destroy(T* p) { p->~T(); } \

View File

@ -16,7 +16,6 @@ UNORDERED_AUTO_TEST(at_tests) {
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Create Map" << std::endl;
boost::unordered_map<std::string, int> x;
typedef boost::unordered_map<std::string, int>::iterator iterator;
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Add elements" << std::endl;

View File

@ -202,6 +202,7 @@ UNORDERED_AUTO_TEST(test2)
unordered_unique_test(map, map_value);
unordered_map_test(map, assignable, assignable);
unordered_copyable_test(map, assignable, map_value, hash, equal_to);
unordered_map_member_test(map, map_value);
boost::unordered_map<
test::minimal::assignable,
@ -226,6 +227,7 @@ UNORDERED_AUTO_TEST(test2)
unordered_equivalent_test(multimap, map_value);
unordered_map_test(multimap, assignable, assignable);
unordered_copyable_test(multimap, assignable, map_value, hash, equal_to);
unordered_map_member_test(multimap, map_value);
}
RUN_TESTS()

View File

@ -183,6 +183,7 @@ UNORDERED_AUTO_TEST(test2)
unordered_unique_test(set, assignable);
unordered_set_test(set, assignable);
unordered_copyable_test(set, assignable, assignable, hash, equal_to);
unordered_set_member_test(set, assignable);
std::cout<<"Test unordered_multiset.\n";
@ -195,6 +196,7 @@ UNORDERED_AUTO_TEST(test2)
unordered_equivalent_test(multiset, assignable);
unordered_set_test(multiset, assignable);
unordered_copyable_test(multiset, assignable, assignable, hash, equal_to);
unordered_set_member_test(multiset, assignable);
}
UNORDERED_AUTO_TEST(movable1_tests)

View File

@ -148,6 +148,7 @@ void unordered_destructible_test(X&)
X* ptr = new X();
X& a1 = *ptr;
(&a1)->~X();
::operator delete((void*)(&a1));
X a,b;
X const a_const;
@ -180,6 +181,28 @@ void unordered_set_test(X&, Key const&)
typedef BOOST_DEDUCED_TYPENAME X::key_type key_type;
BOOST_STATIC_ASSERT((boost::is_same<value_type, key_type>::value));
// iterator pointer / const_pointer_type
typedef BOOST_DEDUCED_TYPENAME X::iterator iterator;
typedef BOOST_DEDUCED_TYPENAME X::const_iterator const_iterator;
typedef BOOST_DEDUCED_TYPENAME X::local_iterator local_iterator;
typedef BOOST_DEDUCED_TYPENAME X::const_local_iterator const_local_iterator;
typedef BOOST_DEDUCED_TYPENAME
boost::iterator_pointer<iterator>::type iterator_pointer;
typedef BOOST_DEDUCED_TYPENAME
boost::iterator_pointer<const_iterator>::type
const_iterator_pointer;
typedef BOOST_DEDUCED_TYPENAME
boost::iterator_pointer<local_iterator>::type local_iterator_pointer;
typedef BOOST_DEDUCED_TYPENAME
boost::iterator_pointer<const_local_iterator>::type
const_local_iterator_pointer;
BOOST_STATIC_ASSERT((boost::is_same<value_type const*, iterator_pointer>::value));
BOOST_STATIC_ASSERT((boost::is_same<value_type const*, const_iterator_pointer>::value));
BOOST_STATIC_ASSERT((boost::is_same<value_type const*, local_iterator_pointer>::value));
BOOST_STATIC_ASSERT((boost::is_same<value_type const*, const_local_iterator_pointer>::value));
}
template <class X, class Key, class T>
@ -191,6 +214,30 @@ void unordered_map_test(X& r, Key const& k, T const& v)
BOOST_STATIC_ASSERT((
boost::is_same<value_type, std::pair<key_type const, T> >::value));
// iterator pointer / const_pointer_type
typedef BOOST_DEDUCED_TYPENAME X::iterator iterator;
typedef BOOST_DEDUCED_TYPENAME X::const_iterator const_iterator;
typedef BOOST_DEDUCED_TYPENAME X::local_iterator local_iterator;
typedef BOOST_DEDUCED_TYPENAME X::const_local_iterator const_local_iterator;
typedef BOOST_DEDUCED_TYPENAME
boost::iterator_pointer<iterator>::type iterator_pointer;
typedef BOOST_DEDUCED_TYPENAME
boost::iterator_pointer<const_iterator>::type
const_iterator_pointer;
typedef BOOST_DEDUCED_TYPENAME
boost::iterator_pointer<local_iterator>::type local_iterator_pointer;
typedef BOOST_DEDUCED_TYPENAME
boost::iterator_pointer<const_local_iterator>::type
const_local_iterator_pointer;
BOOST_STATIC_ASSERT((boost::is_same<value_type*, iterator_pointer>::value));
BOOST_STATIC_ASSERT((boost::is_same<value_type const*, const_iterator_pointer>::value));
BOOST_STATIC_ASSERT((boost::is_same<value_type*, local_iterator_pointer>::value));
BOOST_STATIC_ASSERT((boost::is_same<value_type const*, const_local_iterator_pointer>::value));
// Calling functions
r.insert(std::pair<Key const, T>(k, v));
Key k_lvalue(k);
@ -508,3 +555,23 @@ void unordered_movable_test(X& x, Key& k, T& /* t */, Hash& hf, Pred& eq)
sink(a8);
sink(a10);
}
template <class X, class T>
void unordered_set_member_test(X& x, T& t)
{
X x1(x);
x1.insert(t);
x1.begin()->dummy_member();
x1.cbegin()->dummy_member();
}
template <class X, class T>
void unordered_map_member_test(X& x, T& t)
{
X x1(x);
x1.insert(t);
x1.begin()->first.dummy_member();
x1.cbegin()->first.dummy_member();
x1.begin()->second.dummy_member();
x1.cbegin()->second.dummy_member();
}

View File

@ -95,12 +95,16 @@ void erase_tests1(Container*, test::random_generator generator)
BOOST_DEDUCED_TYPENAME Container::key_type
key = test::get_key<Container>(*pos);
std::size_t count = x.count(key);
BOOST_TEST(count > 0);
BOOST_TEST(next == x.erase(pos));
--size;
if(size > 0)
BOOST_TEST(index == 0 ? next == x.begin() :
next == boost::next(prev));
BOOST_TEST(x.count(key) == count - 1);
if (x.count(key) != count - 1) {
std::cerr << count << " => " << x.count(key) << std::endl;
}
BOOST_TEST(x.size() == size);
if (++iterations % 20 == 0) test::check_equivalent_keys(x);
}
@ -180,12 +184,16 @@ void erase_tests1(Container*, test::random_generator generator)
BOOST_DEDUCED_TYPENAME Container::key_type
key = test::get_key<Container>(*pos);
std::size_t count = x.count(key);
BOOST_TEST(count > 0);
x.quick_erase(pos);
--size;
if(size > 0)
BOOST_TEST(index == 0 ? next == x.begin() :
next == boost::next(prev));
BOOST_TEST(x.count(key) == count - 1);
if (x.count(key) != count - 1) {
std::cerr << count << " => " << x.count(key) << std::endl;
}
BOOST_TEST(x.size() == size);
if (++iterations % 20 == 0) test::check_equivalent_keys(x);
}

View File

@ -40,8 +40,10 @@ void find_tests1(X*, test::random_generator generator)
iterator pos = x.find(key);
BOOST_DEDUCED_TYPENAME X::const_iterator
const_pos = x_const.find(key);
BOOST_TEST(pos != x.end());
BOOST_TEST(pos != x.end() &&
x.key_eq()(key, test::get_key<X>(*pos)));
BOOST_TEST(const_pos != x_const.end());
BOOST_TEST(const_pos != x_const.end() &&
x_const.key_eq()(key, test::get_key<X>(*const_pos)));
@ -117,7 +119,6 @@ struct compatible_predicate
template <class X>
void find_compatible_keys_test(X*, test::random_generator generator)
{
typedef BOOST_DEDUCED_TYPENAME X::iterator iterator;
typedef BOOST_DEDUCED_TYPENAME test::random_values<X>::iterator
value_iterator;
test::random_values<X> v(500, generator);

View File

@ -363,9 +363,6 @@ void equivalent_emplace_tests1(X*, test::random_generator generator)
template <class X>
void move_emplace_tests(X*, test::random_generator generator)
{
typedef BOOST_DEDUCED_TYPENAME X::iterator iterator;
typedef test::ordered<X> ordered;
std::cerr<<"emplace(move(value)) tests for containers with unique keys.\n";
X x;
@ -601,7 +598,11 @@ UNORDERED_AUTO_TEST(insert_initializer_list_set)
boost::unordered_set<initialize_from_two_ints> set2;
#if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5))
set2.insert({{1, 2}});
#else
set2.insert({1, 2});
#endif
BOOST_TEST(set2.size() == 1);
BOOST_TEST(set2.find({1,2}) != set2.end());
BOOST_TEST(set2.find({2,1}) == set2.end());
@ -624,6 +625,8 @@ UNORDERED_AUTO_TEST(insert_initializer_list_set)
BOOST_TEST(set2.find({8,7}) == set2.end());
}
#if !BOOST_WORKAROUND(BOOST_MSVC, == 1800)
UNORDERED_AUTO_TEST(insert_initializer_list_multiset)
{
boost::unordered_multiset<std::string> multiset;
@ -640,6 +643,8 @@ UNORDERED_AUTO_TEST(insert_initializer_list_multiset)
BOOST_TEST_EQ(multiset.count("c"), 0u);
}
#endif
UNORDERED_AUTO_TEST(insert_initializer_list_map)
{
boost::unordered_map<std::string, std::string> map;
@ -663,8 +668,8 @@ UNORDERED_AUTO_TEST(insert_initializer_list_multimap)
struct overloaded_constructor
{
overloaded_constructor(int x1 = 1, int x2 = 2, int x3 = 3, int x4 = 4)
: x1(x1), x2(x2), x3(x3), x4(x4) {}
overloaded_constructor(int x1_ = 1, int x2_ = 2, int x3_ = 3, int x4_ = 4)
: x1(x1_), x2(x2_), x3(x3_), x4(x4_) {}
int x1, x2, x3, x4;

View File

@ -18,7 +18,7 @@ struct SimpleAllocator
{
}
template <class T> SimpleAllocator(const SimpleAllocator<T>& other)
template <class T> SimpleAllocator(const SimpleAllocator<T>&)
{
}

View File

@ -69,7 +69,7 @@ namespace noexcept_tests
BOOST_NOEXCEPT {}
hash_nothrow_move() { test_throw("Constructor"); }
hash_nothrow_move(hash_nothrow_move const& x) { test_throw("Copy"); }
hash_nothrow_move(hash_nothrow_move const&) { test_throw("Copy"); }
hash_nothrow_move& operator=(hash_nothrow_move const&)
{ test_throw("Assign"); return *this; }
std::size_t operator()(int x) const
@ -85,7 +85,7 @@ namespace noexcept_tests
equal_to_nothrow_move(BOOST_RV_REF(equal_to_nothrow_move))
BOOST_NOEXCEPT {}
equal_to_nothrow_move() { test_throw("Constructor"); }
equal_to_nothrow_move(equal_to_nothrow_move const& x)
equal_to_nothrow_move(equal_to_nothrow_move const&)
{ test_throw("Copy"); }
equal_to_nothrow_move& operator=(equal_to_nothrow_move const&)
{ test_throw("Assign"); return *this; }

View File

@ -119,6 +119,20 @@ namespace unnecessary_copy_tests
}
}
// Boost.Move doesn't seem to work very well on this compiler.
// For example for:
//
// T x;
//
// It will default construct T, and then move it in.
// For 'T const' it seems to copy.
#if defined(__IBMCPP__) && __IBMCPP__ <= 1210
#define EXTRA_CONSTRUCT_COST 1
#else
#define EXTRA_CONSTRUCT_COST 0
#endif
#define COPY_COUNT(n) \
if(::unnecessary_copy_tests::count_copies::copies != n) { \
BOOST_ERROR("Wrong number of copies."); \
@ -150,9 +164,13 @@ namespace unnecessary_copy_tests
BOOST_ERROR("Wrong number of moves."); \
std::cerr \
<< "Number of moves: " \
<< ::unnecessary_copy_tests::count_copies::copies \
<< ::unnecessary_copy_tests::count_copies::moves \
<< " expecting: [" << a << ", " << b << "]" << std::endl; \
}
#define COPY_COUNT_EXTRA(a, b) \
COPY_COUNT_RANGE(a, a + b * EXTRA_CONSTRUCT_COST)
#define MOVE_COUNT_EXTRA(a, b) \
MOVE_COUNT_RANGE(a, a + b * EXTRA_CONSTRUCT_COST)
namespace unnecessary_copy_tests
{
@ -207,13 +225,29 @@ namespace unnecessary_copy_tests
UNORDERED_TEST(unnecessary_copy_emplace_rvalue_test,
((set)(multiset)(map)(multimap)))
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <class T>
void unnecessary_copy_emplace_move_test(T*)
void unnecessary_copy_emplace_std_move_test(T*)
{
reset();
T x;
BOOST_DEDUCED_TYPENAME T::value_type a;
COPY_COUNT(1); MOVE_COUNT(0);
x.emplace(std::move(a));
COPY_COUNT(1); MOVE_COUNT(1);
}
UNORDERED_TEST(unnecessary_copy_emplace_std_move_test,
((set)(multiset)(map)(multimap)))
#endif
template <class T>
void unnecessary_copy_emplace_boost_move_test(T*)
{
reset();
T x;
BOOST_DEDUCED_TYPENAME T::value_type a;
COPY_COUNT(1); MOVE_COUNT_EXTRA(0, 1);
x.emplace(boost::move(a));
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
COPY_COUNT(1); MOVE_COUNT(1);
@ -223,7 +257,7 @@ namespace unnecessary_copy_tests
#endif
}
UNORDERED_TEST(unnecessary_copy_emplace_move_test,
UNORDERED_TEST(unnecessary_copy_emplace_boost_move_test,
((set)(multiset)(map)(multimap)))
template <class T>
@ -247,10 +281,10 @@ namespace unnecessary_copy_tests
T x;
COPY_COUNT(0); MOVE_COUNT(0);
BOOST_DEDUCED_TYPENAME T::value_type a;
COPY_COUNT(1); MOVE_COUNT(0);
COPY_COUNT(1); MOVE_COUNT_EXTRA(0, 1);
x.emplace(boost::move(a));
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
COPY_COUNT(2); MOVE_COUNT(0);
COPY_COUNT(2); MOVE_COUNT_EXTRA(0, 1);
#else
COPY_COUNT(1); MOVE_COUNT(1);
#endif
@ -364,7 +398,7 @@ namespace unnecessary_copy_tests
// TODO: Run tests for pairs without const etc.
std::pair<count_copies const, count_copies> a;
x.emplace(a);
COPY_COUNT(4); MOVE_COUNT(0);
COPY_COUNT_EXTRA(4, 1); MOVE_COUNT_EXTRA(0, 1);
//
// 0 arguments
@ -382,7 +416,7 @@ namespace unnecessary_copy_tests
// Visual C++ 11 handles calling move for default arguments.
COPY_COUNT(3); MOVE_COUNT(1);
# else
COPY_COUNT(2); MOVE_COUNT(0);
COPY_COUNT_EXTRA(2, 1); MOVE_COUNT_EXTRA(0, 1);
# endif
#endif
@ -407,9 +441,8 @@ namespace unnecessary_copy_tests
x.emplace(source<std::pair<count_copies, count_copies> >());
COPY_COUNT(2); MOVE_COUNT(source_pair_cost);
#if (defined(__GNUC__) && __GNUC__ > 4) || \
(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ > 2) || \
(defined(BOOST_MSVC) && BOOST_MSVC >= 1600 )
#if !(defined(__GNUC__) && __cplusplus < 199900L) && \
!(defined(_MSC_VER) && _MSC_VER < 1600)
count_copies part;
reset();
std::pair<count_copies const&, count_copies const&> a_ref(part, part);
@ -476,8 +509,9 @@ namespace unnecessary_copy_tests
COPY_COUNT(tuple_copy_cost);
MOVE_COUNT(tuple_move_cost);
#if defined(__GNUC__) && __GNUC__ > 4 || \
defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ >= 6
#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && \
!(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ < 6) && \
!(defined(BOOST_MSVC) && BOOST_MSVC < 1700)
reset();
x.emplace(boost::unordered::piecewise_construct,
std::forward_as_tuple(b.first),