Index: cc/base/list_container.h |
diff --git a/cc/base/list_container.h b/cc/base/list_container.h |
index a9444cd03aa08d1e1192e625198e8222dae0ce36..7cccc6707c4e67ad51af61e045119eace5866ffb 100644 |
--- a/cc/base/list_container.h |
+++ b/cc/base/list_container.h |
@@ -296,14 +296,16 @@ class ListContainer : public ListContainerBase { |
// Appends a new item without copying. The original item will not be |
// destructed and will be replaced with a new DerivedElementType. The |
// DerivedElementType does not have to match the moved type as a full block |
- // of memory will be moved (up to MaxSizeForDerivedClass()). |
+ // of memory will be moved (up to MaxSizeForDerivedClass()). A pointer to |
+ // the moved element is returned. |
template <typename DerivedElementType> |
- void AppendByMoving(DerivedElementType* item) { |
+ DerivedElementType* AppendByMoving(DerivedElementType* item) { |
size_t max_size_for_derived_class = MaxSizeForDerivedClass(); |
void* new_item = Allocate(max_size_for_derived_class); |
memcpy(new_item, static_cast<void*>(item), max_size_for_derived_class); |
// Construct a new element in-place so it can be destructed safely. |
new (item) DerivedElementType; |
+ return static_cast<DerivedElementType*>(new_item); |
} |
using ListContainerBase::size; |