Loading...
Pages: [1]   Go Down
Author Topic: How to work with vectors  (Read 143 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How to work with vectors in Arduino? Is there any working example?
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 137
Posts: 19015
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you mean one dimensional arrays, or magnitude and direction pairs?
Logged

Pete, it's a fool looks for logic in the chambers of the human heart.

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

One dimensional arrays.

I would like something like this
Code:
array.add(5); //add new member
array.unset(4); //delete member with index 4

Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 137
Posts: 19015
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Dynamic arrays on a RAM limited processor are not a great idea.
What are you trying to do?
Logged

Pete, it's a fool looks for logic in the chambers of the human heart.

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It's hard to explain. I can done done it with regular arrays, but it would be much easier with vectors. Is it good idea to build my own class?
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 137
Posts: 19015
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It may be possible to use STL, but I've never tried it on an Arduino.
Logged

Pete, it's a fool looks for logic in the chambers of the human heart.

Netherlands
Offline Offline
Tesla Member
***
Karma: 87
Posts: 9392
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

NIck Gammon has notes about STL on AVR/Arduino - http://www.gammon.com.au/forum/?id=11119 -

Where would we be without him smiley-wink
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

Pages: [1]   Go Up
Print
 
Jump to: