Skip to content

BenjiHansell/static_queue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

static_queue

A simple, header-only C++ container template class similar to std::queue but with no dynamic memory allocation. Intended for use embedded systems where dynamic memory allocation is unfavourable, but may also have a performance benefit on other systems.
The interface is the same as that of std::queue with all C++03 methods replicated, except for operators.

usage

Just

#include "static_queue.h"

and create a queue of e.g. ints with a max size of e.g. 20

static_queue<int, 20> q;

If using Arduino, it is assumed that the C++ standard library is unavailable and all relevant dependencies are worked around by the preproccessor. If you are using Arduino but you do have the standard library available, then you may need to

#define STD_LIB_AVAILABLE

before including the header.

For non-Arduino environments the opposite is true. If the C++ standard library is not available then you must

#define STD_LIB_UNAVAILABLE

before including the header.

compatibility

Tested to work with GCC and Clang in C++97, C++03, C++11, C++14 and C++17 modes. Also works in Arduino and Visual Studio 2017. Does not require STL to be available but does depend on <stddef.h>.

About

A C++ template container similar to std::queue but which avoids dynamic memory allocation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages