andysworkshop / avr-stl Goto Github PK
View Code? Open in Web Editor NEWThe C++ Standard Template Library for the Arduino
License: Other
The C++ Standard Template Library for the Arduino
License: Other
The iterator increment method for a Red-Black Tree has an edge case that fails to change the node pointer. If the current node of the iterator is the root and there are no right hand children (and obviously no parent) then the node referenced by the iterator does not change. This means that iterations are effectively halted with the code potentially looping.
I hit the same thing when testing a version I had written and thought I would check the "master version" so to speak.
Hi,
I'm using AVR-STL and I'm having issues with it.
Here is my configuration:
This code:
#include <functional>
std::function<void()> f;
void setup() {}
void loop() {}
Just a simple use of std::function fails and I get an 'undefined type error' which is decribed by the compiler by:
error: 'function' in namespace 'std' does not name a template type
std::function<void()> f;
^
exit status 1
'function' in namespace 'std' does not name a template type
Maybe you could help me with that ?
I can do a pull-request if needed.
I also found that <map>
needs <iterator>
inclusion before and don't auto-include it.
Thanks by advance.
I have just begun using this library and the first thing I tried is, compiling the string example given in this repository. i.e,
#include <pnew.cpp>
#include <Arduino.h>
#include <serstream>
#include <string>
/*
* Test std::string
*/
struct TestString {
static void RunTest() {
std::ohserialstream serial(Serial);
std::string str;
char c;
for(c='A';c<='Z';c++)
str+=c;
serial << str << std::endl;
}
};
TestString s;
void setup() {
Serial.begin(115200);
}
void loop() {
delay(1000);
s.RunTest();
}
But I am getting the error "Error compiling for board Arduino/Genuino Uno" and the verbose is :
Build options changed, rebuilding all
In file included from C:\Users\Prashant Dandriyal\Documents\Arduino\libraries\first_attempt_vector\first_attempt_vector.ino:2:0:
e:\arduino-nightly\hardware\tools\avr\avr\include\pnew.cpp:12:20: error: declaration of 'operator new' as non-function
void* operator new(size_t size_,void *ptr_)
^
e:\arduino-nightly\hardware\tools\avr\avr\include\pnew.cpp:12:20: error: 'size_t' was not declared in this scope
e:\arduino-nightly\hardware\tools\avr\avr\include\pnew.cpp:12:33: error: expected primary-expression before 'void'
void* operator new(size_t size_,void *ptr_)
^
In file included from e:\arduino-nightly\hardware\tools\avr\avr\include\istream:24:0,
from e:\arduino-nightly\hardware\tools\avr\avr\include\string:33,
from e:\arduino-nightly\hardware\tools\avr\avr\include\streambuf:22,
from e:\arduino-nightly\hardware\tools\avr\avr\include\istream:22,
from e:\arduino-nightly\hardware\tools\avr\avr\include\serstream:19,
from C:\Users\Prashant Dandriyal\Documents\Arduino\libraries\first_attempt_vector\first_attempt_vector.ino:5:
e:\arduino-nightly\hardware\tools\avr\avr\include\ostream:281:50: error: default argument for template parameter for class enclosing 'class std::basic_ostream<charT, traits>::sentry'
class _UCXXEXPORT basic_ostream<charT,traits>::sentry
^
In file included from e:\arduino-nightly\hardware\tools\avr\avr\include\string:33:0,
from e:\arduino-nightly\hardware\tools\avr\avr\include\streambuf:22,
from e:\arduino-nightly\hardware\tools\avr\avr\include\istream:22,
from e:\arduino-nightly\hardware\tools\avr\avr\include\serstream:19,
from C:\Users\Prashant Dandriyal\Documents\Arduino\libraries\first_attempt_vector\first_attempt_vector.ino:5:
e:\arduino-nightly\hardware\tools\avr\avr\include\istream:343:107: error: default argument for template parameter for class enclosing 'class std::basic_istream<charT, traits>::sentry'
template <class charT,class traits = char_traits<charT> > class _UCXXEXPORT basic_istream<charT,traits>::sentry {
^
exit status 1
Error compiling for board Arduino/Genuino Uno.
I'm trying to just include <vector>
for a basic test and I get the following compiler error:
In file included from /opt/arduino-1.8.7/hardware/tools/avr/avr/include/stl_algobase.h:64:0,
from /opt/arduino-1.8.7/hardware/tools/avr/avr/include/vector:31,
from /tmp/arduino_modified_sketch_766904/sketch_oct20a.ino:1:
/opt/arduino-1.8.7/hardware/tools/avr/avr/include/stl_iterator.h:589:48: error: 'char_traits' does not name a type
class _CharT = char, class _Traits = char_traits<_CharT>,
Can I have done something wrong? What's the most recent supported version of the Arduino-SDK?
I'm on a Fedora 28 system and tried this with a fresh copy of the arduino-1.8.7
SDK
Hello,
I'have been using your STL library for a while with Arduino Uno and it works very well.
Now I wanted to help in providing a complete library with examples, and ready to be compiled for Uno with a recent version of avr-gcc, and with the fixes from the comment on the blog post.
I've found a wired behavior in the std::ohserialstream object, when used in the vector example:
for(it=vec.begin();it!=vec.end();it++) serial << *it << std::endl;
the output is only a small part of what is expected.
Also in the blog comments someone else found the same bug. A memory allocation problem could be generating this.
Can you help me with this bug since I'm not really expert with templates? Where should I look for in the library?
Thank you.
Hi friend. I would like to be able to reference your code in the project. But you don't have any license set for this repository. This leaves me unsure if I can cite your work. Can you set a license for this repository? Finally, thank you for the help your article has brought me.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.