Skip to content

Commit f07a50d

Browse files
committed
fix: fix the bug when other is moved
1 parent 47acae3 commit f07a50d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

stl/ww_deque.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#define __WW_DEQUE_H__
33

44
#include <initializer_list>
5-
#include "ww_type_traits.h"
65
#include "ww_memory.h"
76
#include "ww_iterator.h"
87

@@ -381,8 +380,10 @@ template <
381380
assign(count, value);
382381
}
383382

384-
template <class InputIterator>
385-
deque(InputIterator first, InputIterator last, const Allocator & alloc = Allocator())
383+
template <
384+
class InputIterator,
385+
class = typename std::enable_if<wwstl::is_iterator<InputIterator>::value>::type
386+
> deque(InputIterator first, InputIterator last, const Allocator & alloc = Allocator())
386387
: deque(alloc)
387388
{
388389
_initialize_map(0);
@@ -408,6 +409,7 @@ template <
408409
other._finish._clear();
409410
other._map = nullptr;
410411
other._map_size = 0;
412+
other._initialize_map(0);
411413
}
412414

413415
deque(const deque & other, const Allocator & alloc)
@@ -429,6 +431,7 @@ template <
429431
other._finish._clear();
430432
other._map = nullptr;
431433
other._map_size = 0;
434+
other._initialize_map(0);
432435
}
433436

434437
deque(std::initializer_list<value_type> ilist, const Allocator & alloc = Allocator())
@@ -498,6 +501,7 @@ template <
498501
other._finish._clear();
499502
other._map = nullptr;
500503
other._map_size = 0;
504+
other._initialize_map(0);
501505
}
502506
return *this;
503507
}

0 commit comments

Comments
 (0)