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;
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 @@ public:
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 T, class CMP> class TStlSet : public std::set<T, CMP, pool_alloc
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) {}
};
//
......
......@@ -180,7 +180,7 @@ protected:
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;
......
......@@ -78,8 +78,8 @@ public:
}
};
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.
//
......
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