Commit 91a01a16 by alokp@chromium.org

Fixed compile error on MAC. Fixed TMap to use std::pair<const K, V> as…

Fixed compile error on MAC. Fixed TMap to use std::pair<const K, V> as pool_allocator parameter. Replaced all instances of std::map with TMap. I wonder if this pool_allocator is worth all this complexity. Review URL: http://codereview.appspot.com/1182042 git-svn-id: https://angleproject.googlecode.com/svn/trunk@273 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent b1e8c6fb
...@@ -60,10 +60,6 @@ typedef int TSourceLoc; ...@@ -60,10 +60,6 @@ typedef int TSourceLoc;
void operator delete[](void*) { } \ void operator delete[](void*) { } \
void operator delete[](void *, void *) { } void operator delete[](void *, void *) { }
#define TBaseMap std::map
#define TBaseList std::list
#define TBaseSet std::set
// //
// Pool version of string. // Pool version of string.
// //
...@@ -86,12 +82,12 @@ public: ...@@ -86,12 +82,12 @@ public:
TVector(size_type i): std::vector<T, pool_allocator<T> >(i) {} TVector(size_type i): std::vector<T, pool_allocator<T> >(i) {}
}; };
template <class T> class TList : public TBaseList <T, pool_allocator<T> > { template <class T> class TList : public std::list<T, pool_allocator<T> > {
public: public:
typedef typename TBaseList<T, pool_allocator<T> >::size_type size_type; typedef typename std::list<T, pool_allocator<T> >::size_type size_type;
TList() : TBaseList<T, pool_allocator<T> >() {} TList() : std::list<T, pool_allocator<T> >() {}
TList(const pool_allocator<T>& a) : TBaseList<T, pool_allocator<T> >(a) {} TList(const pool_allocator<T>& a) : std::list<T, pool_allocator<T> >(a) {}
TList(size_type i): TBaseList<T, pool_allocator<T> >(i) {} TList(size_type i): std::list<T, pool_allocator<T> >(i) {}
}; };
// This is called TStlSet, because TSet is taken by an existing compiler class. // This is called TStlSet, because TSet is taken by an existing compiler class.
...@@ -101,13 +97,13 @@ template <class T, class CMP> class TStlSet : public std::set<T, CMP, pool_alloc ...@@ -101,13 +97,13 @@ template <class T, class CMP> class TStlSet : public std::set<T, CMP, pool_alloc
template <class K, class D, class CMP = std::less<K> > template <class K, class D, class CMP = std::less<K> >
class TMap : public TBaseMap<K, D, CMP, pool_allocator<std::pair<K, D> > > { class TMap : public std::map<K, D, CMP, pool_allocator<std::pair<const K, D> > > {
public: public:
typedef pool_allocator<std::pair <K, D> > tAllocator; typedef pool_allocator<std::pair<const K, D> > tAllocator;
TMap() : TBaseMap<K, D, CMP, tAllocator >() {} TMap() : std::map<K, D, CMP, tAllocator>() {}
// use correct two-stage name lookup supported in gcc 3.4 and above // use correct two-stage name lookup supported in gcc 3.4 and above
TMap(const tAllocator& a) : TBaseMap<K, D, CMP, tAllocator>(TBaseMap<K, D, CMP, tAllocator >::key_compare(), a) {} TMap(const tAllocator& a) : std::map<K, D, CMP, tAllocator>(std::map<K, D, CMP, tAllocator>::key_compare(), a) {}
}; };
// //
......
...@@ -180,7 +180,7 @@ protected: ...@@ -180,7 +180,7 @@ protected:
class TSymbolTableLevel { class TSymbolTableLevel {
public: public:
typedef std::map<TString, TSymbol*, std::less<TString>, pool_allocator<std::pair<const TString, TSymbol*> > > tLevel; typedef TMap<TString, TSymbol*> tLevel;
typedef tLevel::const_iterator const_iterator; typedef tLevel::const_iterator const_iterator;
typedef const tLevel::value_type tLevelPair; typedef const tLevel::value_type tLevelPair;
typedef std::pair<tLevel::iterator, bool> tInsertResult; typedef std::pair<tLevel::iterator, bool> tInsertResult;
......
...@@ -78,8 +78,8 @@ public: ...@@ -78,8 +78,8 @@ public:
} }
}; };
typedef std::map<TTypeList*, TTypeList*> TStructureMap; typedef TMap<TTypeList*, TTypeList*> TStructureMap;
typedef std::map<TTypeList*, TTypeList*>::iterator TStructureMapIterator; typedef TMap<TTypeList*, TTypeList*>::iterator TStructureMapIterator;
// //
// Base class for things that have a type. // Base class for things that have a type.
// //
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment