* Add docs and tutorial for etl::intrusive_avl_tree
Documents the intrusive AVL tree added in PR #1425: a full API reference
page under Containers/Trees, and a tutorial demonstrating ordered access
to intrusively-linked objects with unpredictable lifetimes, including
move support and destructor-driven automatic removal from the tree.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* Add complexity shortcode and document its usage
Introduces a {{< complexity >}} Hugo shortcode (with light/dark styling
for constant/logarithmic/linear/linearithmic/polynomial/exponential
classes) for rendering Big-O complexity inline, applies it throughout
the intrusive_avl_tree API reference in place of raw "O(...)" text, and
documents the Description/Complexity structure and supported classes in
DOCUMENTATION.md.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* Fix issues found by @CodeRabbit
* Put complexity notes on their own lines in intrusive_avl_tree docs
Move the complexity shortcode from the inline "**Complexity:**" label
to its own line under a "**Complexity**" label. Notes that give several
alternatives (e.g. amortized vs. worst-case) now show each one on a
separate line. Update the guideline in DOCUMENTATION.md to match.
* Update complexity examples in DOCUMENTATION.md
Add the hard line break after the "**Complexity**" label in the
example, and rewrite the list of supported complexity classes in the
new two-line format, including an example with several alternatives.
* Add logarithmic complexity example to DOCUMENTATION.md
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
* feat: add clamped_value utility
* style: format clamped_value include list
* feat: enhance clamped_value with runtime bounds and comparison operators and DRY up the implementation
* refactor: call set in runtime ctor
instead of duplicated the clamping logic
* Add C++20 floating-point clamped_value support
* Document and stress clamped_value edge cases
* Change ETL_NOEXCEPT_IF(ETL_NOT_USING_EXCEPTIONS) to ETL_NOEXCEPT
* Change ETL_NOEXCEPT_IF(ETL_NOT_USING_EXCEPTIONS) to ETL_NOEXCEPT
* Revert changes
---------
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
Dispatch only the argument types which are actually stated. For everything
else, don't generate the code anymore.
Detemplatize parse_format_spec().
Collapse long double and double to double on targets where they are
same size. This helps prevent duplicate code generation.
Even without ETL_USE_TYPE_TRAITS_BUILTINS in the profile, we get
compiler builtins detected. Makes detection more consistent now.
Previously, some type trait builtins were detected automatically,
and some others needed to be activated via ETL_USE_TYPE_TRAITS_BUILTINS
in the profile explicitly.
Replaces: #1174
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
Further, switching internal member from array_view to span to
be closer to standard, and more constexpr friendly.
Also adjusting to C++11 template syntax.
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
Besides, remove unused ASAN_OPTIONS from github workflows.
Further, activate sanitizers for C++23 workflows, at the places
where we also activated -O3 optimization. Not activating everywhere
for CI efficiency reasons for now.
Note that the sanitizers are activated on clang C++23 workflows
only, since there is a remaining issue with GCC in delegate_cpp11.
* Update _index.md
* Update _index.md
* Cherry pick the Docker fixes for PowerPC (#1563)
Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
* Fixed building and unit tests run under XCode 2027 Beta 6 (AppleClang 21.0.0.21000333):
- Compilation failures:
- `etl::ideque::iterator::operator[]` index type should be `difference_type` (instead of `size_t`).
- random-access `etl::poly_span::iterator` is missing `operator[]`.
- Unit tests failures of `test_multimap` suit:
- fixed `equal_range`-related tests to properly verify result range (via new `Check_Equal` overload helper).
- fixed `find`-related tests to not depend on particular order of `second` values (via new `Check_ContainsPair` helper). See note 1,2) at [cppreference](https://cppreference.com/cpp/container/multimap/find) about order.
* PR review fixes.
---------
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
mutex_freertos.h unconditionally included the vanilla FreeRTOS header
layout (FreeRTOS.h and semphr.h at the include root). On ESP-IDF, and
therefore Arduino-ESP32 as well since it's built on top of ESP-IDF,
these headers are nested one level deeper under freertos/, so the
unconditional include fails to compile on any ESP32 target with
ETL_TARGET_OS_FREERTOS defined.
Use __has_include to try the standard path first, fall back to the
ESP-IDF nested path, and fail with a clear #error if neither is found,
rather than a mysterious "file not found" from the compiler.
Also resolves a pre-existing include-style inconsistency in this file:
the old code mixed "FreeRTOS.h" (quotes) with <semphr.h> (angle
brackets). All includes now uniformly use angle brackets.
* Topic/optional monadic operations
* topic/optional-monadic-operations:
- added and_then, or_else, and transform to etl::optional with unit tests
- added is_optional to optional.h, used in and_then and or_else to ensure that the returned type is an optional
- implemented as ref-qualified overloads with C++11 compatible trailing return types, following the etl::expected implementation
* Convert to C++11 style type traits
* Coderabbit changes
Constrain transform before forming etl::optional<U>.
Remove references from monadic result types.
* clang-format updates
---------
Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
* Adopt the Library Fundamentals TS make_array design for the sequence factories
make_array, make_deque, make_vector, make_list, make_forward_list and
make_indirect_vector now follow the Library Fundamentals TS
std::experimental::make_array design: a defaulted leading template
parameter selects the element type explicitly, falling back to the
decayed common type of the arguments when it is not supplied. A shared
trait (etl::private_make::element_type) performs the selection lazily,
so common_type is not instantiated when the element type is explicit.
This fixes the explicit-element-type calling style for the four
common-type factories, where make_vector<char>(lvalue) never compiled:
the explicit argument pinned the first pack parameter to char, making
it a char&& that no lvalue can bind to. It also gives make_array and
make_deque the deduced form (e.g. make_array(1, 2L) is array<long, 2>)
for free. All arguments are converted with static_cast, as in the
make_array const-lvalue fix, so const-qualified lvalues and narrowing
initialisers work in both forms.
Intentional behaviour change: an explicit element type now converts
every argument instead of pinning only the first. make_vector<char>(0,
1, ...) previously produced vector<int> - the explicit char affected
only the first argument and the element type was still the common type
- and now produces vector<char>. test_make_vector documented the old
behaviour and has been updated.
The keyed set and map factories are unchanged: their key/mapped types
are separate mandatory template parameters ahead of a fully-deduced
pack, so the explicit-type style already works, and retrofitting
deduction there would interact with the defaulted comparator/hash
parameters.
Adds explicit-element-type tests for the four common-type factories
(const/non-const lvalues plus narrowing initialisers) and
deduced-element-type tests for make_array and make_deque, and updates
the four documented signatures.
* Address review comments on the make_xxx factory design
- Forward same-type arguments in the make_xxx factories instead of
casting them. static_cast produced a prvalue that, before C++17, had
to be materialised through the move constructor, rejecting
copyable-but-non-movable element types. The new
private_make::convert helper forwards arguments that already have
the element type and static_casts the rest.
- Drop ETL_NOEXCEPT from make_array: conversions can throw, and the
other factories do not declare it.
- Remove the redundant etl::decay in element_type<void, ...>;
etl::common_type already decays its arguments.
- Stop leaking the etl::private_make implementation namespace into the
documented factory signatures.
* Add a test for make_array with an explicit element type and no arguments
etl::make_array<int>() produces an empty etl::array<int, 0> and now has
a regression test. A call with neither an element type nor arguments
remains ill-formed, matching the Library Fundamentals TS: there is
nothing to deduce the element type from. The array documentation now
states this explicitly.
---------
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>