Thread: Containers Queue can be built on

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    4

    Containers Queue can be built on

    a queue cannot be built using the container vector because vector does not support pop_front.

    can anyone verify the validity of this statment for me... or if this is not the main reason a queue cannot be built using vector... point out what it is

    Thanks

  2. #2
    booyakasha
    Join Date
    Nov 2002
    Posts
    208
    I queue can be built using a vector, I don't see any reason why not.

  3. #3
    Registered User
    Join Date
    Oct 2002
    Posts
    4
    A queue requires that the first element into the container be the first out out of the container, hence a queue needs to support both the push_back and pop_front functions. I believe that vector supports only push_back and that is why you couldn't use it to build a queue....

  4. #4
    booyakasha
    Join Date
    Nov 2002
    Posts
    208
    you could create your own pop_front by using
    vector::front()//get the front
    then
    vector::erase(...)//remove the front

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with FIFO QUEUE
    By jackfraust in forum C++ Programming
    Replies: 23
    Last Post: 04-03-2009, 08:17 AM
  2. Fixing my program
    By Mcwaffle in forum C Programming
    Replies: 5
    Last Post: 11-05-2008, 03:55 AM
  3. help with queues
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 05-21-2002, 09:09 PM
  4. help with queues
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 05-21-2002, 11:39 AM
  5. queue help
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 10-29-2001, 09:38 AM