Index: cc/quads/list_container.h |
diff --git a/cc/quads/list_container.h b/cc/quads/list_container.h |
index 34a30aadd6e74c2403fce5d339d61b9f00c428e6..37c6343802dea90a7569b0cd1454dcb924f10f56 100644 |
--- a/cc/quads/list_container.h |
+++ b/cc/quads/list_container.h |
@@ -146,13 +146,21 @@ class CC_EXPORT ListContainer { |
const BaseElementType* front() const; |
const BaseElementType* back() const; |
+ BaseElementType* at(size_t index); |
danakj
2014/09/24 20:17:25
This is an O(1) thing on std::vector, which is whe
weiliangc
2014/09/24 20:26:31
Make sense. Done.
|
+ const BaseElementType* at(size_t index) const; |
+ |
// Take in derived element type and construct it at location generated by |
// Allocate(). |
template <typename DerivedElementType> |
DerivedElementType* AllocateAndConstruct() { |
- DerivedElementType* result = |
- new (Allocate(sizeof(DerivedElementType))) DerivedElementType; |
- return result; |
+ return new (Allocate(sizeof(DerivedElementType))) DerivedElementType; |
+ } |
+ // Take in derived element type and copy construct it at location generated by |
+ // Allocate(). |
+ template <typename DerivedElementType> |
+ DerivedElementType* AllocateAndCopyFrom(const DerivedElementType* source) { |
+ return new (Allocate(sizeof(DerivedElementType))) |
+ DerivedElementType(*source); |
} |
size_t size() const; |