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
diff --git a/src/compiler/Common.h b/src/compiler/Common.h
index 4ddef72..99e1f71 100644
--- a/src/compiler/Common.h
+++ b/src/compiler/Common.h
@@ -60,10 +60,6 @@
void operator delete[](void*) { } \
void operator delete[](void *, void *) { }
-#define TBaseMap std::map
-#define TBaseList std::list
-#define TBaseSet std::set
-
//
// Pool version of string.
//
@@ -86,12 +82,12 @@
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:
- typedef typename TBaseList<T, pool_allocator<T> >::size_type size_type;
- TList() : TBaseList<T, pool_allocator<T> >() {}
- TList(const pool_allocator<T>& a) : TBaseList<T, pool_allocator<T> >(a) {}
- TList(size_type i): TBaseList<T, pool_allocator<T> >(i) {}
+ typedef typename std::list<T, pool_allocator<T> >::size_type size_type;
+ TList() : std::list<T, pool_allocator<T> >() {}
+ TList(const pool_allocator<T>& a) : std::list<T, pool_allocator<T> >(a) {}
+ TList(size_type i): std::list<T, pool_allocator<T> >(i) {}
};
// This is called TStlSet, because TSet is taken by an existing compiler class.
@@ -101,13 +97,13 @@
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:
- 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
- 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) {}
};
//
diff --git a/src/compiler/SymbolTable.h b/src/compiler/SymbolTable.h
index b7aa989..f58cdb8 100644
--- a/src/compiler/SymbolTable.h
+++ b/src/compiler/SymbolTable.h
@@ -180,7 +180,7 @@
class TSymbolTableLevel {
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 const tLevel::value_type tLevelPair;
typedef std::pair<tLevel::iterator, bool> tInsertResult;
diff --git a/src/compiler/Types.h b/src/compiler/Types.h
index 0fe1f83..ed6bf05 100644
--- a/src/compiler/Types.h
+++ b/src/compiler/Types.h
@@ -78,8 +78,8 @@
}
};
-typedef std::map<TTypeList*, TTypeList*> TStructureMap;
-typedef std::map<TTypeList*, TTypeList*>::iterator TStructureMapIterator;
+typedef TMap<TTypeList*, TTypeList*> TStructureMap;
+typedef TMap<TTypeList*, TTypeList*>::iterator TStructureMapIterator;
//
// Base class for things that have a type.
//