在Arduino的载体 [英] Vectors in Arduino

查看:213
本文介绍了在Arduino的载体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我作出的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.

我目前考虑两种选择:


  1. 集装箱像C ++的矢量对象? 的,有人张贴通用库。它不包含任何索引缺失或移动操作。但它确实包含了一些内存管理策略。

  1. 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.

我用的 malloc, dealloc中,的 calloc以往。但我不喜欢这样的选择可言,尤其是带班。但是,这是在我的塞纳里奥是更好的选择?

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?

推荐答案

标准C ++的Arduino的可能是一种选择。它可以让你使用 STL 矢量在Arduino的

Standard C++ for Arduino might be an option. It lets you use the STL vector in Arduino.

这篇关于在Arduino的载体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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