Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. STL deque problem

STL deque problem

Scheduled Pinned Locked Moved ATL / WTL / STL
c++questionlinuxdata-structureshelp
2 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Bash
    wrote on last edited by
    #1

    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

    R 1 Reply Last reply
    0
    • B 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

      R Offline
      R Offline
      Roger Stewart
      wrote on last edited by
      #2

      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..."

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups