STL deque problem
-
Hi, I'm novice in STL C++ librari, so my question will be very easy. I have a structure, for example: typedef struct _mystruct { char name[256]; bool sex; int age; } mystruct, *pmystruct; I can define a class based on queue STL template: typedef queue > MEMBERS_QUEUE; // This works perfectly But I want also define a class based on deque: typedef deque > MEMBERS_DEQUE; // This doesn't work. I suspect that I must define allocator for mystruct... What should I do to construct own class based on deque and mystruct? Yours sincerely, Alex Bash
-
Hi, I'm novice in STL C++ librari, so my question will be very easy. I have a structure, for example: typedef struct _mystruct { char name[256]; bool sex; int age; } mystruct, *pmystruct; I can define a class based on queue STL template: typedef queue > MEMBERS_QUEUE; // This works perfectly But I want also define a class based on deque: typedef deque > MEMBERS_DEQUE; // This doesn't work. I suspect that I must define allocator for mystruct... What should I do to construct own class based on deque and mystruct? Yours sincerely, Alex Bash
Did you forget to include the deque header file?
#include <queue>
#include <deque>using namespace std ;
...
// Using queue with deque
typedef deque<mystruct> MEMBERS_DEQUE;
typedef queue<mystruct> MEMBERS_QUEUE;Roger Stewart "I Owe, I Owe, it's off to work I go..."