[dasher] GCC 4.6 compile fix:
- From: Patrick Welche <pwelche src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dasher] GCC 4.6 compile fix:
- Date: Sat, 22 Sep 2012 14:43:33 +0000 (UTC)
commit 6a81d18b54c61186051a0da50e1152f9593a1597
Author: Patrick Welche <prlw1 cam ac uk>
Date: Sat Sep 22 15:41:04 2012 +0100
GCC 4.6 compile fix:
* Most libstdc++ standard headers have been changed to no longer
include the cstddef header as an implementation detail. Code that
relied on that header being included as side-effect of including
other standard headers will need to include cstddef explicitly.
(iconv.h include stddef.h)
Src/Common/Allocators/SimplePooledAlloc.h | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/Src/Common/Allocators/SimplePooledAlloc.h b/Src/Common/Allocators/SimplePooledAlloc.h
index 9674371..9141240 100644
--- a/Src/Common/Allocators/SimplePooledAlloc.h
+++ b/Src/Common/Allocators/SimplePooledAlloc.h
@@ -9,13 +9,14 @@
// Alloc returns a default-constructed T*
// Memory is only freed on destruction of the allocator
+#include <cstddef>
#include <vector>
template<typename T>
class CSimplePooledAlloc {
public:
// Construct with given block size
- CSimplePooledAlloc(size_t iBlockSize);
+ CSimplePooledAlloc(std::size_t iBlockSize);
~CSimplePooledAlloc();
@@ -25,7 +26,7 @@ public:
private:
class CPool {
public:
- CPool(size_t iSize):m_iCurrent(0), m_iSize(iSize) {
+ CPool(std::size_t iSize):m_iCurrent(0), m_iSize(iSize) {
m_pData = new T[m_iSize];
}
~CPool() {
@@ -35,24 +36,25 @@ private:
if(m_iCurrent < m_iSize)
return &m_pData[m_iCurrent++];
return NULL;
- } private:
- mutable size_t m_iCurrent;
- size_t m_iSize;
+ }
+ private:
+ mutable std::size_t m_iCurrent;
+ std::size_t m_iSize;
T *m_pData;
};
std::vector < CPool * >m_vPool;
- size_t m_iBlockSize;
+ std::size_t m_iBlockSize;
int m_iCurrent;
};
-template < typename T > CSimplePooledAlloc < T >::CSimplePooledAlloc(size_t iSize):m_iBlockSize(iSize), m_iCurrent(0) {
+template < typename T > CSimplePooledAlloc < T >::CSimplePooledAlloc(std::size_t iSize):m_iBlockSize(iSize), m_iCurrent(0) {
m_vPool.push_back(new CPool(m_iBlockSize));
}
template < typename T > CSimplePooledAlloc < T >::~CSimplePooledAlloc() {
- for(size_t i = 0; i < m_vPool.size(); i++)
+ for(std::size_t i = 0; i < m_vPool.size(); i++)
delete m_vPool[i];
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]