diff options
author | pinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-06 13:26:05 +0000 |
---|---|---|
committer | pinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-06 13:26:05 +0000 |
commit | cac3187c888f1cb32c72de5c18ef5264f12dfb0d (patch) | |
tree | 93f02d83077184aabdaaf3ea0f0276dfe01ac66f /base/stack_container.h | |
parent | 40d358fb5d2083582f512977a4119a650eddf3b0 (diff) | |
download | chromium_src-cac3187c888f1cb32c72de5c18ef5264f12dfb0d.zip chromium_src-cac3187c888f1cb32c72de5c18ef5264f12dfb0d.tar.gz chromium_src-cac3187c888f1cb32c72de5c18ef5264f12dfb0d.tar.bz2 |
Compiler changes to work with GCC
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@428 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/stack_container.h')
-rw-r--r-- | base/stack_container.h | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/base/stack_container.h b/base/stack_container.h index 16c6ab7..fb38dbd 100644 --- a/base/stack_container.h +++ b/base/stack_container.h @@ -56,6 +56,9 @@ template<typename T, size_t stack_capacity> class StackAllocator : public std::allocator<T> { public: + typedef typename std::allocator<T>::pointer pointer; + typedef typename std::allocator<T>::size_type size_type; + // Backing store for the allocator. The container owner is responsible for // maintaining this for as long as any containers using this allocator are // live. @@ -130,10 +133,10 @@ class StackAllocator : public std::allocator<T> { // WATCH OUT: the ContainerType MUST use the proper StackAllocator for this // type. This object is really intended to be used only internally. You'll want // to use the wrappers below for different types. -template<typename ContainerType, int stack_capacity> +template<typename TContainerType, int stack_capacity> class StackContainer { public: - typedef typename ContainerType ContainerType; + typedef TContainerType ContainerType; typedef typename ContainerType::value_type ContainedType; typedef StackAllocator<ContainedType, stack_capacity> Allocator; @@ -162,7 +165,7 @@ class StackContainer { #ifdef UNIT_TEST // Retrieves the stack source so that that unit tests can verify that the // buffer is being used properly. - typename const Allocator::Source& stack_data() const { + const typename Allocator::Source& stack_data() const { return stack_data_; } #endif @@ -237,19 +240,21 @@ class StackVector : public StackContainer< : StackContainer< std::vector<T, StackAllocator<T, stack_capacity> >, stack_capacity>() { - container().assign(other->begin(), other->end()); + this->container().assign(other->begin(), other->end()); } StackVector<T, stack_capacity>& operator=( const StackVector<T, stack_capacity>& other) { - container().assign(other->begin(), other->end()); + this->container().assign(other->begin(), other->end()); return *this; } // Vectors are commonly indexed, which isn't very convenient even with // operator-> (using "->at()" does exception stuff we don't want). - T& operator[](size_t i) { return container().operator[](i); } - const T& operator[](size_t i) const { return container().operator[](i); } + T& operator[](size_t i) { return this->container().operator[](i); } + const T& operator[](size_t i) const { + return this->container().operator[](i); + } }; #endif // BASE_STACK_CONTAINER_H__ |