Git Product home page Git Product logo

vector's Introduction

Vector: A simple muteable array library for arduino.

This implementation uses an underlying array to store its elements. When that array is filled the vector allocates a block of memory twice as large as its existing array. It then copies all the existing elements into that array and carries on. For that reason elements substituted as VectorType below need to implement a copy constructor and an operator= to facilitate that transfer if they're to be anything other than POD types.

To as greater extent as was practical Vector was designed to behave like a std::vector so for more information: http://www.cplusplus.com/reference/vector/vector/ is a good reference. Otherwise, for basic useage check /examples

NOTE: This library uses heap memory which can be problematic in microcontrollers where RAM is scarce. If memory availability is an issue then use Reserve(n) to allocate whatever is required at the beginning of the program and avoid pushing more than n elements during the program.

vector's People

Contributors

tomstewart89 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vector's Issues

Not working

Hi tomstewart89. First and foremost, thanks for sharing your code, however, it produces an error when compiling to the Arduino board.

image

At first, I was integrating your library in my code and it was not working, hence I thought it something I was doing wrong. Be as it may, testing your basic usage example results in the same error.
Could you possibly provide any help?

Yours sincerely,
jschpinto

issue with String type

Hello,

Is-it possible to use String type with Vector lib. ?
Vector<String> strVect;
doesn't make an issue, but when I use
strVect.PushBack("Hello");
that reboot my esp32.

Thank's

Miss part of data

I push a uint8_t to the vector, but miss some data when i try to read it.

#include <Vector.h>

Vector<uint8_t *> vector;

void setup()
{
    Serial.begin(115200);

    uint8_t v[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09};
    vector.PushBack(v);

    for (int i = 0; i < vector.Size(); i++)
    {
        uint8_t *e = vector[i];
        Serial.println(sizeof(e));
        // print 4

        for (int j = 0; j < sizeof(e); j++)
        {
            Serial.printf("%02x", e[j]);
        }
        // print 01020304
    }
}

void loop()
{
}

Could you add a license?

This library does not have a license associated with it. Could you add one to clarify what we are allowed to do?

I noticed many of your projects have the MIT license. Did you forget to add one to this project?

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.