|
-
June 24th, 2002, 03:29 PM
#1
Alocator-need help
I have defined my own allocator class like:
template<class T>
class BufferAllocator ublic 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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|