Commit Graph

1248 Commits

Author SHA1 Message Date
Daniel James
0645700b33 Separate out some of the node manipulation code 2017-02-27 03:59:02 +00:00
Daniel James
d89aadc56c Implement merge 2017-02-27 03:59:02 +00:00
Daniel James
21a24d6cd7 Support node_handle 2017-02-27 03:59:02 +00:00
Daniel James
9c4c3a754a Const methods in value_base. 2017-02-27 03:59:02 +00:00
Daniel James
5f5f8ef1e4 Implement try_emplace 2017-02-27 03:59:02 +00:00
Daniel James
958d206bb6 Implement insert_or_assign. 2017-02-27 03:59:02 +00:00
Daniel James
8fa93cc55b Update some comments for recent versions of standard 2017-02-23 20:14:27 +00:00
Daniel James
79cf0c4bfb pair_traits for getting pair types without instantiating.
I was having some problems in an abandoned prototype with incomplete
types, I'm not sure I will have this problem now, but I'm keeping this
anyway, as it seems useful.
2017-02-23 20:14:27 +00:00
Daniel James
81aefde94e Use const_key_type internally 2017-02-23 20:14:27 +00:00
Daniel James
96602df8a8 Remove const volatile when picking bucket policy
Could possibly do this in a more portable manner by using some sort of
function overload.
2017-02-23 20:14:27 +00:00
Daniel James
c0b72d97b3 Stricter about rebinding the allocator 2017-02-23 20:14:27 +00:00
Daniel James
ddee1b686a Move config and declaration to the start of implementataion.hpp 2017-02-23 20:14:26 +00:00
Daniel James
2231586033 Remove duplicate includes 2017-02-23 20:14:26 +00:00
Daniel James
13063abce5 Move friend function outside of class
The use of std::pair was causing issues with the sun compiler.
2017-02-23 20:10:40 +00:00
Daniel James
570decf00e Merge branch 'develop' 2017-02-23 19:48:31 +00:00
Daniel James
bf5ef9824d Reformat with clang-format 2017-02-19 13:05:17 +00:00
Daniel James
01dcd36c41 Add _clang-format file 2017-02-19 13:05:17 +00:00
Daniel James
b2f2fdc2f3 Prevent clang-format sorting some test includes 2017-02-19 13:05:17 +00:00
Daniel James
f2af10c746 Protect preprocess sequence from clang format 2017-02-19 13:05:17 +00:00
Daniel James
3bf664ad31 Add a missing header 2017-02-19 13:05:17 +00:00
Daniel James
67ab88b064 Combine most of the detail headers into a single header 2017-02-19 13:05:17 +00:00
Daniel James
67f1f65174 Linearise the detail includes
The current organisation of the headers has been making less and less
sense over the years, so to simplify things, I'm just going to combine
them into a single header. This change will make it easier to do that.
2017-02-19 13:05:17 +00:00
Daniel James
b1dff42434 Merge remote-tracking branch 'origin/develop' 2017-02-19 01:21:12 +00:00
Daniel James
57cc6d4bac Fix exception safety when constructing pairs 2017-01-01 18:35:50 +00:00
Daniel James
e416cafd49 Count instances constructed/destructed in exception tests 2017-01-01 18:35:50 +00:00
Daniel James
0aa79ce360 Merge branch 'develop' 2017-01-01 18:26:35 +00:00
Daniel James
0a1c9ad4c5 Use boost 1.63.0 in travis 2017-01-01 16:07:08 +00:00
Daniel James
dd85b16166 Update the snapshot in travis
I've forgotten why I'm not using a stable release, but really should try
to avoid using snapshots for this reason. Or at least port the code for
downloading snapshots for the website.
2016-12-06 10:56:19 +00:00
Daniel James
76127b6e42 Merge branch 'develop' 2016-12-05 22:48:29 +00:00
Daniel James
03a597983e Change log for last few fixes 2016-12-05 22:48:00 +00:00
Daniel James
33f701dd09 Fix assigning hash/key equality functions for empty containers 2016-11-21 10:24:51 +00:00
Daniel James
3db4654b44 Remove unary/binary_function from examples/documentation
They are being removed from the standard in C++17, and were never really
required.
2016-11-06 10:19:17 +00:00
Daniel James
a7546e298e Support 10 arguments in emplace_args
Which was the intent, but only supported up to 9 arguments. I doubt
this will make much of a difference.
2016-11-02 07:30:41 +00:00
Daniel James
8a0592a35d Merge branch 'develop' 2016-10-30 23:17:15 +00:00
Daniel James
98cce956f9 Try to fix a 64-bit powerpc g++ 7 warning
Warning is:

allocate.hpp:335:19: warning: conversion to ???unsigned int??? from
???long unsigned int??? may alter its value [-Wconversion]

I'm not sure, but I think it's because the sizeof is a long unsigned
int, and the template parameter is an unsigned int. The sizeof isn't
even used, it's just there to get a value for expression SFINAE.
2016-10-28 09:06:53 +01:00
Daniel James
a34785fa0d Don't 'sink' uncopyable container
Calling sink was causing older versions of gcc to copy the container,
resulting in a compile error. So instead just disambiguate by putting
brackets around the expression.
2016-10-25 18:04:34 +01:00
Daniel James
14ccdbc7b6 Add guards against exceptions that shouldn't happen
I'm getting a couple of "terminate called after throwing an instance of
'test::lightweight::test_exception'" errors on the sun platform. Not
sure where they're happening, so I've made the code a tad more resilient
against exceptions that should not really be thrown.
2016-10-24 09:46:13 +01:00
Daniel James
5b5b46ea1c Disable Visual C++ __declspec(allocator) warning
Visual C++ is warning that memory can't be tracked for allocators whose
pointer types aren't actually pointers, which is a correct warning but
not relevant for our concerns, and is caused by the unit tests, not the
container implementation.
2016-10-23 13:51:58 +01:00
Daniel James
e3f534a148 Allocator aware constructors 2016-10-23 13:33:25 +01:00
Daniel James
1bcd5b0003 Make no argument constructor implicit 2016-10-23 13:32:52 +01:00
Daniel James
0d1cfba823 Rename functions in allocate.hpp 2016-10-22 10:28:53 +01:00
Daniel James
e986b70981 Stricter iterator types 2016-10-22 10:04:36 +01:00
Daniel James
9b7b485c33 Use node_pointer in equality. 2016-10-22 10:04:36 +01:00
Daniel James
c680fa7418 Remove find_matching_node.
FWIW the standard says that equality is undefined behaviour if the Hash
and Pred function objects behave differently. But I think we should
support different hash functions, e.g. so that randomized hash functions
will work.
2016-10-22 10:04:36 +01:00
Daniel James
9772c01161 Replace several uses of iterators with node pointers.
Which is to some extent going in circles, as this is how the containers
were originally implemented. But I think this is cleaner. It also fixes
a minor problem where the internal and external iterator types are
different for some containers, as the external iterators are all const.
2016-10-22 10:04:36 +01:00
Daniel James
6071f9a08b Stop testing no arg emplace when not available 2016-10-22 09:49:14 +01:00
Daniel James
ad2256b13c Add const cast for piecewise construction 2016-10-22 09:42:56 +01:00
Daniel James
dad0d48c9c Support containers with const value type
Currently just storing the value without a const. Can do better with
C++11 constructors, so maybe should do that, and cast away const on
compilers without support.

Another problem is that std::allocator<const int> doesn't compile for
libstdc++ (and potentially other standard libraries), so
boost::unordered_set<const int> can't compile. I'm not sure if I should
work around that, as it means changing the type of the container
(i.e. to boost::unordered_set<const int,... , std::allocator<int>>).
2016-10-17 08:06:19 +01:00
Daniel James
e03a8732a6 Use static_cast for allocator_traits::construct
std::allocator::construct uses a C-style cast to void pointer, so it can
accept const pointers, but allocator_traits::construct uses a static_cast
by default, so const pointers don't work. This means the implementation
needs to cast away const when constructing members of a std::pair. This
wouldn't happen if piecewise construction was used, as the members could
be constructed normally.
2016-10-17 07:54:06 +01:00
Daniel James
7da307c696 Supply explicit test::cxx11_allocator::rebind for old GCC
The rebind mechanism doesn't work for templates with multiple template
parameters on old versions of GCC. But allocators written for that
compiler will have an explicit rebind, so that should be acceptable.
2016-10-17 07:54:06 +01:00