问题描述
我作出的Arduino的航点的一个载体。每个航点是一个对象。 Arduino的显然需要存储多个航点航点的导航。但是,而不是在一个标准的preprogrammed阵列存储这些航点,用户将需要能够添加,删除航点和移动它们。不幸阿尔杜伊诺不提供矢量类型作为内置库
I am making a vector of "waypoints" on the Arduino. Each waypoint is an object. The Arduino will obviously need to store multiple waypoints for waypoint navigation. But instead of storing these waypoints in a standard preprogrammed array, the user will need to be able to add, remove waypoints and move them around. Unfortunately the Arduino does not offer a vector type as a built-in library.
我目前考虑两种选择:
-
在 的,有人张贴通用库。它不包含任何索引缺失或移动操作。但它确实包含了一些内存管理策略。
In Container for objects like C++ 'vector'?, someone posted a general purpose library. It does not contain any index deletion, or movement operations. But it does contain some memory management strategies.
我用的 , dealloc中,的 以往。但我不喜欢这样的选择可言,尤其是带班。但是,这是在我的塞纳里奥是更好的选择?
I have used malloc, dealloc, calloc in the past. But I do not like that option at all, especially with classes. But is this a better option in my senario?
哪一个是往下走的更好路径?
Which one is a better path to go down?
推荐答案
的的在Arduino的的
Standard C++ for Arduino might be an option. It lets you use the STL vector in Arduino.
这篇关于在Arduino的载体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!