ard-boost (community library)

Summary

Name Value
Name ard-boost
Version 0.0.3
Installs 412
License Boost Software License, Version 1.0.
Author Vladimir Talybin
URL https://github.com/talybin/ard-boost
Repository https://github.com/talybin/ard-boost.git
Download .tar.gz
All Versions 0.0.3, 0.0.2, 0.0.1

Boost library port. Boost is a set of C++ libraries usable across a broad spectrum of applications.

Library Read Me

This content is provided by the library maintainer and has not been validated or approved.

ARD-BOOST

This is a mini port of Boost library, version 1.72.0 (latest on time of writing). Boost is a set of C++ libraries that provide support for tasks and structures such as linear algebra, pseudorandom number generation, multithreading, image processing, regular expressions, unit testing and many more. It contains 160 individual libraries.

Not all libraries are included in this port. Some libraries, such as threading and filesystem, makes no sence on Arduino hardware. Others are already in the standard, like chrono and array, and can be used from standard namespace. But there are many libraries that are not yet in standard or require C++17 or just great parts of Boost. These parts ported to this library.

So far it includes only libraries I was able to compile for Arduino. My intention is to add more libraries as needed. Requests are welcome.

Currently supporting

The following is a list of supported libraries with all their dependencies:

Get started

Before include of any Boost library make sure to include ard-boost.h. This will setup exception handling and fix some compile problems. Otherwise the usage is the same as usual. Include any of supported library and you are good to go.

#include "ard-boost.h"
#include "boost/range.hpp"

void setup()
{
int sum = 0;
for (int i : boost::irange(5, 10))
sum += i;
}

void loop() { }
Exception handling

As you may know, exceptions are disabled on Arduino. Instead of throwing exception, Boost will call special handler function with exception as argument. It is defined in ard-boost.h and by default, in case of an exception, will reboot the device.

To provide your own exception handler, make sure to define CUSTOM_EXCEPTION_HANDLER before include of ard-boost.h and override exception function. For example:

#define CUSTOM_EXCEPTION_HANDLER
#include "ard-boost.h"

void boost::throw_exception(const std::exception& ex) {
// Log exception and reboot
Particle.publish("Error", ex.what(), PRIVATE);
System.reset();
}

void setup() { }
void loop() { }

Note! The exception handler must not return (protected by noreturn attribute).

Browse Library Files