开发者

Queue implementation with heap

I'm trying to implement a queue.

This is my framework

class Queue { 
 HANDLE heap;    
 Int *buf;     
 Int head, tail;   
 Int spaceAllocated;  
 Int sizeQ;    
public: 
 void Push (Int item);    
 Int Pop (Int *array, int batchSize);  
}

I'm doing this with a heap using windows API. What is the purpose of the buffer and how is it used? I know it has something to 开发者_如何学Godo with the heap and holding memory.


*Buf is the actual memory pointer you'll use to store your items. I imagine you're using VirtualAlloc() here to create your buffer? If so, you need to know the maximum size of your queue.

As an aside, why can you not use the STL queue?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜