Results 1 to 6 of 6

Thread: Template stack, isn't there is a FIFO ?

  1. #1
    Join Date
    Jan 2006
    Posts
    162
    Thanks
    9
    Qt products
    Qt3
    Platforms
    Windows

    Default Template stack, isn't there is a FIFO ?

    Hi, I found a LIFO (QValueStack) but I don't find a FIFO, it does not exists ?

    If it does not exists, what kind of template should I use in order to have the behaviour of a FIFO ?

    Thanks in advance.

  2. #2
    Join Date
    Jan 2006
    Posts
    162
    Thanks
    9
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: Template stack, isn't there is a FIFO ?

    Hmm, I could use the QValueList and its first/last, pop_front/pop_back, push_front/push_back functions for such a behaviour, but it is not a stack.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Template stack, isn't there is a FIFO ?

    There is a QValueStack class (and its cousin QPtrStack).

  4. #4
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: Template stack, isn't there is a FIFO ?

    You always can give stack singularity to your own inherits from QValueList class
    a life without programming is like an empty bottle

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Template stack, isn't there is a FIFO ?

    Quote Originally Posted by yellowmat
    Hmm, I could use the QValueList and its first/last, pop_front/pop_back, push_front/push_back functions for such a behaviour, but it is not a stack.
    There is no such thing as FIFO stack --- stacks always have LIFO access. What you need is a queue.

    QValueList implements both stack and queue interfaces. If you don't like it, you can write your own class that encapsulates QValueList and delivers only queue interface.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Template stack, isn't there is a FIFO ?

    There is a QPtrQueue class if you can use pointers and not values. And of course std::queue.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.