#endif
#endif
+/* A hack to deal with gcc 3.1. If you are using gcc3.1 and later, */
+/* you should probably really use gc_allocator.h instead. */
+#if defined (__GNUC__) && \
+ (__GNUC > 3 || (__GNUC__ == 3 && (__GNUC_MINOR__ >= 1)))
+# define simple_alloc __simple_alloc
+#endif
+
+
#define GC_ALLOC_H
enum { GC_word_alignment = GC_byte_alignment/GC_bytes_per_word };
inline void * &GC_obj_link(void * p)
-{ return *(void **)p; }
+{ return *reinterpret_cast<void **>(p); }
// Compute a number of words >= n+1 bytes.
// The +1 allows for pointers one past the end.
} else {
flh = GC_objfreelist_ptr + nwords;
GC_obj_link(p) = *flh;
- memset((char *)p + GC_bytes_per_word, 0,
+ memset(reinterpret_cast<char *>(p) + GC_bytes_per_word, 0,
GC_bytes_per_word * (nwords - 1));
*flh = p;
GC_aux::GC_mem_recently_freed += nwords;
public: \
static T *allocate(size_t n) \
{ return 0 == n? 0 : \
- (T*) alloc::ptr_free_allocate(n * sizeof (T)); } \
+ reinterpret_cast<T*>(alloc::ptr_free_allocate(n * sizeof (T))); } \
static T *allocate(void) \
- { return (T*) alloc::ptr_free_allocate(sizeof (T)); } \
+ { return reinterpret_cast<T*>(alloc::ptr_free_allocate(sizeof (T))); } \
static void deallocate(T *p, size_t n) \
{ if (0 != n) alloc::ptr_free_deallocate(p, n * sizeof (T)); } \
static void deallocate(T *p) \
__STL_BEGIN_NAMESPACE
-template <class _T>
-struct _Alloc_traits<_T, gc_alloc >
+template <class _Tp>
+struct _Alloc_traits<_Tp, gc_alloc >
{
static const bool _S_instanceless = true;
- typedef simple_alloc<_T, gc_alloc > _Alloc_type;
- typedef __allocator<_T, gc_alloc > allocator_type;
+ typedef simple_alloc<_Tp, gc_alloc > _Alloc_type;
+ typedef __allocator<_Tp, gc_alloc > allocator_type;
};
inline bool operator==(const gc_alloc&,
return false;
}
-template <class _T>
-struct _Alloc_traits<_T, single_client_gc_alloc >
+template <class _Tp>
+struct _Alloc_traits<_Tp, single_client_gc_alloc >
{
static const bool _S_instanceless = true;
- typedef simple_alloc<_T, single_client_gc_alloc > _Alloc_type;
- typedef __allocator<_T, single_client_gc_alloc > allocator_type;
+ typedef simple_alloc<_Tp, single_client_gc_alloc > _Alloc_type;
+ typedef __allocator<_Tp, single_client_gc_alloc > allocator_type;
};
inline bool operator==(const single_client_gc_alloc&,
return false;
}
-template <class _T>
-struct _Alloc_traits<_T, traceable_alloc >
+template <class _Tp>
+struct _Alloc_traits<_Tp, traceable_alloc >
{
static const bool _S_instanceless = true;
- typedef simple_alloc<_T, traceable_alloc > _Alloc_type;
- typedef __allocator<_T, traceable_alloc > allocator_type;
+ typedef simple_alloc<_Tp, traceable_alloc > _Alloc_type;
+ typedef __allocator<_Tp, traceable_alloc > allocator_type;
};
inline bool operator==(const traceable_alloc&,
return false;
}
-template <class _T>
-struct _Alloc_traits<_T, single_client_traceable_alloc >
+template <class _Tp>
+struct _Alloc_traits<_Tp, single_client_traceable_alloc >
{
static const bool _S_instanceless = true;
- typedef simple_alloc<_T, single_client_traceable_alloc > _Alloc_type;
- typedef __allocator<_T, single_client_traceable_alloc > allocator_type;
+ typedef simple_alloc<_Tp, single_client_traceable_alloc > _Alloc_type;
+ typedef __allocator<_Tp, single_client_traceable_alloc > allocator_type;
};
inline bool operator==(const single_client_traceable_alloc&,