| Index: Source/heap/Handle.h
|
| diff --git a/Source/heap/Handle.h b/Source/heap/Handle.h
|
| index d8d0f5fae4377f30cb45e0a54212a96ad4104855..602270a60cfbdd78f352a2dec0d1db07d49e0b8c 100644
|
| --- a/Source/heap/Handle.h
|
| +++ b/Source/heap/Handle.h
|
| @@ -1128,10 +1128,25 @@ struct CollectionVisitingTrait<WTF::HashMap<K, V> > {
|
| }
|
| };
|
|
|
| +template<typename Collection> class CollectionRoot;
|
| +
|
| +// Used to inject correctly typed operator[] into CollectionRoot when we are wrapping Vector.
|
| +template<typename T> class IndexingBehavior { };
|
| +
|
| +template<typename T, size_t inlineCapacity, typename Allocator>
|
| +class IndexingBehavior<CollectionRoot<Vector<T, inlineCapacity, Allocator> > > {
|
| + typedef CollectionRoot<Vector<T, inlineCapacity, Allocator> > CollectionRootType;
|
| +public:
|
| + T& operator[] (size_t i) { return (**static_cast<CollectionRootType*>(this))[i]; }
|
| + const T& operator[] (size_t i) const { return (**static_cast<const CollectionRootType*>(this))[i]; }
|
| +};
|
| +
|
| template<typename Collection>
|
| -class CollectionRoot : public PersistentBase {
|
| +class CollectionRoot : public PersistentBase, public IndexingBehavior<CollectionRoot<Collection> > {
|
| public:
|
| typedef Collection CollectionType;
|
| + typedef typename Collection::iterator iterator;
|
| + typedef typename Collection::const_iterator const_iterator;
|
|
|
| CollectionRoot() { }
|
| explicit CollectionRoot(size_t size) : m_collection(Collection(size)) { }
|
|
|