How do you design FIFO queue with variable data size?

前端 未结 3 1142
借酒劲吻你
借酒劲吻你 2020-12-18 12:48

I\'m just working on the FIFO queue (the simple one, just what\'s pushed first, pops at first) with the variable data size but I\'m not sure with the way I\'m designing it.

3条回答
  •  抹茶落季
    2020-12-18 13:02

    I suggest to use the built in TQueue and/or TObjectQueue located in Contnrs.pas. With the lack of Generics one can derive a special TQueue for each datatype used. That would give you type safety inside the rest of your program, while all the casting and pointer related stuff is bundled inside the queue class.

提交回复
热议问题