V
V
vik5232014-09-11 10:43:45
C++ / C#
vik523, 2014-09-11 10:43:45

What is better to use std::vector or plain array in c++?

I have little experience in c++ programming. There was a task of analyzing data coming from a certain sensor (filtering, noise reduction, etc.).
The data is in the form of double numbers.
The question is: what is better to use to work with such data? Simple dynamic array or std::vector or maybe something else?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
G
Gregory, 2014-09-11
@vik523

It is better to use a vector from an array and a vector - there are iterators there, and this is a more convenient array traversal and it is more difficult to go beyond the boundaries when traversing. You can also look in the direction of List, but there the data is stored differently and the list takes up a little more memory in the general case.

T
tsarevfs, 2014-09-11
@tsarevfs

vector is almost always as good as a regular array.

S
Sergey, 2014-09-11
Protko @Fesor

I would organize a ring-buffer if this business needs to be done in real time.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question