Store Queue in a flat memory space ?

Discussion in 'C++' started by Dhanvi, Jul 23, 2005.

  1. Dhanvi

    Dhanvi Guest

    Hi,
    I have another question for the group.
    I would like to know if there is a quick way by which I could store a
    Queue in a flat memory space without the use of iterators ?

    Thanks
    -Dhanvi
     
    Dhanvi, Jul 23, 2005
    #1
    1. Advertising

  2. On Sat, 23 Jul 2005 09:47:56 +0400, Dhanvi <> wrote:

    > Hi,
    > I have another question for the group.
    > I would like to know if there is a quick way by which I could store a
    > Queue in a flat memory space


    Yes, you can. You can store queue in array or list. The list may be also
    be stored in array.

    > without the use of iterators ?


    Iterators do not impose any restrictions on the data structure they
    provide access to, rather contrariwise.

    --
    Maxim Yegorushkin
    <>
     
    Maxim Yegorushkin, Jul 23, 2005
    #2
    1. Advertising

  3. Dhanvi

    Alan Johnson Guest

    Dhanvi wrote:
    > Hi,
    > I have another question for the group.
    > I would like to know if there is a quick way by which I could store a
    > Queue in a flat memory space without the use of iterators ?
    >
    > Thanks
    > -Dhanvi
    >


    Example :

    #include <queue>
    #include <vector>

    std::queue< int, std::vector<int> > q


    By default, deque is used as the underlying sequence for a queue.
    However, the standard (as far as I can tell) does not guarantee
    contiguous storage for deques (is this what you mean by flat memory space?).

    -Alan
     
    Alan Johnson, Jul 23, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Shuo Xiang

    Stack space, global space, heap space

    Shuo Xiang, Jul 9, 2003, in forum: C Programming
    Replies:
    10
    Views:
    2,914
    Bryan Bullard
    Jul 11, 2003
  2. Christian Seberino
    Replies:
    21
    Views:
    1,679
    Stephen Horne
    Oct 27, 2003
  3. Ian Bicking
    Replies:
    2
    Views:
    1,026
    Steve Lamb
    Oct 23, 2003
  4. Russell Warren

    Is Queue.Queue.queue.clear() thread-safe?

    Russell Warren, Jun 22, 2006, in forum: Python
    Replies:
    4
    Views:
    686
    Russell Warren
    Jun 27, 2006
  5. Kris
    Replies:
    0
    Views:
    489
Loading...

Share This Page