17
17
#include < vector>
18
18
19
19
#include " count_new.h"
20
+ #include " test_allocator.h"
20
21
#include " test_iterators.h"
21
22
22
23
template <class T >
@@ -36,7 +37,9 @@ struct Allocator {
36
37
void deallocate (T* ptr, std::size_t n) { std::allocator<T>().deallocate (ptr, n); }
37
38
38
39
template <class U >
39
- friend bool operator ==(const Allocator&, const Allocator<U>&) { return true ; }
40
+ friend bool operator ==(const Allocator&, const Allocator<U>&) {
41
+ return true ;
42
+ }
40
43
};
41
44
42
45
struct ThrowingT {
@@ -138,7 +141,7 @@ int main(int, char**) {
138
141
} catch (int ) {
139
142
}
140
143
check_new_delete_called ();
141
- #endif // TEST_STD_VER >= 14
144
+ #endif // TEST_STD_VER >= 14
142
145
143
146
try { // Throw in vector(size_type, value_type, const allocator_type&) from the type
144
147
int throw_after = 1 ;
@@ -217,11 +220,12 @@ int main(int, char**) {
217
220
}
218
221
check_new_delete_called ();
219
222
220
- try { // Throw in vector(vector&&, const allocator_type&) from type
221
- std::vector<ThrowingT, Allocator<ThrowingT> > vec (Allocator<ThrowingT>(false ));
222
- int throw_after = 1 ;
223
- vec.emplace_back (throw_after);
224
- std::vector<ThrowingT, Allocator<ThrowingT> > vec2 (std::move (vec), Allocator<ThrowingT>(false ));
223
+ try { // Throw in vector(vector&&, const allocator_type&) from type during element-wise move
224
+ std::vector<ThrowingT, test_allocator<ThrowingT> > vec (test_allocator<ThrowingT>(1 ));
225
+ int throw_after = 10 ;
226
+ ThrowingT v (throw_after);
227
+ vec.insert (vec.end (), 6 , v);
228
+ std::vector<ThrowingT, test_allocator<ThrowingT> > vec2 (std::move (vec), test_allocator<ThrowingT>(2 ));
225
229
} catch (int ) {
226
230
}
227
231
check_new_delete_called ();
0 commit comments