Index: Source/wtf/Deque.h |
diff --git a/Source/wtf/Deque.h b/Source/wtf/Deque.h |
index 3ce433729a4c86cfc3bd040a3c665cefc1e8ded8..fa6c8945b847eb024e7edd0fa57feeb28a4b2699 100644 |
--- a/Source/wtf/Deque.h |
+++ b/Source/wtf/Deque.h |
@@ -79,10 +79,12 @@ namespace WTF { |
T& last() { ASSERT(m_start != m_end); return *(--end()); } |
const T& last() const { ASSERT(m_start != m_end); return *(--end()); } |
+ PassType takeLast(); |
template<typename U> void append(const U&); |
template<typename U> void prepend(const U&); |
void removeFirst(); |
+ void removeLast(); |
void remove(iterator&); |
void remove(const_iterator&); |
@@ -326,6 +328,14 @@ namespace WTF { |
return Pass::transfer(oldFirst); |
} |
+ template<typename T, size_t inlineCapacity> |
+ inline typename Deque<T, inlineCapacity>::PassType Deque<T, inlineCapacity>::takeLast() |
+ { |
+ T oldLast = Pass::transfer(last()); |
+ removeLast(); |
+ return Pass::transfer(oldLast); |
+ } |
+ |
template<typename T, size_t inlineCapacity> template<typename U> |
inline void Deque<T, inlineCapacity>::append(const U& value) |
{ |
@@ -360,6 +370,17 @@ namespace WTF { |
} |
template<typename T, size_t inlineCapacity> |
+ inline void Deque<T, inlineCapacity>::removeLast() |
+ { |
+ ASSERT(!isEmpty()); |
+ if (!m_end) |
+ m_end = m_buffer.capacity() - 1; |
+ else |
+ --m_end; |
+ TypeOperations::destruct(&m_buffer.buffer()[m_end], &m_buffer.buffer()[m_end + 1]); |
+ } |
+ |
+ template<typename T, size_t inlineCapacity> |
inline void Deque<T, inlineCapacity>::remove(iterator& it) |
{ |
remove(it.m_index); |