Kohinoor24
June 24th, 2002, 03:29 PM
I have defined my own allocator class like:
template<class T>
class BufferAllocator:public allocator<T>
I have defined all the needed functions for the allocator.Out of them is the
pointer allocate(size_type _N, const void* p = NULL)
throw (DocGenEx)
{
return reinterpret_cast<pointer>(m_buffer.allocateBytes(_N * sizeof(T)));
// here m_buffer is another class where allocateBytes() function is defined.
}
The following is the class "T" for the allocator
class NgDocData
{
public:
list<NgSubDocData<B>> m_ngSubDocDataList;
};
Will the allocate function return me with a ptr to this object.
So can I be able to do something like this:
NgDocData * p = allocate();// which returns the ptr to this object
p->m_ngSubDocDataList;
Is this okay & could anyone tell me about how I should use the construct function of the allocator also with a code snippet
Thanks in advance.
template<class T>
class BufferAllocator:public allocator<T>
I have defined all the needed functions for the allocator.Out of them is the
pointer allocate(size_type _N, const void* p = NULL)
throw (DocGenEx)
{
return reinterpret_cast<pointer>(m_buffer.allocateBytes(_N * sizeof(T)));
// here m_buffer is another class where allocateBytes() function is defined.
}
The following is the class "T" for the allocator
class NgDocData
{
public:
list<NgSubDocData<B>> m_ngSubDocDataList;
};
Will the allocate function return me with a ptr to this object.
So can I be able to do something like this:
NgDocData * p = allocate();// which returns the ptr to this object
p->m_ngSubDocDataList;
Is this okay & could anyone tell me about how I should use the construct function of the allocator also with a code snippet
Thanks in advance.