需要一些建议选择合适的容器 [英] Need some advice to choose the proper container

查看:130
本文介绍了需要一些建议选择合适的容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图设计一个游戏引擎的任务调度程序。任务可以是动画,触发器控制器等。



我的问题是要选择什么容器。想法是:当你插入一个新的任务,容器必须重新排序,并把任务放在适当的地方。一旦执行,任务可以改变并被重新调度或删除。这主要是push和pop。



但是,如果可能,如果我可以随机访问一个元素,但不是至关重要。无论容器是否支持一个或多个具有相同键值的元素。



我认为优先级队列符合我的需求,但我看到的是基于向量实现,

解决方案



div>



(原始来源: Liam Devine


I'm trying to design a task scheduler to a game engine. A task could be an animation, a trigger controller, etc.

My problem is what container to choose. The idea is: when you insert a new task, the container must reorder and put the task in the proper place. Once executed, task could change and be scheduled again or deleted. This is mainly push and pop.

But, if possible, it would be nice if I could have random access to an element, but not vital. No matter if the container supports one or more elements with the same key.

I think that priority queue fits my needs but I saw that is based on vector implementation, and I think that this container must be somehow optimized to push and pop.

Opinions?

解决方案

(original source: Liam Devine)

这篇关于需要一些建议选择合适的容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆