More changes to the cSTLAllocator for mac os x compatibility.

This commit is contained in:
Joshua Jones 2010-03-14 00:01:23 +00:00
parent dfef14e5f7
commit f7bbd9f0f9
2 changed files with 25 additions and 9 deletions

View File

@ -36,17 +36,17 @@ namespace cAudio
typedef cSTLAllocator<U> other;
};
inline explicit cSTLAllocator()
cSTLAllocator()
{ }
virtual ~cSTLAllocator()
~cSTLAllocator() throw()
{ }
inline cSTLAllocator( cSTLAllocator const& )
cSTLAllocator( const cSTLAllocator& ) throw()
{ }
template <typename U>
inline cSTLAllocator( cSTLAllocator<U> const& )
cSTLAllocator( const cSTLAllocator<U>& ) throw()
{ }
pointer address(reference x) const
@ -89,14 +89,30 @@ namespace cAudio
}
};
template <typename T1, typename T2>
bool operator==(const cSTLAllocator<T1>&, const cSTLAllocator<T2>&)
template<> class cSTLAllocator<void>
{
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef void* pointer;
typedef const void* const_pointer;
typedef void value_type;
template<typename U>
struct rebind
{
typedef cSTLAllocator<U> other;
};
};
template <typename T>
inline bool operator==(const cSTLAllocator<T>&, const cSTLAllocator<T>&)
{
return true;
}
template <typename T1, typename T2>
bool operator!=(const cSTLAllocator<T1>&, const cSTLAllocator<T2>&)
template <typename T>
inline bool operator!=(const cSTLAllocator<T>&, const cSTLAllocator<T>&)
{
return false;
}

View File

@ -12,7 +12,7 @@ namespace cAudio
//! Smallest number that can be represented with a 32 bit float (may not match your compiler/os varient)
const float Epsilon = 0.000001f;
//! Internal function that compared two floats while keeping the Epsilon in mind.
//! Internal function that compares two floats while keeping the Epsilon in mind.
inline bool float_equals(const float a, const float b)
{
return (a + Epsilon >= b) && (a - Epsilon <= b);