diff options
author | Jens Ole Wund <bjornmose@gmx.net> | 2006-02-10 01:09:11 +0300 |
---|---|---|
committer | Jens Ole Wund <bjornmose@gmx.net> | 2006-02-10 01:09:11 +0300 |
commit | c425ad9507bda6804b9e011843b9198a4016cb9c (patch) | |
tree | 0b3da20a75825d5b0b2ea76b5471a77263cda558 /intern/memutil | |
parent | 9c003086fefe5a205cc5a09c7c827c364038ec97 (diff) |
make msvc6 compile (thanks peter)
so beat me if it does not work ;)
Diffstat (limited to 'intern/memutil')
-rw-r--r-- | intern/memutil/MEM_Allocator.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/intern/memutil/MEM_Allocator.h b/intern/memutil/MEM_Allocator.h index 40716496d16..b3a6df74ba2 100644 --- a/intern/memutil/MEM_Allocator.h +++ b/intern/memutil/MEM_Allocator.h @@ -29,6 +29,12 @@ #include "guardedalloc/MEM_guardedalloc.h" +#ifdef _MSC_VER +#if _MSC_VER < 1300 // 1200 == VC++ 6.0 according to boost +#define MS_VISUALC_6_0_WORKAROUND 1 +#endif +#endif + template<typename _Tp> struct MEM_Allocator { @@ -40,16 +46,20 @@ struct MEM_Allocator typedef const _Tp& const_reference; typedef _Tp value_type; +#ifndef MS_VISUALC_6_0_WORKAROUND template<typename _Tp1> struct rebind { typedef MEM_Allocator<_Tp1> other; }; +#endif MEM_Allocator() throw() {} MEM_Allocator(const MEM_Allocator& __a) throw() {} +#ifndef MS_VISUALC_6_0_WORKAROUND template<typename _Tp1> MEM_Allocator(const MEM_Allocator<_Tp1> __a) throw() { } +#endif ~MEM_Allocator() throw() {} @@ -57,6 +67,11 @@ struct MEM_Allocator const_pointer address(const_reference __x) const { return &__x; } +#ifdef MS_VISUALC_6_0_WORKAROUND + char *_Charalloc(size_type n) { + return (char *) MEM_mallocN(n, "STL MEM_Allocator VC6.0"); + } +#endif // NB: __n is permitted to be 0. The C++ standard says nothing // about what the return value is when __n == 0. _Tp* allocate(size_type __n, const void* = 0) { @@ -68,10 +83,17 @@ struct MEM_Allocator return __ret; } +#ifndef MS_VISUALC_6_0_WORKAROUND // __p is not permitted to be a null pointer. void deallocate(pointer __p, size_type){ MEM_freeN(__p); } +#else + // __p is not permitted to be a null pointer. + void deallocate(void* __p, size_type){ + MEM_freeN(__p); + } +#endif size_type max_size() const throw() { return size_t(-1) / sizeof(_Tp); |