Skip to content

Commit 68fa752

Browse files
authored
Merge branch 'develop' into revert-issue-209
2 parents a165f49 + 08ded32 commit 68fa752

File tree

15 files changed

+328
-92
lines changed

15 files changed

+328
-92
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@
1919
/bench/detail/hash_table.hpp
2020
/Bin/
2121
/include/boost/container/new_deque.hpp
22+
/test/new_deque_test.cpp

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ Distributed under the [Boost Software License, Version 1.0](http://www.boost.org
1515

1616
### Build Status
1717

18-
Branch | Travis | Appveyor | Coverity Scan | codecov.io | Deps | Docs | Tests |
19-
:-------------: | ------ | -------- | ------------- | ---------- | ---- | ---- | ----- |
20-
[`master`](https://github.com/boostorg/container/tree/master) | [![Build Status](https://travis-ci.org/boostorg/container.svg?branch=master)](https://travis-ci.org/boostorg/container) | [![Build status](https://ci.appveyor.com/api/projects/status/9ckrveolxsonxfnb/branch/master?svg=true)](https://ci.appveyor.com/project/jeking3/container-0k1xg/branch/master) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/16048/badge.svg)](https://scan.coverity.com/projects/boostorg-container) | [![codecov](https://codecov.io/gh/boostorg/container/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/container/branch/master)| [![Deps](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/container.html) | [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](http://www.boost.org/doc/libs/master/doc/html/container.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](https://regression.boost.io/master/developer/container.html)
21-
[`develop`](https://github.com/boostorg/container/tree/develop) | [![Build Status](https://travis-ci.org/boostorg/container.svg?branch=develop)](https://travis-ci.org/boostorg/container) | [![Build status](https://ci.appveyor.com/api/projects/status/9ckrveolxsonxfnb/branch/develop?svg=true)](https://ci.appveyor.com/project/jeking3/container-0k1xg/branch/develop) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/16048/badge.svg)](https://scan.coverity.com/projects/boostorg-container) | [![codecov](https://codecov.io/gh/boostorg/container/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/container/branch/develop) | [![Deps](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/container.html) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](http://www.boost.org/doc/libs/develop/doc/html/container.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](https://regression.boost.io/develop/developer/container.html)
18+
Branch | Appveyor | Coverity Scan | codecov.io | Deps | Docs | Tests |
19+
:-------------: | -------- | ------------- | ---------- | ---- | ---- | ----- |
20+
[`master`](https://github.com/boostorg/container/tree/master) | [![Build status](https://ci.appveyor.com/api/projects/status/9ckrveolxsonxfnb/branch/master?svg=true)](https://ci.appveyor.com/project/jeking3/container-0k1xg/branch/master) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/16048/badge.svg)](https://scan.coverity.com/projects/boostorg-container) | [![codecov](https://codecov.io/gh/boostorg/container/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/container/branch/master)| [![Deps](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/container.html) | [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](http://www.boost.org/doc/libs/master/doc/html/container.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](https://regression.boost.io/master/developer/container.html)
21+
[`develop`](https://github.com/boostorg/container/tree/develop) | [![Build status](https://ci.appveyor.com/api/projects/status/9ckrveolxsonxfnb/branch/develop?svg=true)](https://ci.appveyor.com/project/jeking3/container-0k1xg/branch/develop) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/16048/badge.svg)](https://scan.coverity.com/projects/boostorg-container) | [![codecov](https://codecov.io/gh/boostorg/container/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/container/branch/develop) | [![Deps](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/container.html) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](http://www.boost.org/doc/libs/develop/doc/html/container.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](https://regression.boost.io/develop/developer/container.html)
2222

2323
### Directories
2424

bench/bench_vectors.cpp

Lines changed: 78 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <deque>
1313
#include <boost/container/vector.hpp>
1414
#include <boost/container/deque.hpp>
15+
#include "new_deque.hpp"
1516
#include <boost/container/devector.hpp>
1617
#include <boost/container/small_vector.hpp>
1718
#include <boost/container/stable_vector.hpp>
@@ -93,8 +94,9 @@ struct capacity_wrapper<C, false>
9394
{ }
9495
};
9596

96-
const std::size_t RangeSize = 5;
97+
const std::size_t RangeSize = 8;
9798

99+
template <class IntType>
98100
struct insert_end_range
99101
{
100102
inline std::size_t capacity_multiplier() const
@@ -105,39 +107,42 @@ struct insert_end_range
105107
{ c.insert(c.end(), &a[0], &a[0]+RangeSize); }
106108

107109
const char *name() const
108-
{ return "insert_end_range"; }
110+
{ return "insert_end_range(8)"; }
109111

110-
MyInt a[RangeSize];
112+
IntType a[RangeSize];
111113
};
112114

115+
template <class IntType>
113116
struct insert_end_repeated
114117
{
115118
inline std::size_t capacity_multiplier() const
116119
{ return RangeSize; }
117120

118121
template<class C>
119122
inline void operator()(C &c, int i)
120-
{ c.insert(c.end(), RangeSize, MyInt(i)); }
123+
{ c.insert(c.end(), RangeSize, IntType(i)); }
121124

122125
inline const char *name() const
123-
{ return "insert_end_repeated"; }
126+
{ return "insert_end_repeated(8)"; }
124127

125-
MyInt a[RangeSize];
128+
IntType a[RangeSize];
126129
};
127130

131+
template <class IntType>
128132
struct push_back
129133
{
130134
inline std::size_t capacity_multiplier() const
131135
{ return 1; }
132136

133137
template<class C>
134138
inline void operator()(C &c, int i)
135-
{ c.push_back(MyInt(i)); }
139+
{ c.push_back(IntType(i)); }
136140

137141
inline const char *name() const
138142
{ return "push_back"; }
139143
};
140144

145+
template <class IntType>
141146
struct emplace_back
142147
{
143148
inline std::size_t capacity_multiplier() const
@@ -151,19 +156,21 @@ struct emplace_back
151156
{ return "emplace_back"; }
152157
};
153158

159+
template <class IntType>
154160
struct insert_near_end_repeated
155161
{
156162
inline std::size_t capacity_multiplier() const
157163
{ return RangeSize; }
158164

159165
template<class C>
160166
inline void operator()(C &c, int i)
161-
{ c.insert(c.size() >= 2*RangeSize ? c.end()-2*RangeSize : c.begin(), RangeSize, MyInt(i)); }
167+
{ c.insert(c.size() >= 2*RangeSize ? c.end()-2*RangeSize : c.begin(), RangeSize, IntType(i)); }
162168

163169
inline const char *name() const
164-
{ return "insert_near_end_repeated"; }
170+
{ return "insert_near_end_repeated(8)"; }
165171
};
166172

173+
template <class IntType>
167174
struct insert_near_end_range
168175
{
169176
inline std::size_t capacity_multiplier() const
@@ -176,11 +183,12 @@ struct insert_near_end_range
176183
}
177184

178185
inline const char *name() const
179-
{ return "insert_near_end_range"; }
186+
{ return "insert_near_end_range(8)"; }
180187

181-
MyInt a[RangeSize];
188+
IntType a[RangeSize];
182189
};
183190

191+
template <class IntType>
184192
struct insert_near_end
185193
{
186194
inline std::size_t capacity_multiplier() const
@@ -192,13 +200,14 @@ struct insert_near_end
192200
typedef typename C::iterator it_t;
193201
it_t it (c.end());
194202
it -= static_cast<typename C::difference_type>(c.size() >= 2)*2;
195-
c.insert(it, MyInt(i));
203+
c.insert(it, IntType(i));
196204
}
197205

198206
inline const char *name() const
199207
{ return "insert_near_end"; }
200208
};
201209

210+
template <class IntType>
202211
struct emplace_near_end
203212
{
204213
inline std::size_t capacity_multiplier() const
@@ -272,16 +281,16 @@ void vector_test_template(std::size_t num_iterations, std::size_t num_elements,
272281

273282
nanosecond_type nseconds = timer.elapsed().wall;
274283

275-
std::cout << cont_name << "->" << op.name() <<" ns: "
284+
std::cout << cont_name << "->" << " ns: "
276285
<< std::setw(8)
277286
<< float(nseconds)/float((num_iterations-1)*num_elements)
278287
<< '\t'
279288
<< "Capacity: " << capacity
280289
<< std::endl;
281290
}
282291

283-
template<class Operation>
284-
void test_vectors()
292+
template<class IntType, class Operation>
293+
void test_vectors_impl()
285294
{
286295
//#define SINGLE_TEST
287296
#define SIMPLE_IT
@@ -293,7 +302,11 @@ void test_vectors()
293302
#endif
294303
std::size_t numele [] = { 100000 };
295304
#elif defined SIMPLE_IT
305+
#ifdef NDEBUG
306+
std::size_t numit [] = { 50 };
307+
#else
296308
std::size_t numit [] = { 10 };
309+
#endif
297310
std::size_t numele [] = { 100000 };
298311
#else
299312
#ifdef NDEBUG
@@ -304,42 +317,69 @@ void test_vectors()
304317
unsigned int numele [] = { 10000, 1000, 100, 10 };
305318
#endif
306319

307-
//#define PRERESERVE_ONLY
308-
#ifdef PRERESERVE_ONLY
320+
321+
#define RESERVE_ONLY 0
322+
#define NORESERVE_ONLY 1
323+
324+
//#define RESERVE_STRATEGY NORESERVE_ONLY
325+
#define RESERVE_STRATEGY RESERVE_ONLY
326+
327+
#ifndef RESERVE_STRATEGY
328+
#define P_INIT 0
329+
#define P_END 2
330+
#elif RESERVE_STRATEGY == PRERESERVE_ONLY
309331
#define P_INIT 1
310-
#else
332+
#define P_END 2
333+
#elif RESERVE_STRATEGY == NORESERVE_ONLY
311334
#define P_INIT 0
312-
#endif
335+
#define P_END 1
336+
#endif
313337

314-
for (unsigned p = P_INIT; p != 2; ++p) {
315-
std::cout << Operation().name() << ", prereserve: " << (p ? "1" : "0") << "\n" << std::endl;
316-
const bool bp =p != 0;
317-
for(unsigned int i = 0; i < sizeof(numele)/sizeof(numele[0]); ++i){
318-
vector_test_template< std::vector<MyInt, std::allocator<MyInt> >, Operation >(numit[i], numele[i], "std::vector ", bp);
319-
vector_test_template< bc::vector<MyInt, std::allocator<MyInt> >, Operation >(numit[i], numele[i] , "vector ", bp);
320-
vector_test_template< bc::small_vector<MyInt, 0, std::allocator<MyInt> >, Operation >(numit[i], numele[i], "small_vector ", bp);
321-
vector_test_template< bc::devector<MyInt, std::allocator<MyInt> >, Operation >(numit[i], numele[i], "devector ", bp);
322-
//vector_test_template< std::deque<MyInt, std::allocator<MyInt> >, Operation >(numit[i], numele[i], "std::deque ", bp);
323-
vector_test_template< bc::deque<MyInt, std::allocator<MyInt> >, Operation >(numit[i], numele[i], "deque ", bp);
338+
for (unsigned p = P_INIT; p != P_END; ++p) {
339+
std::cout << "---------------------------------\n";
340+
std::cout << "IntType:" << typeid(IntType).name() << " op:" << Operation().name() << ", prereserve: " << (p ? "1" : "0") << "\n";
341+
std::cout << "---------------------------------\n";
342+
const bool bp = p != 0;
343+
const std::size_t it_count = sizeof(numele)/sizeof(numele[0]);
344+
for(unsigned int i = 0; i < it_count; ++i){
345+
std::cout << "\n" << " ---- numit[i]: " << numit[i] << " numele[i] : " << numele[i] << " ---- \n";
346+
vector_test_template< std::vector<IntType, std::allocator<IntType> >, Operation >(numit[i], numele[i], "std::vector ", bp);
347+
vector_test_template< bc::vector<IntType, std::allocator<IntType> >, Operation >(numit[i], numele[i] , "vector ", bp);
348+
vector_test_template< bc::small_vector<IntType, 0, std::allocator<IntType> >, Operation >(numit[i], numele[i], "small_vector ", bp);
349+
vector_test_template< bc::devector<IntType, std::allocator<IntType> >, Operation >(numit[i], numele[i], "devector ", bp);
350+
vector_test_template< std::deque<IntType, std::allocator<IntType> >, Operation >(numit[i], numele[i], "std::deque ", bp);
351+
vector_test_template< bc::deque<IntType, std::allocator<IntType> >, Operation >(numit[i], numele[i], "deque ", bp);
352+
vector_test_template< bc::new_deque<IntType, std::allocator<IntType> >, Operation >(numit[i], numele[i], "new_deque ", bp);
324353
}
325354
std::cout << "---------------------------------\n---------------------------------\n";
326355
}
327356
}
328357

329-
int main()
358+
template<class IntType>
359+
void test_vectors()
330360
{
331361
//end
332-
test_vectors<push_back>();
333-
test_vectors<insert_end_range>();
334-
test_vectors<insert_end_repeated>();
362+
test_vectors_impl<IntType, push_back<IntType> >();
363+
#if BOOST_CXX_VERSION >= 201103L
364+
test_vectors_impl<IntType, emplace_back<IntType> >();
365+
#endif
366+
367+
test_vectors_impl<IntType, insert_end_range<IntType> >();
368+
test_vectors_impl<IntType, insert_end_repeated<IntType> >();
369+
335370
//near end
336-
test_vectors<insert_near_end>();
337-
test_vectors<insert_near_end_range>();
338-
test_vectors<insert_near_end_repeated>();
371+
test_vectors_impl<IntType, insert_near_end<IntType> >();
339372
#if BOOST_CXX_VERSION >= 201103L
340-
test_vectors<emplace_back>();
341-
test_vectors<emplace_near_end>();
373+
test_vectors_impl<IntType, emplace_near_end<IntType> >();
342374
#endif
375+
test_vectors_impl<IntType, insert_near_end_range<IntType> >();
376+
test_vectors_impl<IntType, insert_near_end_repeated<IntType> >();
377+
}
378+
379+
int main()
380+
{
381+
//test_vectors<MyInt>();
382+
test_vectors<int>();
343383

344384
return 0;
345385
}

doc/container.qbk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,9 +1425,11 @@ use [*Boost.Container]? There are several reasons for that:
14251425

14261426
* Fixed bugs/issues:
14271427
* [@https://github.com/boostorg/container/pull/294 GitHub #294: ['"CMake: Add option to use header-only Boost::container"]].
1428+
* [@https://github.com/boostorg/container/issues/300 GitHub #300: ['"Warnings when building with clang-20"]].
14281429
* [@https://github.com/boostorg/container/pull/305 GitHub #305: ['"Warnings with -Wstrict-prototypes"]].
14291430
* [@https://github.com/boostorg/container/pull/307 GitHub #307: ['"Fix all instances of MSVC warning C4146 (unsigned negation)"]].
14301431
* [@https://github.com/boostorg/container/issues/309 GitHub #309: ['"Performance regression of boost::container::static_vector introduced in boost v1.86"]].
1432+
* [@https://github.com/boostorg/container/issues/306 GitHub #306: ['"new_allocator.hpp error: '__cpp_sized_deallocation' is not defined, evaluates to 0 [-Werror,-Wundef]"]].
14311433
* [@https://github.com/boostorg/container/issues/310 GitHub #310: ['"flat_map: Mention correct type in documentation of emplace and emplace_hint"]].
14321434

14331435
[endsect]

include/boost/container/allocator.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class allocator
116116
allocator& operator=(const allocator<T2, Version2, AllocationDisableMask2>&);
117117

118118
BOOST_STATIC_CONSTEXPR unsigned int ForbiddenMask =
119-
BOOST_CONTAINER_ALLOCATE_NEW | BOOST_CONTAINER_EXPAND_BWD | BOOST_CONTAINER_EXPAND_FWD ;
119+
BOOST_CONTAINER_ALLOCATE_NEW | BOOST_CONTAINER_EXPAND_BWD | BOOST_CONTAINER_EXPAND_FWD;
120120

121121
//The mask can't disable all the allocation types
122122
BOOST_CONTAINER_STATIC_ASSERT(( (AllocationDisableMask & ForbiddenMask) != ForbiddenMask ));

0 commit comments

Comments
 (0)