Containers Queue can be built on

This is a discussion on Containers Queue can be built on within the C++ Programming forums, part of the General Programming Boards category; a queue cannot be built using the container vector because vector does not support pop_front. can anyone verify the validity ...

  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, 09: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, 10:09 PM
  4. help with queues
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 05-21-2002, 12:39 PM
  5. queue help
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 10-29-2001, 09:38 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21