6205 Commits

Author SHA1 Message Date
John Wellbelove
fecd601ea6
Merge branch 'development' into issue/Fix-signed/unsigned-warnings-in-VS2022 2026-07-26 20:30:58 +01:00
Björn Schäpers
52502734fa
Fix ODR violation in optional (#1522)
* Fix ODR violation in optional

Detected by GCC 15, when using in a module context.

* Make etl::nullopt constant
2026-07-26 09:21:53 +01:00
John Wellbelove
5b8a0a11a9 Fixed signed/unsigned warnings in VS2022 2026-07-25 19:14:12 +01:00
Murat Kilivan
c1cab856a8
Restore .devcontainer/context directory removed by #1422 (#1516)
PR #1422 deleted the only file in .devcontainer/context/
(reinstall-cmake.sh) as unused, which silently removed the directory
itself since git doesn't track empty ones. Every devcontainer.json
under .devcontainer/ (root and all compiler variants) references this
path as its Docker build context, so opening the project in a dev
container now fails immediately with:

  ERROR: failed to build: unable to prepare context: path
  ".../.devcontainer/context" not found

Add a .gitkeep placeholder to keep the directory present in git so
the build context resolves again.

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-07-21 11:45:35 +01:00
John Wellbelove
7cdc89a38a
Clean up the use of type traits by using C++11 forms wherever possible. (#1515)
* Clean up the use of type traits by using C++11 forms wherever possible.

* clang-format changes

---------

Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>
2026-07-20 14:58:57 +02:00
Roland Reichwein
83831216d4
Fix deep const-cast in ivector pointer repair for const pointee types (#1511)
to_void_pptr() previously stripped const from the pointed-to type via
element_type, breaking pointer-to-const element types such as
etl::vector<const int*>. Convert through void* instead, removing only the
buffer's top-level const and avoiding reinterpret_cast.

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-07-20 13:53:21 +02:00
Roland Reichwein
a74c33bab9
Fix variant emplace to be valueless after a throwing construction (#1510)
variant::do_destroy() now always resets type_id to variant_npos after
destroying the active alternative. emplace()/operator= set the new
discriminator only after successful construction, so if the constructor
throws the variant is left valueless (index() == variant_npos) instead of
reporting the stale old index.

Add regression test test_emplace_throwing_is_valueless_by_exception
covering both the trivially-destructible (union) and non-trivially-
destructible (buffer) storage suites.

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-07-20 12:26:02 +02:00
Roland Reichwein
08b9c371a0
Various fixes and cleanup (#1507)
* Fix histogram test

Use different Start index so skipped start_index copy would not get
unnoticed in the test.

* Fix several test_vector_* for valid data

Instead of comparing the moved-from data which is invalid, compare with
the valid initial_data.

* Fix test_vector to check for the correct iterator position after erase

This was done before, but a recent change dropped it.

* Fix bit_stream: Guard nbits > 0 to prevent division by zero

* Cleanup

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-07-20 11:19:41 +02:00
Murat Kilivan
22686f869e
ci: bump actions/checkout to v6.0.3 (#1517)
GitHub Actions runners now force Node.js 24; actions/checkout@v4 still targets Node.js 20 and triggers a deprecation warning. Pin all workflows to v6.0.3, the latest stable release with native Node.js 24 support.
2026-07-19 22:17:48 +01:00
Roland Reichwein
0e01c812ea
Fix variant copy operations enabled with non-copyable alternatives (#1514)
etl::variant was copy-constructible and copy-assignable even when an
alternative was not copyable, and copying a non-copyable active
alternative silently copied only the index, leaving the variant in an
invalid state.

Move the copy/move construct and assign logic into variant_base and add
a variant_copy_move_control mixin that conditionally deletes the copy and
move special members based on whether every alternative is copy/move
constructible. The variant's special members are now defaulted, so they
are deleted unless all alternatives support the operation.

Fixes: #1512

Further, same-type-assignment optimization: Previously, assignment
was destroy-and-reconstruct. Now, copy/move-assign are enabled if
the types allow for it.

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-07-19 12:00:41 +01:00
Roland Reichwein
49f690a921
Add safe integer comparisons (#1506)
Adding cmp_equal, cmp_not_equal, cmp_less, cmp_greater, cmp_less_equal,
cmp_greater_equal and in_range.

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-07-18 16:37:53 +02:00
Roland Reichwein
66f904b1a3
Support structured bindings for array (#1505) 2026-07-16 21:21:19 +02:00
Roland Reichwein
875c9782d7
Add missing array get<> overloads, and noexcept/constexpr (#1504)
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-07-16 10:55:01 +01:00
Roland Reichwein
f84d2e4af2
Add difference_type to span (#1503)
Aligns with std. Generic code can depend on it.

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-07-16 10:10:00 +01:00
Roland Reichwein
38f7318a85
Add etl::apply (#1509)
Fixes: #1272

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-07-16 09:15:24 +01:00
Roland Reichwein
ea8eda0147
Remove redundant reinterpret_cast (#1508) 2026-07-15 08:26:50 +01:00
John Wellbelove
86c3dad1e9
Remove the documentation page for type_id, as it doesn't exist in the ETL. (#1502)
Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
2026-07-15 08:24:36 +01:00
John Wellbelove
7f290365a9 Merge branch 'development' 20.48.1 2026-07-11 13:23:31 +01:00
John Wellbelove
afa17c5042 Squashed commit of the following:
commit c5dc331004b4d9611ab996935bedada203676c71
Author: John Wellbelove <john.wellbelove@etlcpp.com>
Date:   Sat Jul 11 12:32:20 2026 +0100

    Updated release notes

commit 4bf6ed6ce8d79857658d763e368ee56617542b2c
Author: vcoselev <145198867+vcoselev@users.noreply.github.com>
Date:   Sat Jul 11 12:05:39 2026 +0100

    Fix for 1405: etl::exchange doesn't work with unique_ptr (#1477)

    * Separate bit order and endianness in bit_stream.h (#1495)

    * Factor out ranges tests from test_algorithm.cpp to test_algorithm_ranges.cpp (#1497)

    * Fix exchange to use forwarding reference (U&&) and move

    - etl::exchange was using the copy constructor. Changed for etl::move.
    - The assignment to the new object is now done with forward.
    - Added a test with unique_ptr.

    ---------

    Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>
    Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>

commit 2ed9019df04d470530c41c1f27d35adc30b9a32d
Author: Moritz Pflanzer <moritz@pflanzer.eu>
Date:   Fri Jul 10 11:42:32 2026 +0200

    Update operator[] docs for map class (#1499)

    * Separate bit order and endianness in bit_stream.h (#1495)

    * Update operator[] docs for map class

    No const variant is implemented for the operator[].

    ---------

    Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>

commit 423e18d96dc645f1c733cb0d8ae6b675b9eb7e83
Author: Roland Reichwein <Roland.Reichwein@bmw.de>
Date:   Fri Jul 10 11:14:08 2026 +0200

    Factor out ranges tests from test_algorithm.cpp to test_algorithm_ranges.cpp (#1497)

commit 338bfdbb1f4df3c5c08a68a9038f13b8dae1c28b
Author: John Wellbelove <jwellbelove@users.noreply.github.com>
Date:   Fri Jul 10 10:12:04 2026 +0100

    Add coverage report to docs (#1498)

    * Updated release notes

    * Added link to coverage report

    ---------

    Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>

commit 269025424f4c6f61cebac090f4df82985fb3b239
Merge: c004cc9d faa4c15b
Author: John Wellbelove <john.wellbelove@etlcpp.com>
Date:   Thu Jul 9 14:18:32 2026 +0100

    Merge branch 'development' of https://github.com/ETLCPP/etl into development

commit c004cc9d508efcf398630758a47aae95b37a7eb8
Author: John Wellbelove <john.wellbelove@etlcpp.com>
Date:   Thu Jul 9 10:06:17 2026 +0100

    Updated release notes

commit faa4c15b49c8ad15475c83ae23e00f5a46f803ca
Author: John Wellbelove <john.wellbelove@etlcpp.com>
Date:   Thu Jul 9 10:06:17 2026 +0100

    Updated release notes

commit 1523e63e35a15cfd1fa72d230a3c79efa7b9c3e0
Author: Roland Reichwein <Roland.Reichwein@bmw.de>
Date:   Wed Jul 8 20:48:33 2026 +0200

    Support non-assignable alternatives in variant (#1496)

commit 878a0ba5a28f6b0dcae9f472a6a6a1f107de0a74
Author: John Wellbelove <john.wellbelove@etlcpp.com>
Date:   Wed Jul 8 11:07:01 2026 +0100

    Updated version and release notes

commit 5287fe4b3b9f58330881d2a62abf6ce8e1159b8d
Author: John Wellbelove <jwellbelove@users.noreply.github.com>
Date:   Wed Jul 8 09:06:50 2026 +0100

    Allow etl::vector to store pointers to functions and member functions (#1492)

    * Refactored vector.h

    Deleted ivectorpointer.h

    * Minor changes

    * Fixed code incompatible with C++03

    * Clang-format changes

    * Removed redundant double-qualified name

    * Fixed is_is_object_pointer_v to is_object_pointer_v

    * Added new test files to meson.build

    * Added overflow checks to vector_ext copy and move constructors and assignments

    Added assert throw tests.

    * Added diagnostic pushes to eliminate GCC warning false positives

    * Changed the GCC C++23 Github action to use GCC14

    * Applied clang-format

    * Added guard to pop_heap

    * Added guard to adjust_heap

    * Attempt to fix GCC diagnostic

    * Attempt to fix GCC diagnostic

    Re-enable ranges algorithm tests

    * Attempt to fix GCC diagnostic

    Re-enable ranges algorithm tests

    * clang-format

    * Attempt to fix GCC diagnostic

    Re-enable ranges algorithm tests

    * Attempt to fix GCC diagnostic

    Re-enable ranges algorithm tests

    * Attempt to fix GCC diagnostic

    Re-enable ranges algorithm tests

    * Missing newline at end of file

    * Attempt to fix GCC diagnostic

    Re-enable ranges algorithm tests

    * Attempt to fix GCC diagnostic

    Re-enable ranges algorithm tests

    * Attempt to fix GCC diagnostic

    Re-enable ranges algorithm tests

    * Attempt to fix GCC diagnostic

    Re-enable ranges algorithm tests

    * Attempt to fix GCC diagnostic

    * clang-format

    * Changed gcc --version to gcc-14 --version

    ---------

    Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
    Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>

commit 40dddd7f9601985ae7350e60a404af9028bc9fe9
Author: Roland Reichwein <Roland.Reichwein@bmw.de>
Date:   Tue Jul 7 23:41:17 2026 +0200

    Add optional etl_profile label_flag for Bazel profile injection (#1491)

    Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>

commit 84fca4cd62f72c382c062376ca934803116a20d5
Author: Roland Reichwein <Roland.Reichwein@bmw.de>
Date:   Tue Jul 7 21:45:47 2026 +0200

    Add missing memory functions, according the standard (#1490)

    Adding:

    - etl::align
    - etl::assume_aligned
    - etl::is_sufficiently_aligned
    - etl::launder
    - etl::pointer_traits
    - etl::start_lifetime_as

    Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>

commit dca6653b3759b2cdc79307fec7425589feea478d
Author: Roland Reichwein <Roland.Reichwein@bmw.de>
Date:   Tue Jul 7 21:00:09 2026 +0200

    Add missing interfaces to etl::chrono (#1489)

    Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>

commit c52b2ac7b1f675e6b1d34052239423b7f3634033
Author: Roland Reichwein <Roland.Reichwein@bmw.de>
Date:   Tue Jul 7 18:06:05 2026 +0200

    Fix etl::mem_cast cross-size copy constructor and assignment (#1488)

    The templated cross-size copy constructor and assignment operator were
    broken in two ways:

    - They accessed other.buffer / rhs.buffer, which is private in a
      different mem_cast instantiation, so the cross-size overloads failed
      to compile whenever they were actually instantiated.
    - They copied Size_ (the destination size) bytes from a source buffer
      that is only Other_Size bytes large, reading past the end of the
      source when the destination was larger.

    Use the public data() accessor and copy Other_Size bytes. The existing
    static_assert(Size >= Other_Size) guarantees the destination is big
    enough.

    Add test_mem_cast_copy_and_assign_from_smaller regression test.

    Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>

commit 165674cb23dda1fd4f7e5a1182f49554a796bfe8
Author: Roland Reichwein <Roland.Reichwein@bmw.de>
Date:   Tue Jul 7 16:41:50 2026 +0200

    Fix etl::pearson::reset() not resetting the first-byte flag (#1487)

    reset() cleared the hash array but left the `first` flag false, so a
    calculator reused after reset() took the XOR update path on its next
    add() instead of the initialisation path. This produced an incorrect
    hash for any pearson object that was reset and reused.

    Reset `first` to true in reset() so a reset calculator behaves like a
    freshly constructed one.

    Add test_pearson_reset regression test.

    Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>

commit 032ec4cc80f1c0f1baa0383bdbc5f9239b68f268
Author: Roland Reichwein <Roland.Reichwein@bmw.de>
Date:   Tue Jul 7 13:40:04 2026 +0200

    Fix etl::bitset single-element from_string shift on empty string (#1486)

    The single-element from_string overloads (char, wchar_t, char16_t,
    char32_t) computed element_type(1) << (string_length - 1U) before the
    copy loop. For an empty string, or when active_bits is 0, string_length
    is 0, so the shift count underflows to SIZE_MAX. Shifting by more than
    the element width is undefined behaviour, which also breaks constexpr
    evaluation.

    Guard the mask with a zero-length check so the shift is only performed
    when string_length > 0. The multi-element from_string overloads were
    already safe.

    Add test_construct_from_empty_string regression test.

    Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>

commit 98cb365d4c28e7b72f8547b734a03a4068acd3f5
Author: Roland Reichwein <Roland.Reichwein@bmw.de>
Date:   Tue Jul 7 12:32:56 2026 +0200

    Fix etl::histogram copy/move not preserving start_index (#1485)

    The run-time-offset specialization of etl::histogram stores a start_index
    member used to map keys to bins (accumulator[key - start_index]). Its copy
    constructor, move constructor, copy assignment, and move assignment copied
    only the accumulator and left start_index uninitialized, so a copied or
    moved histogram indexed the wrong bin in operator[]/add(), causing
    out-of-bounds access (undefined behavior).

    All four special member functions now also copy start_index. The
    compile-time-offset specialization is unaffected, as its start index is a
    template constant rather than a data member.

    Add regression tests covering copy/move construction and assignment.

    Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>

commit 5cd2f28cd54e4019f7be126bcf7394a6a8318eb9
Author: Drew Rife <darife@jlg.com>
Date:   Tue Jul 7 03:14:48 2026 -0400

    Refactor variant::emplace to perfect forward args instead of copy/move construct (#1494)

    * refactor: emplace logic to use do_emplace for in-place construction with forwarded arguments #1493

    * Add test for variant_variadic

    ---------

    Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>

commit a47c0aae81b886259918961d5fcee20faa06fdd0
Author: Roland Reichwein <Roland.Reichwein@bmw.de>
Date:   Mon Jul 6 17:32:26 2026 +0200

    Fix etl::message_timer firing following timers early on unregister (#1484)

    active_list.remove(id, has_expired) adjusts the next timer's delta only
    when has_expired is false. When unregistering an active, non-expired timer,
    unregister_timer() incorrectly passed true, skipping that adjustment, so
    every timer after the removed one in the active list fired early by the
    removed timer's delta.

    Pass false instead, matching the etl::callback_timer family. tick() still
    passes true, since the timer has genuinely expired there. The bug affected
    all four variants: message_timer, message_timer_interrupt,
    message_timer_atomic and message_timer_locked. Existing tests missed it
    because they only ever unregistered the tail timer, where the delta
    adjustment is a no-op.

    Add a regression test that unregisters a non-tail active timer and checks
    the following timer still fires at its original absolute time.
2026-07-11 13:02:42 +01:00
John Wellbelove
c5dc331004 Updated release notes 2026-07-11 12:32:20 +01:00
vcoselev
4bf6ed6ce8
Fix for 1405: etl::exchange doesn't work with unique_ptr (#1477)
* Separate bit order and endianness in bit_stream.h (#1495)

* Factor out ranges tests from test_algorithm.cpp to test_algorithm_ranges.cpp (#1497)

* Fix exchange to use forwarding reference (U&&) and move

- etl::exchange was using the copy constructor. Changed for etl::move.
- The assignment to the new object is now done with forward.
- Added a test with unique_ptr.

---------

Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-07-11 12:05:39 +01:00
Moritz Pflanzer
2ed9019df0
Update operator[] docs for map class (#1499)
* Separate bit order and endianness in bit_stream.h (#1495)

* Update operator[] docs for map class

No const variant is implemented for the operator[].

---------

Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>
2026-07-10 10:42:32 +01:00
Roland Reichwein
423e18d96d Factor out ranges tests from test_algorithm.cpp to test_algorithm_ranges.cpp (#1497) 2026-07-10 10:15:29 +01:00
Roland Reichwein
c707428cc4
Factor out ranges tests from test_algorithm.cpp to test_algorithm_ranges.cpp (#1497) 2026-07-10 10:14:08 +01:00
John Wellbelove
338bfdbb1f
Add coverage report to docs (#1498)
* Updated release notes

* Added link to coverage report

---------

Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
2026-07-10 10:12:04 +01:00
John Wellbelove
269025424f Merge branch 'development' of https://github.com/ETLCPP/etl into development 2026-07-09 14:18:32 +01:00
John Wellbelove
c004cc9d50 Updated release notes 2026-07-09 14:18:27 +01:00
John Wellbelove
faa4c15b49 Updated release notes 2026-07-09 10:06:17 +01:00
Roland Reichwein
1523e63e35
Support non-assignable alternatives in variant (#1496) 2026-07-08 19:48:33 +01:00
John Wellbelove
878a0ba5a2 Updated version and release notes 2026-07-08 11:08:02 +01:00
Roland Reichwein
da0c764a30
Separate bit order and endianness in bit_stream.h (#1495) 2026-07-08 09:22:25 +01:00
John Wellbelove
5287fe4b3b
Allow etl::vector to store pointers to functions and member functions (#1492)
* Refactored vector.h

Deleted ivectorpointer.h

* Minor changes

* Fixed code incompatible with C++03

* Clang-format changes

* Removed redundant double-qualified name

* Fixed is_is_object_pointer_v to is_object_pointer_v

* Added new test files to meson.build

* Added overflow checks to vector_ext copy and move constructors and assignments

Added assert throw tests.

* Added diagnostic pushes to eliminate GCC warning false positives

* Changed the GCC C++23 Github action to use GCC14

* Applied clang-format

* Added guard to pop_heap

* Added guard to adjust_heap

* Attempt to fix GCC diagnostic

* Attempt to fix GCC diagnostic

Re-enable ranges algorithm tests

* Attempt to fix GCC diagnostic

Re-enable ranges algorithm tests

* clang-format

* Attempt to fix GCC diagnostic

Re-enable ranges algorithm tests

* Attempt to fix GCC diagnostic

Re-enable ranges algorithm tests

* Attempt to fix GCC diagnostic

Re-enable ranges algorithm tests

* Missing newline at end of file

* Attempt to fix GCC diagnostic

Re-enable ranges algorithm tests

* Attempt to fix GCC diagnostic

Re-enable ranges algorithm tests

* Attempt to fix GCC diagnostic

Re-enable ranges algorithm tests

* Attempt to fix GCC diagnostic

Re-enable ranges algorithm tests

* Attempt to fix GCC diagnostic

* clang-format

* Changed gcc --version to gcc-14 --version

---------

Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>
2026-07-08 09:06:50 +01:00
Roland Reichwein
40dddd7f96
Add optional etl_profile label_flag for Bazel profile injection (#1491)
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-07-07 23:41:17 +02:00
Roland Reichwein
84fca4cd62
Add missing memory functions, according the standard (#1490)
Adding:

- etl::align
- etl::assume_aligned
- etl::is_sufficiently_aligned
- etl::launder
- etl::pointer_traits
- etl::start_lifetime_as

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-07-07 20:45:47 +01:00
Roland Reichwein
dca6653b37
Add missing interfaces to etl::chrono (#1489)
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-07-07 20:00:09 +01:00
Roland Reichwein
c52b2ac7b1
Fix etl::mem_cast cross-size copy constructor and assignment (#1488)
The templated cross-size copy constructor and assignment operator were
broken in two ways:

- They accessed other.buffer / rhs.buffer, which is private in a
  different mem_cast instantiation, so the cross-size overloads failed
  to compile whenever they were actually instantiated.
- They copied Size_ (the destination size) bytes from a source buffer
  that is only Other_Size bytes large, reading past the end of the
  source when the destination was larger.

Use the public data() accessor and copy Other_Size bytes. The existing
static_assert(Size >= Other_Size) guarantees the destination is big
enough.

Add test_mem_cast_copy_and_assign_from_smaller regression test.

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-07-07 18:06:05 +02:00
Roland Reichwein
165674cb23
Fix etl::pearson::reset() not resetting the first-byte flag (#1487)
reset() cleared the hash array but left the `first` flag false, so a
calculator reused after reset() took the XOR update path on its next
add() instead of the initialisation path. This produced an incorrect
hash for any pearson object that was reset and reused.

Reset `first` to true in reset() so a reset calculator behaves like a
freshly constructed one.

Add test_pearson_reset regression test.

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-07-07 16:41:50 +02:00
Roland Reichwein
032ec4cc80
Fix etl::bitset single-element from_string shift on empty string (#1486)
The single-element from_string overloads (char, wchar_t, char16_t,
char32_t) computed element_type(1) << (string_length - 1U) before the
copy loop. For an empty string, or when active_bits is 0, string_length
is 0, so the shift count underflows to SIZE_MAX. Shifting by more than
the element width is undefined behaviour, which also breaks constexpr
evaluation.

Guard the mask with a zero-length check so the shift is only performed
when string_length > 0. The multi-element from_string overloads were
already safe.

Add test_construct_from_empty_string regression test.

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-07-07 12:40:04 +01:00
Roland Reichwein
98cb365d4c
Fix etl::histogram copy/move not preserving start_index (#1485)
The run-time-offset specialization of etl::histogram stores a start_index
member used to map keys to bins (accumulator[key - start_index]). Its copy
constructor, move constructor, copy assignment, and move assignment copied
only the accumulator and left start_index uninitialized, so a copied or
moved histogram indexed the wrong bin in operator[]/add(), causing
out-of-bounds access (undefined behavior).

All four special member functions now also copy start_index. The
compile-time-offset specialization is unaffected, as its start index is a
template constant rather than a data member.

Add regression tests covering copy/move construction and assignment.

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-07-07 11:32:56 +01:00
Drew Rife
5cd2f28cd5
Refactor variant::emplace to perfect forward args instead of copy/move construct (#1494)
* refactor: emplace logic to use do_emplace for in-place construction with forwarded arguments #1493

* Add test for variant_variadic

---------

Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>
2026-07-07 09:14:48 +02:00
Roland Reichwein
a47c0aae81
Fix etl::message_timer firing following timers early on unregister (#1484)
active_list.remove(id, has_expired) adjusts the next timer's delta only
when has_expired is false. When unregistering an active, non-expired timer,
unregister_timer() incorrectly passed true, skipping that adjustment, so
every timer after the removed one in the active list fired early by the
removed timer's delta.

Pass false instead, matching the etl::callback_timer family. tick() still
passes true, since the timer has genuinely expired there. The bug affected
all four variants: message_timer, message_timer_interrupt,
message_timer_atomic and message_timer_locked. Existing tests missed it
because they only ever unregistered the tail timer, where the delta
adjustment is a no-op.

Add a regression test that unregisters a non-tail active timer and checks
the following timer still fires at its original absolute time.
2026-07-06 17:32:26 +02:00
John Wellbelove
ceb21914fb Updated release notes 20.48.0 2026-06-30 13:55:56 +01:00
John Wellbelove
5d4d6c7903 Merge branch 'master' of https://github.com/ETLCPP/etl 2026-06-30 13:50:49 +01:00
John Wellbelove
da87d97e3a Update README.md 2026-06-30 12:27:05 +01:00
John Wellbelove
f3028d22e4 Development release of 20.48.0 2026-06-30 11:33:30 +01:00
Sergei
96a111ecd9
Drop problematic T& emplace(const optional_impl& other) (#1478)
* Drop problematic `T& emplace(const optional_impl& other)`
- Ror both fundamental and non-fundamental specializations.
- This also fixes incorrect `return storage.u.value;` in the fundamental specializations.
- Simplify `emplace` overloads (drop SFINAE).
- Update test cases to:
  - verify returned reference
  - verify `nothrow`
- Add `emplace(std::initializer_list, ...)` overload for non-fundamental types.

* Fix clang-format

* Revert to idiomatic C++ `initializer_list` by-value.
2026-06-29 19:43:45 +01:00
Roland Reichwein
0663fc7078
Fix etl::unique_ptr::swap() for deleters (#1482)
* Fix etl::unique_ptr::swap() for deleters

Fixes https://github.com/ETLCPP/etl/issues/1481

* Fix etl::deque iterator swap()

Swap all members, not just the index.
2026-06-27 16:00:04 +01:00
John Wellbelove
5eed38e25a
Update README.md 2026-06-24 17:57:50 +01:00
Drew Rife
e6a7642121
Add constexpr support for delegate construction and assignment (#1476)
* feat: Add constexpr support for delegate construction and assignment in C++14 and C++20

* docs: add more docstring coverage #1473

* docs: note constexpr availability for function-pointer overloads

Update docs/callbacks/delegate.md to reflect the new ETL_CONSTEXPR14
annotations on delegate(function_ptr) and create(function_ptr), and add
a paragraph to the Constexpr section explaining which function-pointer
APIs are usable in constant expressions at C++14 vs C++20.

#1473

---------

Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>
2026-06-24 16:51:02 +01:00
Roland Reichwein
05010aebf8
Fix ranges (#1475)
* Fix etl::get to preserve reference members for tuple rvalues

The rvalue-qualified overloads of etl::get (both the index-based and
type-based forms) unconditionally applied etl::move to the stored
element. For a tuple holding a reference member (e.g. etl::tuple<int&>),
this cast the referenced object to an rvalue instead of returning the
stored lvalue reference, diverging from std::get and failing to compile
when the result was bound to a non-const lvalue reference.

Forward the element with static_cast<element_type&&> instead, so that
reference members collapse to an lvalue reference while value members are
still moved. This is required to support tuples of references such as
those produced by the zip, enumerate and adjacent views.

* Make ranges views return non-const references to make them mutable

* Support type-changing transform_view

* Fix join_with_iterator reference type to match operator*

join_with_iterator declared reference = inner_trait::reference (e.g. int&)
while operator* returns value_type by value. For prvalue-yielding inner
ranges (e.g. repeat_view from a type-changing transform) the declared
reference was inconsistent with the actual dereference. Derive value_type
from the inner iterator's dereference and set reference = value_type,
preserving by-value semantics.

Add regression test for transform|join_with with prvalue inner ranges.

* Make join_with conform to [range.join.with.iterator] using inner/pattern common reference

* Clang-format

* Fix owning_view const begin()/end() by making _r mutable so chunk_view compiles over rvalue ranges
2026-06-24 13:39:06 +01:00