ard-stdlib (community library)
Summary
Name | Value |
---|---|
Name | ard-stdlib |
Version | 1.0.0 |
Installs | |
License | GPL-3.0 License. |
Author | Vladimir Talybin |
URL | https://github.com/talybin/ard-stdlib |
Repository | https://github.com/talybin/ard-stdlib.git |
Download | .tar.gz |
Type traits and utilities from C++17/20/23 and experimental TS.
Library Read Me
This content is provided by the library maintainer and has not been validated or approved.
ARD-STDLIB
Library of type traits and utilities from C++17/20/23 and experimental TS.
Currently supporting
variant.hpp
optional.hpp
string_view.hpp
memory.hpp
utility.hpp
type_traits.hpp
- void_t
- bool_constant
- conjunction
- disjunction
- negation
- invoke_result
- is_invocable, is_invocable_r, is_nothrow_invocable, is_nothrow_invocable_r
- type_identity
- remove_cvref
- is_swappable, is_nothrow_swappable, is_swappable_with, is_nothrow_swappable_with
- nonesuch
- is_detected, detected_or, is_detected_exact, is_detected_convertible
functional.hpp
Get started
All header files has the same name as original but with postfix .hpp
. For example, to include variant use variant.hpp
.
#include "Particle.h"
#include "variant.hpp"
void setup()
{
std::variant<int, float> v;
v = 19.5f; // v contains float
bool success = std::visit((link unavailable in preview) {
return Particle.publish("temperature", String::format("%.1f", temp));
}, v);
}
void loop() { }
Exception handling
As you may know, exceptions are disabled on Arduino. Instead of throwing exception, library will call special handler function with exception as argument. It is defined in exception.hpp
and in case of an exception, will abort the program (call std::abort
).
To catch exceptions override exception handler.
#include "Particle.h"
#include "exception.hpp"
void ard::on_exception(const std::exception& ex) {
// Log exception
Particle.publish("Error", ex.what(), PRIVATE);
// Reboot
System.reset();
}
void setup() { }
void loop() { }
Note! The exception handler is located in ard
namespace.
Browse Library Files