Compare commits

...

1532 Commits

Author SHA1 Message Date
Roland Reichwein
3e4d41ca57
Fix operator| conflict with std::ranges (#1395) 2026-04-14 11:56:05 +02:00
John Wellbelove
912e22f238 Merge branch 'development' 2026-04-05 14:32:40 +01:00
John Wellbelove
1a6762d6c3 Updated version and release notes 2026-04-05 14:13:22 +01:00
John Wellbelove
ee04aa76c5 VS2022 project update 2026-04-05 14:03:32 +01:00
Roland Reichwein
3cd03fcb7f
Fix initializer_list use in algorithm.h and definition of data() in iterator.h (#1374)
* Print test names at test time (#1343)

* Fix initializer_list use in algorithm.h

Needs to be conditional.

* Move definition of data() in iterator.h

Needs to be defined earlier.

---------

Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
2026-04-05 13:37:15 +01:00
John Wellbelove
654e222bd9 Merge branch 'development' 2026-04-04 10:50:06 +01:00
John Wellbelove
a1ad13364e Updated release notes 2026-04-04 10:49:00 +01:00
John Wellbelove
22ee76914d Merge branch 'development'
# Conflicts:
#	test/main.cpp
2026-04-04 10:02:24 +01:00
John Wellbelove
e2bed92814 Updated version and release notes 2026-04-04 09:40:46 +01:00
John Wellbelove
576b03f38d Merged from local copy of PR1295 2026-04-04 00:14:49 +01:00
John Wellbelove
f7e1384a70 Merge development 2026-04-03 20:09:06 +01:00
John Wellbelove
e61589ebf2 Merge branch 'development' into delegate-from-non-capturing-lambda
# Conflicts:
#	include/etl/private/delegate_cpp11.h
#	test/test_delegate.cpp
2026-04-03 20:08:41 +01:00
Maksim Danilov
823f2493b4
Rename 'leaf' to 'child' in intrusive_links.h (#1373)
* Print test names at test time (#1343)

* Rename 'leaf' to 'child' in intrusive_links.h

Recent versions of the Tasking TriCore compiler treat
'leaf' as a reserved C++ keyword, causing compilation failures in ETL.

---------

Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>
Co-authored-by: Maksim Danilov <maksim.danilov@accenture.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-04-03 17:35:41 +01:00
John Wellbelove
982adecca4 Added manually triggered clang-format action
# Conflicts:
#	.github/workflows/clang-format_update.yaml
2026-04-03 16:55:18 +01:00
John Wellbelove
2059c5b657 Added manually triggered clang-format action
# Conflicts:
#	.github/workflows/clang-format_update.yaml
2026-04-03 16:46:42 +01:00
John Wellbelove
bd6e55b12e Added manually triggered clang-format action
# Conflicts:
#	.github/workflows/clang-format_update.yaml
2026-04-03 16:45:25 +01:00
John Wellbelove
5a7674b637 Added manually triggered clang-format action
# Conflicts:
#	.github/workflows/clang-format_update.yaml
2026-04-03 16:42:29 +01:00
John Wellbelove
2e74b07dff Added manually triggered clang-format action 2026-04-03 16:35:57 +01:00
John Wellbelove
f5128a39fe Attempt to fix syntax that comfuse clang-format 2026-04-03 13:58:19 +01:00
John Wellbelove
01066b86ae Attempt to fix syntax that comfuse clang-format 2026-04-03 12:31:51 +01:00
John Wellbelove
aeb8e4f734 Formatted source files 2026-04-02 14:11:45 +01:00
John Wellbelove
c7571660bd Adjusted ColumnLimit to 150 2026-04-02 14:07:10 +01:00
John Wellbelove
6a1585b317 Improved include regex 2026-04-02 13:13:33 +01:00
John Wellbelove
9fba468dc2 Removed ETL_DEPRECATED_REASON=[[deprecated(%0)]] from configuration 2026-04-02 11:33:44 +01:00
John Wellbelove
bd1def8b41 Used the correct macro for 'if constexpr' 2026-04-02 10:35:49 +01:00
John Wellbelove
27d284713a Updated .clang-format to include more ETL macros 2026-04-02 10:15:35 +01:00
John Wellbelove
1405bf65de Updated .treefmt to exclude more files and directories 2026-04-02 08:27:46 +01:00
Roland Reichwein
09dd40d4dd Fix .clang-format to recognize ETL macros as attributes 2026-04-02 08:20:43 +01:00
Roland Reichwein
c536a39f0a Treefmt config 2026-04-02 08:19:45 +01:00
John Wellbelove
9b394b8677 Added certain Hugo files and diectories to the Git ignore file 2026-04-01 17:34:15 +01:00
John Wellbelove
9d2c73793d Ran clang-format on generated files, using the .clang-format from PR #1314 2026-04-01 13:33:18 +01:00
Benedek Kupper
1ce3deb0f7 test: delegate: add unary + to convert lambda to function pointer 2026-03-31 21:56:42 +02:00
John Wellbelove
ea397ec2dd Changed non-capturing lambda API to runtime function pointer API 2026-03-31 21:27:44 +02:00
John Wellbelove
a483eb90c4 Fixed generator_test.py
Updated generator files in the VS2022 project
Adde licence headers to the generator headers
2026-03-31 19:11:02 +01:00
Diogo Cavaleiro
c970fa9bad Add clang-format v18 workflow and configuration 2026-03-31 16:59:09 +01:00
Roland Reichwein
d17c0297ec
Factor out generated code (#1369)
Previously, generator code under include/etl/generators needed to be
synchronized with the generated files under include/etl explicitly.
Leading to errors in the CI checks if forgotten.

This change separates out the generated parts to cpp03 specific
snippets. This way, most code under include/etl is now directly editable,
with only some pre-C++11 code separated out to
include/etl/generators/*_cpp03_generator.h which still needs to be
re-generated on respective changes. But in many cases, this is not necessary.

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-03-31 16:36:54 +01:00
William Sciaroni
3c2a4d48a9
Update Dockerfile and Devcontainer. (#1360)
* Print test names at test time (#1343)

* Remove python3-cogapp from Dockerfile

Removed python3-cogapp from the Dockerfile installation.

* Update .devcontainer/Dockerfile

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Change base image and update Python package installation

* Change container to use cpp devcontainer version 2

* Point to specific version of the devcontainer

* Update devcontainer to use debian snapshot for reproducability

* Fetch sources via https

* Make devcontainer more robust for debian_snapshot

* Make fetch non-https for snapshot

* Install CMake from apt

* Update devcontainers to remove CMake version

* Change Clang version from 22 to 21

* Apply suggestion from @rolandreichweinbmw

---------

Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-03-31 12:20:31 +01:00
John Wellbelove
3d564d68b9 Fixed sign conversion in advance_helper 2026-03-30 19:34:15 +01:00
John Wellbelove
e4dfb6c045 Fixed iterator.h #if #else #endif
Fixed type_lookup_generator to match genereted
2026-03-30 19:06:07 +01:00
John Wellbelove
95c9cabc10 Fix for PR 1367 2026-03-28 20:37:03 +00:00
John Wellbelove
3638d89f8b Fix for PR 1367 2026-03-28 13:50:27 +00:00
John Wellbelove
03ca3c817e Fix for PR 1367 2026-03-28 12:03:12 +00:00
Roland Reichwein
b83cef5668
Fix compilation with -Wsign-conversion (#1367)
* Fix compilation with -Wsign-conversion

For tests with GCC and Clang

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

* Fix support of negative Id in type_lookup.h: type_from_id

* Fix element access arithmetic in atomic_gcc_sync.h fetch_add/fetch_sub

* Fix rounded_integral_division.h: divide_round_half_odd(): direction is always 1
2026-03-28 11:15:56 +00:00
Bram Meijer
2c2ce9a39f
Add a inplace_function constructor from a nullptr (#1336)
* Add a inplace_function constructor with a nullptr argument

* Add unit test for nullptr construction

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-03-28 09:16:00 +00:00
Daniel Santos
f718c54396
Add bounds and empty checks to container classes (#1334)
* add bounds and empty checks to containers

* address code rabbit review

* correct C++11 constexpr error

* rename new constexpr macro and make it global

* rename queue specializations' exceptions

* change front() implementation in locked queue specializations

* refactor usage of CONSTEXPR and NO_EXCEPT

* expand intrusive queue tests

* introduce lock guards on locked queues

* Print test names at test time (#1343)

* revert mutex and return changes on locking queues

* finish reverting the locked queues

---------

Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-03-27 10:17:56 +00:00
Roland Reichwein
12cdbc0da0
Bug fixes in variant_variadic.h (#1358)
* Print test names at test time (#1343)

* Bug fixes in variant_variadic.h

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-03-27 09:19:50 +00:00
Bram Meijer
ab03ea114f
Fix compilation issue when including etl/chrono next to etl/to_string. (#1365)
* Print test names at test time (#1343)

* Fix namespace issue of floor/round in to_string_helper

---------

Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-03-27 08:11:45 +00:00
Roland Reichwein
2f242e37f2
Restrict etl::atomic for general types (#1359)
* Print test names at test time (#1343)

* Restrict etl::atomic for general types

Needs adding is_copy_assignable and is_move_assignable, and
adjustments to is_trivially_copyable and is_assignable

* Resolve mutable T value vs. volatile qualified methods

* Remove volatile method overloads

They are deprecated in C++20 because they don't work as users expect anyway.

MSVC hinted for this.

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-03-26 09:46:20 +00:00
Roland Reichwein
31b87b5419
Add C++ ranges library for C++17 (#1316)
* Add ranges

* Print test names at test time (#1343)

* Fix conflit commit errors

* Cast return value of operator* to value_type

Fixed warning on VS2022

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-03-26 08:56:17 +00:00
Roland Reichwein
add42b6c87
Mark uninitialized use from std library (#1349)
* Print test names at test time (#1343)

* Mark uninitialized use from std library

Similar to other cases, adds compiler pragmas against warnings
caused by std library in optimized builds of tests

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-03-26 08:29:05 +00:00
Timon Zijnge
2f6a3e04aa
Manchester big endian support (#1353)
* manchester
* Added manchester code and test

* manchester
* Formatting and added missing file

* manchester
* Some functions can only be constexpr since C++14

* manchester
* Manchester decode and some refactoring

* manchester
* Added some missing typenames

* manchester
* constexpr void function not allowed in C++11

* manchester
* condition on static_assert tests

* manchester
* revert CMakeLists.txt
* Using ETL_STATIC_ASSERT
* Some cleanup

* manchester
* Added static_assert message

* manchester
* Added compile time tests

* manchester
* Added invert manchester
* Some refactoring

* manchester
* Disable test for now
* Move ETL_NODISCARD before static

* manchester
* Test for valid_span

* manchester
* Remove redundant (?) storage specifiers for template specializations. Storage specifier already given in base template

* manchester
* refactoring to get rid of specialized template functions in template class

* manchester
* cleanup

* manchester
* Added documentation comments
* Some refactoring

* manchester
* introducing namespace detail_manchester

* manchester
* Some refactoring
* Update tests

* manchester
* Some refactoring
* Removed possible undefined behavior by refactoring encode_span
* constexpr version of encode_span
* Static assertion for rare case where code doesn't work because CHAR_BIT is not the same as the number of bits in uint_least8_t

* manchester
* renamed valid to is_valid

* manchester
* renamed is_valid_span to is_valid
* Using etl exceptions in ETL_ASSERT

* manchester
* Removed _fast functions
* merged encode_in_place with encode and decode_in_place with decode
* removed _span to create normal overloads of encode and decode for span
* Some renaming and minor refactoring

* manchester
* Fix build issues

* manchester
* Conditionally compile manchester_decoded

* Update test_manchester.cpp

Removed redundant semicolon

* #1258 Manchester coding
* Formatting
* consistency: hex literals with lower case 0x

* #1258 Manchester coding
* Moved copyright to top of file
* Make constexpr encode/decode span functions equal for little and big endian platforms

* #1258 Manchester coding
* Added missing include
* Added missing 8bit/64bit guards
* Fixed is_valid for big endian platforms

* #1258 Manchester coding
* private memcpy alias

* #1258 Manchester coding
* Review comments

* #1258 Manchester coding
* Cleanup
* Fix build error

* #1258 Manchester coding
* Add manchester documentation

* #1258 Manchester coding
* Preparation for GitHub pages

* #1324 Manchester documentation
* Some small fixes

* Print test names at test time (#1343)

* IGN-280 biphasic amplitude as float
* Add big-endian devcontainer

* manchester
* fixed the configuration to work with GitHub Codespaces. The changes use cross-compilation with QEMU emulation instead of trying to use a native s390x container.

* manchester
* Made manchester work for big-endian
* Some updates to the container

* Manchester big-endian support
* Cleanup

* Manchester big-endian support
* add sourcedirectory

* Enable running with ctest

* Manchester big-endian support
* Update documentation

* Manchester big-endian support
* QA

* Manchester big-endian support
* QA

* Enable testing with ctest with cross-compiler (#5)

* Enable testing with ctest and with cross-compiler
* Clean up includes in manchester.h

---------

Co-authored-by: Timon Zijnge <timon.zijnge@imec.nl>

---------

Co-authored-by: Timon Zijnge <timon.zijnge@imec.nl>
Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>
2026-03-26 07:56:50 +00:00
Roland Reichwein
d5fc8d0cd1
Add code coverage report (#1357)
* Print test names at test time (#1343)

* Add code coverage report
2026-03-25 20:48:41 +00:00
Roland Reichwein
7fdea7f7ae
Adjustments in tuple.h from review (#1350)
* Print test names at test time (#1343)

* Adjustments in tuple.h from review

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-03-25 19:28:12 +00:00
Roland Reichwein
e7107b24f1
Fix tests on big endian (#1356)
* Print test names at test time (#1343)

* Fix tests on big endian

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-03-25 12:47:03 +00:00
Roland Reichwein
66e3d83a81
Fix ETL_HAS_CONSTEXPR_ENDIANESS in unaligned_type.h (#1361)
* Print test names at test time (#1343)

* Fix ETL_HAS_CONSTEXPR_ENDIANESS in unaligned_type.h

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-03-25 12:16:36 +00:00
Roland Reichwein
bd15e42440
Fix etl::optional for deleted copy constructors (#1362)
* Print test names at test time (#1343)

* Fix etl::optional for deleted copy constructors

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-03-25 08:14:33 +00:00
Roland Reichwein
0b5621e809
Fix span size type (#1363)
* Print test names at test time (#1343)

* Fix span size type

size() returned a signed value while declared (unsigned) size_t.

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-03-25 07:54:18 +00:00
Roland Reichwein
fa3ac74558
Limit clock duration to milliseconds type on narrow int type (#1364)
* Print test names at test time (#1343)

* Limit clock duration to milliseconds type on narrow int type

On AVR, for 16 bit int types, nano and micro are not provided.
Now, consistently use them only conditionally.

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-03-23 19:51:30 +00:00
William Sciaroni
325908b1b9
Add permutation functions (#1348)
* Print test names at test time (#1343)

* Add permutation functions

* Refactor permutation to use etl::less

* Add test for next_permutation where begin == end

* Update code to avoid multiple bind1st objects in loop

* Remove duplicate is_partitioned test case

Removed the duplicate is_partitioned test case from the test suite.

---------

Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-03-23 19:30:03 +00:00
Henri Bragge
29ad4b327e
Fix comment in queue::pop (#1347)
* Print test names at test time (#1343)

* Fix comment in queue::pop

---------

Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-03-17 11:05:28 +00:00
John Wellbelove
3639850b6b Fixed type_traits.h generator 2026-03-13 07:37:02 +00:00
Roland Reichwein
89284de733
Add treefmt support (#1323)
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-03-13 00:11:51 +00:00
Ralph Rooding
ad6e027b08
Add PURL to Zephyr module.yml for SBoM generation (#1344)
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-03-12 20:39:53 +00:00
Roland Reichwein
78d8b82afb Print test names at test time (#1343) 2026-03-12 20:08:22 +00:00
Roland Reichwein
a0c98662ca
Print test names at test time (#1343) 2026-03-12 19:55:16 +00:00
Christoph Rüthing
237d83c107
Add pre C++20 Support for ETL_CONSTINIT using Compiler Extensions (#1335)
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-03-12 19:47:39 +00:00
John Wellbelove
8a61985ac8
span is constructible from temporary (#1338)
* Added missing files from VS2022 project

* Added global data() overloads to complement etl::size()

* Added C++03 compatible implementation of etl::is_convertible

* Updated etl::span to more closely align with std::span

* Fix etl::rotate (#1327)

Per the C++ standard, std::rotate returns first + (last - middle):

* When first == middle, return last
* When middle == last, return first

* Fix greater_equal and less_equal (#1331)

* Align comparison operators (#1330)

In functional.h, the comparison operators for equal_to and not_equal_to
mismatch between the actual comparison execution and the type inference
for the return type. This change adjusts it by using the same operator==()
in the return type inference as used in the comparison execution.

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

* Add missing tests (#1321)

* Add missing tests

* Typo fixes

---------

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

* Add ETL_FORMAT_NO_FLOATING_POINT control macro for etl::format (#1329)

When ETL_FORMAT_NO_FLOATING_POINT is defined, all floating-point formatting support (float, double, long double) is excluded from etl::format. This reduces code size on targets that do not require floating-point formatting.

Guarded sections:

- #include <cmath>

- float/double/long double in supported_format_types variant

- float/double/long double constructors in basic_format_arg

- format_floating_* functions and format_aligned_floating

- formatter<float>, formatter<double>, formatter<long double>

- Floating-point test cases in test_format.cpp

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
# Conflicts:
#	include/etl/platform.h

* Manchester documentation (#1325)

* manchester
* Added manchester code and test

* manchester
* Formatting and added missing file

* manchester
* Some functions can only be constexpr since C++14

* manchester
* Manchester decode and some refactoring

* manchester
* Added some missing typenames

* manchester
* constexpr void function not allowed in C++11

* manchester
* condition on static_assert tests

* manchester
* revert CMakeLists.txt
* Using ETL_STATIC_ASSERT
* Some cleanup

* manchester
* Added static_assert message

* manchester
* Added compile time tests

* manchester
* Added invert manchester
* Some refactoring

* manchester
* Disable test for now
* Move ETL_NODISCARD before static

* manchester
* Test for valid_span

* manchester
* Remove redundant (?) storage specifiers for template specializations. Storage specifier already given in base template

* manchester
* refactoring to get rid of specialized template functions in template class

* manchester
* cleanup

* manchester
* Added documentation comments
* Some refactoring

* manchester
* introducing namespace detail_manchester

* manchester
* Some refactoring
* Update tests

* manchester
* Some refactoring
* Removed possible undefined behavior by refactoring encode_span
* constexpr version of encode_span
* Static assertion for rare case where code doesn't work because CHAR_BIT is not the same as the number of bits in uint_least8_t

* manchester
* renamed valid to is_valid

* manchester
* renamed is_valid_span to is_valid
* Using etl exceptions in ETL_ASSERT

* manchester
* Removed _fast functions
* merged encode_in_place with encode and decode_in_place with decode
* removed _span to create normal overloads of encode and decode for span
* Some renaming and minor refactoring

* manchester
* Fix build issues

* manchester
* Conditionally compile manchester_decoded

* Update test_manchester.cpp

Removed redundant semicolon

* #1258 Manchester coding
* Formatting
* consistency: hex literals with lower case 0x

* #1258 Manchester coding
* Moved copyright to top of file
* Make constexpr encode/decode span functions equal for little and big endian platforms

* #1258 Manchester coding
* Added missing include
* Added missing 8bit/64bit guards
* Fixed is_valid for big endian platforms

* #1258 Manchester coding
* private memcpy alias

* #1258 Manchester coding
* Review comments

* #1258 Manchester coding
* Cleanup
* Fix build error

* #1258 Manchester coding
* Add manchester documentation

* #1258 Manchester coding
* Preparation for GitHub pages

* #1324 Manchester documentation
* Some small fixes

---------

Co-authored-by: Timon Zijnge <timon.zijnge@imec.nl>

* Moved and split has_size_and_data in span.h to has_size & has_data in type_traits.h

* Removed has_size_and_data traits, and move to type_traits.h

Added ETL_ASSERT for for fixed extent constructors from iterator range and begin/size

* Added macro ETL_NOEXCEPT_IF that takes a compile time boolean expression

* Changed two fixed span constructors to ETL_CONSTEXPR14 due to ETL_ASSERT in the constructor bodies

Added ETL_NOEXCEPT_IF for simpler boolean conditions
Added tests for construction from mismatched sizes

* Added definition for ETL_NOEXCEPT_IF in no C++11 path

* Changes  to disable construction from rvalue temporaries

---------

Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>
Co-authored-by: Niu Zhihong <zhihong@nzhnb.com>
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Co-authored-by: Timon Zijnge <47081647+tzijnge@users.noreply.github.com>
Co-authored-by: Timon Zijnge <timon.zijnge@imec.nl>
2026-03-12 17:08:02 +00:00
John Wellbelove
d3affac417
Enforce o(log n) dispatch for messages when using fsm for c++11 and up (#1337)
* Updated message handling to be worst case O(logN)

* Copied optimised message handling from etl::fsm

* Updated fsm generator

* Updated message_router generator

* Added optimised accepts() member function

* Modified comment, as the FSM doesn't support a successor

* Updated version and release notes

* Hotfix/etl  multiset iterator invalidation during erase leads to incorrect sorted order in depth first traversal (#1317)

* Fixed issue for both multiset and multimap

* Added std::is_sorted checks to all map/set tests

* Updated with coderabbit suggestions

---------

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

* Updated release notes and version

* Changed std::is_same to etl::is_same in struct type_list_is_unique (#1320)

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

* Updated release notes and version

* Fix etl::rotate (#1327)

Per the C++ standard, std::rotate returns first + (last - middle):

* When first == middle, return last
* When middle == last, return first

* Added missing files from VS2022 project

* Fix greater_equal and less_equal (#1331)

* Align comparison operators (#1330)

In functional.h, the comparison operators for equal_to and not_equal_to
mismatch between the actual comparison execution and the type inference
for the return type. This change adjusts it by using the same operator==()
in the return type inference as used in the comparison execution.

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

* Add missing tests (#1321)

* Add missing tests

* Typo fixes

---------

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

* Add ETL_FORMAT_NO_FLOATING_POINT control macro for etl::format (#1329)

When ETL_FORMAT_NO_FLOATING_POINT is defined, all floating-point formatting support (float, double, long double) is excluded from etl::format. This reduces code size on targets that do not require floating-point formatting.

Guarded sections:

- #include <cmath>

- float/double/long double in supported_format_types variant

- float/double/long double constructors in basic_format_arg

- format_floating_* functions and format_aligned_floating

- formatter<float>, formatter<double>, formatter<long double>

- Floating-point test cases in test_format.cpp

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>

* Manchester documentation (#1325)

* manchester
* Added manchester code and test

* manchester
* Formatting and added missing file

* manchester
* Some functions can only be constexpr since C++14

* manchester
* Manchester decode and some refactoring

* manchester
* Added some missing typenames

* manchester
* constexpr void function not allowed in C++11

* manchester
* condition on static_assert tests

* manchester
* revert CMakeLists.txt
* Using ETL_STATIC_ASSERT
* Some cleanup

* manchester
* Added static_assert message

* manchester
* Added compile time tests

* manchester
* Added invert manchester
* Some refactoring

* manchester
* Disable test for now
* Move ETL_NODISCARD before static

* manchester
* Test for valid_span

* manchester
* Remove redundant (?) storage specifiers for template specializations. Storage specifier already given in base template

* manchester
* refactoring to get rid of specialized template functions in template class

* manchester
* cleanup

* manchester
* Added documentation comments
* Some refactoring

* manchester
* introducing namespace detail_manchester

* manchester
* Some refactoring
* Update tests

* manchester
* Some refactoring
* Removed possible undefined behavior by refactoring encode_span
* constexpr version of encode_span
* Static assertion for rare case where code doesn't work because CHAR_BIT is not the same as the number of bits in uint_least8_t

* manchester
* renamed valid to is_valid

* manchester
* renamed is_valid_span to is_valid
* Using etl exceptions in ETL_ASSERT

* manchester
* Removed _fast functions
* merged encode_in_place with encode and decode_in_place with decode
* removed _span to create normal overloads of encode and decode for span
* Some renaming and minor refactoring

* manchester
* Fix build issues

* manchester
* Conditionally compile manchester_decoded

* Update test_manchester.cpp

Removed redundant semicolon

* #1258 Manchester coding
* Formatting
* consistency: hex literals with lower case 0x

* #1258 Manchester coding
* Moved copyright to top of file
* Make constexpr encode/decode span functions equal for little and big endian platforms

* #1258 Manchester coding
* Added missing include
* Added missing 8bit/64bit guards
* Fixed is_valid for big endian platforms

* #1258 Manchester coding
* private memcpy alias

* #1258 Manchester coding
* Review comments

* #1258 Manchester coding
* Cleanup
* Fix build error

* #1258 Manchester coding
* Add manchester documentation

* #1258 Manchester coding
* Preparation for GitHub pages

* #1324 Manchester documentation
* Some small fixes

---------

Co-authored-by: Timon Zijnge <timon.zijnge@imec.nl>

* Changes from review of algorithm.h on development branch (#1340)

* Add missing constexpr in algorithm.h

* Fix call of nth_element

2nd argument (nth) was missing

* Replace partition point with O(log(N)) algorithm

The C++ standard defines O(log(N)) calls of predicate as the
complexity of partition_point(). The old algorithm was linear.

* Use predicate in calculation of is_permutation consistently

In case of predicate not equal_to, the calculation previously
returned wron results

* Omit swap in selection_sort if iterators are equal

* Use difference_type in rotate_general() instead of int

* Typo fix in algorithm.h

* Simplifications in algorithm.h

Application of plain refactoring by keeping semantics

* Guard against past-end iterator in etl::rotate()

And fix scope of rotate_right_by_one for etl::rotate()

* Support empty ranges in selection_sort

* Add tests for swap_ranges

* Add tests for binary_search

* Add tests for find_end

* Add tests for accumulate

* Add tests for move_s

* Added tests for is_heap and sort_heap

* Remove early exit for empty input

* Add adjacent_find

* Add unique

* Add unique_copy

* Add merge

* Add inplace_merge

* Add partial_sort

* Add partial_sort_copy

* copilot review change

---------

Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>
Co-authored-by: Niu Zhihong <zhihong@nzhnb.com>
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Co-authored-by: Timon Zijnge <47081647+tzijnge@users.noreply.github.com>
Co-authored-by: Timon Zijnge <timon.zijnge@imec.nl>
2026-03-12 17:06:26 +00:00
Roland Reichwein
0a56d40bdd
Fix undefined behaviour of etl::absolute() for etl::numeric_limits<T>::min (#1333)
absolute_unsigned() already handled that case correctly. Now adding this
check to absolute() also. It can be caught at compile time now, if in a
constexpr context. Also separating integral and non-integral versions
via enable_if.

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-03-12 16:38:10 +00:00
Roland Reichwein
54a1c82c98
Fix run-syntax-checks.sh to be executable (#1342)
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-03-12 15:54:51 +00:00
Roland Reichwein
4a8c167a31
Changes from review of algorithm.h on development branch (#1340)
* Add missing constexpr in algorithm.h

* Fix call of nth_element

2nd argument (nth) was missing

* Replace partition point with O(log(N)) algorithm

The C++ standard defines O(log(N)) calls of predicate as the
complexity of partition_point(). The old algorithm was linear.

* Use predicate in calculation of is_permutation consistently

In case of predicate not equal_to, the calculation previously
returned wron results

* Omit swap in selection_sort if iterators are equal

* Use difference_type in rotate_general() instead of int

* Typo fix in algorithm.h

* Simplifications in algorithm.h

Application of plain refactoring by keeping semantics

* Guard against past-end iterator in etl::rotate()

And fix scope of rotate_right_by_one for etl::rotate()

* Support empty ranges in selection_sort

* Add tests for swap_ranges

* Add tests for binary_search

* Add tests for find_end

* Add tests for accumulate

* Add tests for move_s

* Added tests for is_heap and sort_heap

* Remove early exit for empty input

* Add adjacent_find

* Add unique

* Add unique_copy

* Add merge

* Add inplace_merge

* Add partial_sort

* Add partial_sort_copy
2026-03-10 20:39:13 +00:00
Timon Zijnge
521df8ee19
Manchester documentation (#1325)
* manchester
* Added manchester code and test

* manchester
* Formatting and added missing file

* manchester
* Some functions can only be constexpr since C++14

* manchester
* Manchester decode and some refactoring

* manchester
* Added some missing typenames

* manchester
* constexpr void function not allowed in C++11

* manchester
* condition on static_assert tests

* manchester
* revert CMakeLists.txt
* Using ETL_STATIC_ASSERT
* Some cleanup

* manchester
* Added static_assert message

* manchester
* Added compile time tests

* manchester
* Added invert manchester
* Some refactoring

* manchester
* Disable test for now
* Move ETL_NODISCARD before static

* manchester
* Test for valid_span

* manchester
* Remove redundant (?) storage specifiers for template specializations. Storage specifier already given in base template

* manchester
* refactoring to get rid of specialized template functions in template class

* manchester
* cleanup

* manchester
* Added documentation comments
* Some refactoring

* manchester
* introducing namespace detail_manchester

* manchester
* Some refactoring
* Update tests

* manchester
* Some refactoring
* Removed possible undefined behavior by refactoring encode_span
* constexpr version of encode_span
* Static assertion for rare case where code doesn't work because CHAR_BIT is not the same as the number of bits in uint_least8_t

* manchester
* renamed valid to is_valid

* manchester
* renamed is_valid_span to is_valid
* Using etl exceptions in ETL_ASSERT

* manchester
* Removed _fast functions
* merged encode_in_place with encode and decode_in_place with decode
* removed _span to create normal overloads of encode and decode for span
* Some renaming and minor refactoring

* manchester
* Fix build issues

* manchester
* Conditionally compile manchester_decoded

* Update test_manchester.cpp

Removed redundant semicolon

* #1258 Manchester coding
* Formatting
* consistency: hex literals with lower case 0x

* #1258 Manchester coding
* Moved copyright to top of file
* Make constexpr encode/decode span functions equal for little and big endian platforms

* #1258 Manchester coding
* Added missing include
* Added missing 8bit/64bit guards
* Fixed is_valid for big endian platforms

* #1258 Manchester coding
* private memcpy alias

* #1258 Manchester coding
* Review comments

* #1258 Manchester coding
* Cleanup
* Fix build error

* #1258 Manchester coding
* Add manchester documentation

* #1258 Manchester coding
* Preparation for GitHub pages

* #1324 Manchester documentation
* Some small fixes

---------

Co-authored-by: Timon Zijnge <timon.zijnge@imec.nl>
2026-03-07 08:13:00 +00:00
Niu Zhihong
8ce59792fd
Add ETL_FORMAT_NO_FLOATING_POINT control macro for etl::format (#1329)
When ETL_FORMAT_NO_FLOATING_POINT is defined, all floating-point formatting support (float, double, long double) is excluded from etl::format. This reduces code size on targets that do not require floating-point formatting.

Guarded sections:

- #include <cmath>

- float/double/long double in supported_format_types variant

- float/double/long double constructors in basic_format_arg

- format_floating_* functions and format_aligned_floating

- formatter<float>, formatter<double>, formatter<long double>

- Floating-point test cases in test_format.cpp

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-03-06 22:04:32 +00:00
Roland Reichwein
67ecc8e11e
Add missing tests (#1321)
* Add missing tests

* Typo fixes

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-03-06 21:34:54 +00:00
Roland Reichwein
7329efc7df
Align comparison operators (#1330)
In functional.h, the comparison operators for equal_to and not_equal_to
mismatch between the actual comparison execution and the type inference
for the return type. This change adjusts it by using the same operator==()
in the return type inference as used in the comparison execution.

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-03-06 20:29:58 +00:00
Roland Reichwein
4ad6126ec5
Fix greater_equal and less_equal (#1331) 2026-03-06 20:08:31 +00:00
John Wellbelove
f96510bd79 Added missing files from VS2022 project 2026-03-06 11:21:38 +00:00
Roland Reichwein
a8ebe338f8
Fix etl::rotate (#1327)
Per the C++ standard, std::rotate returns first + (last - middle):

* When first == middle, return last
* When middle == last, return first
2026-03-06 10:11:46 +00:00
John Wellbelove
7bac1d02f7 Updated release notes and version 2026-03-02 09:16:18 +00:00
John Wellbelove
25c9235cbc
Changed std::is_same to etl::is_same in struct type_list_is_unique (#1320)
Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
2026-03-02 09:13:19 +00:00
John Wellbelove
6ed9ca3f1d Updated release notes and version 2026-03-01 13:12:44 +00:00
John Wellbelove
7ee7f10f58
Hotfix/etl multiset iterator invalidation during erase leads to incorrect sorted order in depth first traversal (#1317)
* Fixed issue for both multiset and multimap

* Added std::is_sorted checks to all map/set tests

* Updated with coderabbit suggestions

---------

Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
2026-03-01 12:27:39 +00:00
John Wellbelove
70e4850a0b Updated version and release notes 2026-02-27 17:43:47 +00:00
John Wellbelove
089f65cce1
Added get_endianness() to etl::byte_stream_reader (#1315)
Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
2026-02-27 11:18:29 +00:00
Timon Zijnge
810a106bdf
#1258 Manchester coding (#1285)
* manchester
* Added manchester code and test

* manchester
* Formatting and added missing file

* manchester
* Some functions can only be constexpr since C++14

* manchester
* Manchester decode and some refactoring

* manchester
* Added some missing typenames

* manchester
* constexpr void function not allowed in C++11

* manchester
* condition on static_assert tests

* manchester
* revert CMakeLists.txt
* Using ETL_STATIC_ASSERT
* Some cleanup

* manchester
* Added static_assert message

* manchester
* Added compile time tests

* manchester
* Added invert manchester
* Some refactoring

* manchester
* Disable test for now
* Move ETL_NODISCARD before static

* manchester
* Test for valid_span

* manchester
* Remove redundant (?) storage specifiers for template specializations. Storage specifier already given in base template

* manchester
* refactoring to get rid of specialized template functions in template class

* manchester
* cleanup

* manchester
* Added documentation comments
* Some refactoring

* manchester
* introducing namespace detail_manchester

* manchester
* Some refactoring
* Update tests

* manchester
* Some refactoring
* Removed possible undefined behavior by refactoring encode_span
* constexpr version of encode_span
* Static assertion for rare case where code doesn't work because CHAR_BIT is not the same as the number of bits in uint_least8_t

* manchester
* renamed valid to is_valid

* manchester
* renamed is_valid_span to is_valid
* Using etl exceptions in ETL_ASSERT

* manchester
* Removed _fast functions
* merged encode_in_place with encode and decode_in_place with decode
* removed _span to create normal overloads of encode and decode for span
* Some renaming and minor refactoring

* manchester
* Fix build issues

* manchester
* Conditionally compile manchester_decoded

* Update test_manchester.cpp

Removed redundant semicolon

* #1258 Manchester coding
* Formatting
* consistency: hex literals with lower case 0x

* #1258 Manchester coding
* Moved copyright to top of file
* Make constexpr encode/decode span functions equal for little and big endian platforms

* #1258 Manchester coding
* Added missing include
* Added missing 8bit/64bit guards
* Fixed is_valid for big endian platforms

* #1258 Manchester coding
* private memcpy alias

* #1258 Manchester coding
* Review comments

* #1258 Manchester coding
* Cleanup
* Fix build error

---------

Co-authored-by: Timon Zijnge <timon.zijnge@imec.nl>
2026-02-27 09:40:42 +00:00
John Wellbelove
7ef01fcaed
Enforce worse-case O(log n) dispatch for messages when using message router for c++11 and up (#1312)
* Added compare_message_id

* Added new C++11 and up message routing code using a sorted type_list

* Renamed compare_message)id to compare_message_id_less

* Added documenation for compare_message_id_less

Added static asserts for message type template parameters

* Added optimisation for contiguous message IDs

Added more Doxygen documentation

* Added etl::type_list_all_of, etl::type_list_any_of, and etl::type_list_none_of

* Added etl::type_list_is_unique

* Added common definitions to all router types

* Added static_asserts to check message types

* Added etl::type_list to etl::nth_type

* Added missing 'typename' to type_list nth_type

* Added type_list_is_empty

* indentation fix

* Renamed type_list_prepend & type_list_append to type_list_push_front & type_list_push_back respectively

* Added tests for make_index_sequence & make_index_sequence_with_offset

* Add more features to etl::type_list (#1307)

* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Added etl::type_list to etl::observer

* Added etl::type_list to etl::nth_type

* Added missing 'typename' to type_list nth_type

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Added type_list definitions for nth_type and observer

* Added etl::type_list to etl::variant

* Updated comments

* Addedetl::type~_list to message_router, observer, visitor

# Conflicts:
#	include/etl/observer.h
#	test/vs2022/etl.vcxproj.filters

* Added member type_list type to tuple

* Work in progress

* Copy changes from other source

* Removed unused tests

* Fix iter_swap namespace

* Add type_list functionality to etl::variant using etl::variant_from_type_list

* Add type_list functionality to etl::message_packet using etl::message_packet_from_type_list

* Add type_list functionality to etl::message_router using etl::message_router_from_type_list

* Add type_list functionality to etl::observer using etl::observer_from_type_list

* Add type_list functionality to etl::tuple using etl::tuple_from_type_list

* Allow etl::make_index_sequence to be created from an etl::type_list

* Add type_list functionality to etl::visitor using etl::visitor_from_type_list

* Fix iter_swap namespace

* Allow creation of a message_packet with no message types

* Allow creation of a message_router with no message types

* Updated VS2022 project files

* Added missing test files CMakeLists.txt

* Fix C++03 compatibility

Fixed unused aregument warnings

* Synced message_packet generator to updated code

* Synced message_router generator to updated code

* Synced message_router generator to updated code

# Conflicts:
#	include/etl/generators/message_router_generator.h
#	include/etl/message_router.h

* Fixed missing zero message specialisation for <= C++14

* Fixed missing zero message specialisation for <= C++14

* Fix year_month arithmetic and correct chrono API behavior (#1257)

* Fix & add more tests for year_month arithmetic

* Minor addtions to previous commit

* More missing values to be uninitialized

* Update the default constructors to = default and correct default constructor tests accordingly

* Fix & add more tests for year_month arithmetic

* Minor addtions to previous commit

* More missing values to be uninitialized

* Update the default constructors to = default and correct default constructor tests accordingly

* Restore default constructor behavior for chrono calender

* Suppress warnings from std in optimized builds (#1259)

When testing with ./run-tests.sh 23 3 10, some warnings from
std surfaced which resulted in build errors.

* Add template deduction guide for span from vector (#1264)

* Create span from vector deduction

* Use ivector for deduction.  Add vector_ext to test

* Add vector pointer to test

* Finish tests

* Initialize pdata_ext and others

* Document how to implement platform specifics (#1262)

Some interfaces need to be implemented in every project
or platform using the ETL:

* etl_get_high_resolution_clock
* etl_get_system_clock
* etl_get_steady_clock
* etl_putchar

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

* Fix etl::as_bytes for etl::span<const T> (#1266)

A missing 'const' in the etl::as_bytes implementation was causing a
compile-time error when etl::as_bytes was called on a span of const
values.

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

* Remove some UB in test_vector_non_trivial.cpp (#1268)

Some of the tests' UB are detectable by Gcc15 and thus give a compile error due to warnings-as-error flag.

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

* Update C++26 deprecated constructs to ensure future standard compliance (#1267)

* Update C++26 deprecated constructs to ensure future standard compliance

I replaced std::is_trivial with a combination of std::is_trivially_default_constructible and std::is_trivially_copyable. Additionally, I added the required comma before the ellipsis in variadic functions to match updated language specifications.

* Some additional is_trivial related changes not found directly when compiling tests in C++26

---------

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

* Fix return value of get_token_list (#1271)

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

* Fix etl::tuple template signature error in pair assignment operator (#1265)

* Fix etl::tuple template signature error in pair assignment operator

* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update etl::tuple to explicitly use etl::pair or std::pair in assignment operator

* Added tests for etl::tuple assignment from pair

---------

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

* Remove advance() on static spans (#1281)

* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Remove advance() on static spans

Since the size of a static span is constant, we can't reasonably
advance() on it.

---------

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

* Add missing includes (#1286)

* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Add missing includes

Before this change, the includes needed to be done explicitly by
files using basic_string_stream.h, and be included first. This
was error prone, especially if includes are reordered (e.g. via
the currently defined clang-format rules).

---------

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

* Move comparison operators of etl::expected to namespace etl (#1287)

* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Move comparison operators of etl::expected to namespace etl

---------

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

* Make typed_storage constructor constexpr (#1291)

* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Make typed_storage constructor constexpr

---------

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

* Add basic_format_arg constructor for ibasic_string (#1288)

* Allow string as format arg

* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Added test string escaped

* Add temporary string test

---------

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

* QR Code for Github

* Added etl::visitor_from_type_list

* accepts(id) for empty router passes on to a sucessor

* Fixed incorrect comment from 'tuple' to 'message_router'

* PR review changes

* PR review changes

* Fixed internal constexptr flag in message_packet

* Fixed unused variable in unti test

* Added new type_list features

Added make_index_sequence_with_offset

* Renamed type_list_select_from_sequence to type_list_select_from_index_sequence

* Replaced type_list_size<TTypeList>::value with TTypeList::size internally for better clarity.

* Added etl::type_list_remove, etl::type_list_remove_if, etl::type_list_unique, etl::type_list_pop_front, etl::type_list_pop_back

* Add ref-qualifiers to basic_format_spec (#1292)

* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* feat: use ref-qualifiers for basic_format_spec

Converted the l-value methods to ref-qualified and also added r-value ref-qualified methods.

---------

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

* Add support for size_t and unsigned long to etl::format (#1290)

* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Add support for size_t and unsigned long to etl::format

* Document list of supported types in etl::supported_format_types

* Add further types and tests for etl::format

---------

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

* Deduce underlying storage size when constructing string_ext from char[]. (#1269)

* Deduce underlying storage size when constructing string_ext from char[].

This removes the need for passing sizeof(storage) to the constructor.

* Add array constructors for the other string types.

- u16string_ext
- u32string_ext
- u8string_ext
- wstring_ext

* Add additional constructors to match existing API.

* Fix inconsistent test argument order.

---------

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

* Added etl::type_list_all_of, etl::type_list_any_of, and etl::type_list_none_of

* Added etl::type_list_is_unique

* Added type_list_is_empty

* indentation fix

* Fix merge error

* Renamed type_list_prepend & type_list_append to type_list_push_front & type_list_push_back respectively

* Added tests for make_index_sequence & make_index_sequence_with_offset

* Resolve coderabbit review issues

* Resolve coderabbit review issues

* Resolve coderabbit review issues

* Resolve coderabbit review issues

* Added  etl::type_list_indices_of_type which create an etl::index_sequence of all of the indexes of a specified type in an etl::type_list

* Updated comments

* Resolve coderabbit review issues

Added index_sequence utility to support type_list utilities. Added additional index_sequence utilities for completeness

* Added etl::index_sequence_cat, etl::index_sequence_pop_front, etl::index_sequence_pop_back, etl::index_sequence_at

* Fix 'unused variable' error in index_sequence tests

---------

Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.co.uk>
Co-authored-by: Sergei <sergej.shirokov@gmail.com>
Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
Co-authored-by: Bo Rydberg <2945606+bolry@users.noreply.github.com>
Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>
Co-authored-by: Mike Bloom <91038685+mike919192@users.noreply.github.com>
Co-authored-by: taltenbach <92919739+taltenbach@users.noreply.github.com>
Co-authored-by: Bryton Flecker <fleckerbr@gmail.com>
Co-authored-by: Bryton Flecker <bflecker@swe.com>
Co-authored-by: Drew Rife <drew.rife95@gmail.com>
Co-authored-by: Marco Nilsson <marco@zyax.se>

* Moved O(1)/O(logN) index search test to get_dispatch_index_from_message_id

Updated message_router generator

* Fixed C++03 compatibilty

* Replaced is_base_of with is_message

* Missing 'return' in chrono example

* Fixed doxygen comments

* Check message inherits from etl::message<>

* Copilot & coderabbit review changes

Check for no duplicated message IDs
Added diagnostic disable
Make Message_Id_Start an etl::message_id_t type

* Synchronised message_router_generator.h

* Modified the "All message IDs must be unique" static_assert to directly use the index_sequence of message IDs

Added addition index_sequence utilities to support this change.

* Changed Router1 definition to use unordered message ids to check message sorting in message_router

* Added has_message_id and compare_message_id_less to message.h

* Moved member type definitions to a traits class

message_packet, message_types, sorted_message_types

* Sync message_router_generator to changes

* Fixed C++03 compatibility

---------

Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.co.uk>
Co-authored-by: Sergei <sergej.shirokov@gmail.com>
Co-authored-by: Bo Rydberg <2945606+bolry@users.noreply.github.com>
Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>
Co-authored-by: Mike Bloom <91038685+mike919192@users.noreply.github.com>
Co-authored-by: taltenbach <92919739+taltenbach@users.noreply.github.com>
Co-authored-by: Bryton Flecker <fleckerbr@gmail.com>
Co-authored-by: Bryton Flecker <bflecker@swe.com>
Co-authored-by: Drew Rife <drew.rife95@gmail.com>
Co-authored-by: Marco Nilsson <marco@zyax.se>
2026-02-26 10:34:14 +00:00
Roland Reichwein
e439963258
Fix etl::variant get() for ambiguous types (#1304)
When a type occured multiple times in a variant, comparison operator
asserted before.

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-02-25 09:42:56 +00:00
Marco Nilsson
37aba58965
Reduce string flash usage (#1309)
* Remove call to initialise() in constructors.

The constructor execution flows were:

 constructor
   initialise()
   assign()
     append_impl()

initialise() does:
 - Set current_size to 0
 - Null terminate the buffer
 - Clear truncation flag

append_impl() does:
 - Assign truncation flag
 - Set current size to source size
 - Copy and null terminate the buffer

All the hard work done by initialise() is immediately overwritten. Removing the
call to initialise() saves 6-8 bytes of flash per constructor invocation when
targeting Cortex M33 with -Os.

* Avoid calling templated assign(iter, iter) with C strings.

Call the single pointer version of assign which ends up in the non-templated
append_impl. This calls the C lib's strlen and memmove rather than etl::strlen
which is a hand rolled loop.

This also reduces the risk of instantiating the iterator version of assign() if
it's not used elsewhere.

* Dispatch pointer iterators to non-template append_impl core.

When append_impl is called with pointer iterators (e.g. begin()/end()), SFINAE
routes them to a non-template core that takes a pointer and length. This
avoids duplicating the function body for each pointer type instantiation,
reducing flash usage on ARM Cortex-M by ~836 bytes at -Os.

* Revert make_string changes.

The original implementation used a bounded strlen which avoided OOB array access.

* Treat start, free_space and count as size_t to avoid casts.

* Ensure that append start is within the buffer.

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-02-25 09:02:02 +00:00
John Wellbelove
7a8944224b
Add more features to etl::type_list (#1307)
* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Added etl::type_list to etl::observer

* Added etl::type_list to etl::nth_type

* Added missing 'typename' to type_list nth_type

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Added type_list definitions for nth_type and observer

* Added etl::type_list to etl::variant

* Updated comments

* Addedetl::type~_list to message_router, observer, visitor

# Conflicts:
#	include/etl/observer.h
#	test/vs2022/etl.vcxproj.filters

* Added member type_list type to tuple

* Work in progress

* Copy changes from other source

* Removed unused tests

* Fix iter_swap namespace

* Add type_list functionality to etl::variant using etl::variant_from_type_list

* Add type_list functionality to etl::message_packet using etl::message_packet_from_type_list

* Add type_list functionality to etl::message_router using etl::message_router_from_type_list

* Add type_list functionality to etl::observer using etl::observer_from_type_list

* Add type_list functionality to etl::tuple using etl::tuple_from_type_list

* Allow etl::make_index_sequence to be created from an etl::type_list

* Add type_list functionality to etl::visitor using etl::visitor_from_type_list

* Fix iter_swap namespace

* Allow creation of a message_packet with no message types

* Allow creation of a message_router with no message types

* Updated VS2022 project files

* Added missing test files CMakeLists.txt

* Fix C++03 compatibility

Fixed unused aregument warnings

* Synced message_packet generator to updated code

* Synced message_router generator to updated code

* Synced message_router generator to updated code

# Conflicts:
#	include/etl/generators/message_router_generator.h
#	include/etl/message_router.h

* Fixed missing zero message specialisation for <= C++14

* Fixed missing zero message specialisation for <= C++14

* Fix year_month arithmetic and correct chrono API behavior (#1257)

* Fix & add more tests for year_month arithmetic

* Minor addtions to previous commit

* More missing values to be uninitialized

* Update the default constructors to = default and correct default constructor tests accordingly

* Fix & add more tests for year_month arithmetic

* Minor addtions to previous commit

* More missing values to be uninitialized

* Update the default constructors to = default and correct default constructor tests accordingly

* Restore default constructor behavior for chrono calender

* Suppress warnings from std in optimized builds (#1259)

When testing with ./run-tests.sh 23 3 10, some warnings from
std surfaced which resulted in build errors.

* Add template deduction guide for span from vector (#1264)

* Create span from vector deduction

* Use ivector for deduction.  Add vector_ext to test

* Add vector pointer to test

* Finish tests

* Initialize pdata_ext and others

* Document how to implement platform specifics (#1262)

Some interfaces need to be implemented in every project
or platform using the ETL:

* etl_get_high_resolution_clock
* etl_get_system_clock
* etl_get_steady_clock
* etl_putchar

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

* Fix etl::as_bytes for etl::span<const T> (#1266)

A missing 'const' in the etl::as_bytes implementation was causing a
compile-time error when etl::as_bytes was called on a span of const
values.

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

* Remove some UB in test_vector_non_trivial.cpp (#1268)

Some of the tests' UB are detectable by Gcc15 and thus give a compile error due to warnings-as-error flag.

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

* Update C++26 deprecated constructs to ensure future standard compliance (#1267)

* Update C++26 deprecated constructs to ensure future standard compliance

I replaced std::is_trivial with a combination of std::is_trivially_default_constructible and std::is_trivially_copyable. Additionally, I added the required comma before the ellipsis in variadic functions to match updated language specifications.

* Some additional is_trivial related changes not found directly when compiling tests in C++26

---------

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

* Fix return value of get_token_list (#1271)

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

* Fix etl::tuple template signature error in pair assignment operator (#1265)

* Fix etl::tuple template signature error in pair assignment operator

* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update etl::tuple to explicitly use etl::pair or std::pair in assignment operator

* Added tests for etl::tuple assignment from pair

---------

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

* Remove advance() on static spans (#1281)

* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Remove advance() on static spans

Since the size of a static span is constant, we can't reasonably
advance() on it.

---------

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

* Add missing includes (#1286)

* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Add missing includes

Before this change, the includes needed to be done explicitly by
files using basic_string_stream.h, and be included first. This
was error prone, especially if includes are reordered (e.g. via
the currently defined clang-format rules).

---------

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

* Move comparison operators of etl::expected to namespace etl (#1287)

* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Move comparison operators of etl::expected to namespace etl

---------

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

* Make typed_storage constructor constexpr (#1291)

* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Make typed_storage constructor constexpr

---------

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

* Add basic_format_arg constructor for ibasic_string (#1288)

* Allow string as format arg

* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Added test string escaped

* Add temporary string test

---------

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

* QR Code for Github

* Added etl::visitor_from_type_list

* accepts(id) for empty router passes on to a sucessor

* Fixed incorrect comment from 'tuple' to 'message_router'

* PR review changes

* PR review changes

* Fixed internal constexptr flag in message_packet

* Fixed unused variable in unti test

* Added new type_list features

Added make_index_sequence_with_offset

* Renamed type_list_select_from_sequence to type_list_select_from_index_sequence

* Replaced type_list_size<TTypeList>::value with TTypeList::size internally for better clarity.

* Added etl::type_list_remove, etl::type_list_remove_if, etl::type_list_unique, etl::type_list_pop_front, etl::type_list_pop_back

* Add ref-qualifiers to basic_format_spec (#1292)

* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* feat: use ref-qualifiers for basic_format_spec

Converted the l-value methods to ref-qualified and also added r-value ref-qualified methods.

---------

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

* Add support for size_t and unsigned long to etl::format (#1290)

* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Add support for size_t and unsigned long to etl::format

* Document list of supported types in etl::supported_format_types

* Add further types and tests for etl::format

---------

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

* Deduce underlying storage size when constructing string_ext from char[]. (#1269)

* Deduce underlying storage size when constructing string_ext from char[].

This removes the need for passing sizeof(storage) to the constructor.

* Add array constructors for the other string types.

- u16string_ext
- u32string_ext
- u8string_ext
- wstring_ext

* Add additional constructors to match existing API.

* Fix inconsistent test argument order.

---------

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

* Added etl::type_list_all_of, etl::type_list_any_of, and etl::type_list_none_of

* Added etl::type_list_is_unique

* Added type_list_is_empty

* indentation fix

* Fix merge error

* Renamed type_list_prepend & type_list_append to type_list_push_front & type_list_push_back respectively

* Added tests for make_index_sequence & make_index_sequence_with_offset

* Resolve coderabbit review issues

* Resolve coderabbit review issues

* Resolve coderabbit review issues

* Resolve coderabbit review issues

* Added  etl::type_list_indices_of_type which create an etl::index_sequence of all of the indexes of a specified type in an etl::type_list

* Updated comments

* Resolve coderabbit review issues

Added index_sequence utility to support type_list utilities. Added additional index_sequence utilities for completeness

* Added etl::index_sequence_cat, etl::index_sequence_pop_front, etl::index_sequence_pop_back, etl::index_sequence_at

* Fix 'unused variable' error in index_sequence tests

---------

Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.co.uk>
Co-authored-by: Sergei <sergej.shirokov@gmail.com>
Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
Co-authored-by: Bo Rydberg <2945606+bolry@users.noreply.github.com>
Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>
Co-authored-by: Mike Bloom <91038685+mike919192@users.noreply.github.com>
Co-authored-by: taltenbach <92919739+taltenbach@users.noreply.github.com>
Co-authored-by: Bryton Flecker <fleckerbr@gmail.com>
Co-authored-by: Bryton Flecker <bflecker@swe.com>
Co-authored-by: Drew Rife <drew.rife95@gmail.com>
Co-authored-by: Marco Nilsson <marco@zyax.se>
2026-02-21 09:36:48 +00:00
John Wellbelove
58b5bf5190 Added tests for make_index_sequence & make_index_sequence_with_offset 2026-02-19 19:35:49 +00:00
John Wellbelove
55da732fc8 Renamed type_list_prepend & type_list_append to type_list_push_front & type_list_push_back respectively 2026-02-19 19:23:36 +00:00
John Wellbelove
1d47e1b731 Fix merge error 2026-02-19 19:05:53 +00:00
John Wellbelove
52e57bc8b6 Merge branch 'development' into feature/Add-more-type_list-features
# Conflicts:
#	include/etl/utility.h
2026-02-19 19:03:41 +00:00
John Wellbelove
56dce4a3aa indentation fix 2026-02-19 18:23:58 +00:00
John Wellbelove
9ebcf41e63 Added type_list_is_empty 2026-02-19 13:29:11 +00:00
Roland Reichwein
992348b4bb
Add constexpr to array comparison operators (#1303)
* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Add constexpr to array comparison operators

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
Co-authored-by: Sergei <sergej.shirokov@gmail.com>
2026-02-19 13:18:12 +00:00
John Wellbelove
226117b972
Add etl::type_list API to more classes. (#1275)
* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Added etl::type_list to etl::observer

* Added etl::type_list to etl::nth_type

* Added missing 'typename' to type_list nth_type

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Added type_list definitions for nth_type and observer

* Added etl::type_list to etl::variant

* Updated comments

* Addedetl::type~_list to message_router, observer, visitor

# Conflicts:
#	include/etl/observer.h
#	test/vs2022/etl.vcxproj.filters

* Added member type_list type to tuple

* Work in progress

* Copy changes from other source

* Removed unused tests

* Fix iter_swap namespace

* Add type_list functionality to etl::variant using etl::variant_from_type_list

* Add type_list functionality to etl::message_packet using etl::message_packet_from_type_list

* Add type_list functionality to etl::message_router using etl::message_router_from_type_list

* Add type_list functionality to etl::observer using etl::observer_from_type_list

* Add type_list functionality to etl::tuple using etl::tuple_from_type_list

* Allow etl::make_index_sequence to be created from an etl::type_list

* Add type_list functionality to etl::visitor using etl::visitor_from_type_list

* Fix iter_swap namespace

* Allow creation of a message_packet with no message types

* Allow creation of a message_router with no message types

* Updated VS2022 project files

* Added missing test files CMakeLists.txt

* Fix C++03 compatibility

Fixed unused aregument warnings

* Synced message_packet generator to updated code

* Synced message_router generator to updated code

* Synced message_router generator to updated code

# Conflicts:
#	include/etl/generators/message_router_generator.h
#	include/etl/message_router.h

* Fixed missing zero message specialisation for <= C++14

* Fixed missing zero message specialisation for <= C++14

* Fix year_month arithmetic and correct chrono API behavior (#1257)

* Fix & add more tests for year_month arithmetic

* Minor addtions to previous commit

* More missing values to be uninitialized

* Update the default constructors to = default and correct default constructor tests accordingly

* Fix & add more tests for year_month arithmetic

* Minor addtions to previous commit

* More missing values to be uninitialized

* Update the default constructors to = default and correct default constructor tests accordingly

* Restore default constructor behavior for chrono calender

* Suppress warnings from std in optimized builds (#1259)

When testing with ./run-tests.sh 23 3 10, some warnings from
std surfaced which resulted in build errors.

* Add template deduction guide for span from vector (#1264)

* Create span from vector deduction

* Use ivector for deduction.  Add vector_ext to test

* Add vector pointer to test

* Finish tests

* Initialize pdata_ext and others

* Document how to implement platform specifics (#1262)

Some interfaces need to be implemented in every project
or platform using the ETL:

* etl_get_high_resolution_clock
* etl_get_system_clock
* etl_get_steady_clock
* etl_putchar

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

* Fix etl::as_bytes for etl::span<const T> (#1266)

A missing 'const' in the etl::as_bytes implementation was causing a
compile-time error when etl::as_bytes was called on a span of const
values.

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

* Remove some UB in test_vector_non_trivial.cpp (#1268)

Some of the tests' UB are detectable by Gcc15 and thus give a compile error due to warnings-as-error flag.

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

* Update C++26 deprecated constructs to ensure future standard compliance (#1267)

* Update C++26 deprecated constructs to ensure future standard compliance

I replaced std::is_trivial with a combination of std::is_trivially_default_constructible and std::is_trivially_copyable. Additionally, I added the required comma before the ellipsis in variadic functions to match updated language specifications.

* Some additional is_trivial related changes not found directly when compiling tests in C++26

---------

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

* Fix return value of get_token_list (#1271)

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

* Fix etl::tuple template signature error in pair assignment operator (#1265)

* Fix etl::tuple template signature error in pair assignment operator

* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update etl::tuple to explicitly use etl::pair or std::pair in assignment operator

* Added tests for etl::tuple assignment from pair

---------

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

* Remove advance() on static spans (#1281)

* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Remove advance() on static spans

Since the size of a static span is constant, we can't reasonably
advance() on it.

---------

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

* Add missing includes (#1286)

* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Add missing includes

Before this change, the includes needed to be done explicitly by
files using basic_string_stream.h, and be included first. This
was error prone, especially if includes are reordered (e.g. via
the currently defined clang-format rules).

---------

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

* Move comparison operators of etl::expected to namespace etl (#1287)

* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Move comparison operators of etl::expected to namespace etl

---------

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

* Make typed_storage constructor constexpr (#1291)

* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Make typed_storage constructor constexpr

---------

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

* Add basic_format_arg constructor for ibasic_string (#1288)

* Allow string as format arg

* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Added test string escaped

* Add temporary string test

---------

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

* QR Code for Github

* Added etl::visitor_from_type_list

* accepts(id) for empty router passes on to a sucessor

* Fixed incorrect comment from 'tuple' to 'message_router'

* PR review changes

* PR review changes

* Fixed internal constexptr flag in message_packet

* Fixed unused variable in unti test

---------

Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.co.uk>
Co-authored-by: Sergei <sergej.shirokov@gmail.com>
Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
Co-authored-by: Bo Rydberg <2945606+bolry@users.noreply.github.com>
Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>
Co-authored-by: Mike Bloom <91038685+mike919192@users.noreply.github.com>
Co-authored-by: taltenbach <92919739+taltenbach@users.noreply.github.com>
Co-authored-by: Bryton Flecker <fleckerbr@gmail.com>
Co-authored-by: Bryton Flecker <bflecker@swe.com>
2026-02-19 12:41:48 +00:00
John Wellbelove
2ba5e93d01 Added etl::type_list_is_unique 2026-02-19 10:00:57 +00:00
John Wellbelove
25b88e509b Added etl::type_list_all_of, etl::type_list_any_of, and etl::type_list_none_of 2026-02-19 09:16:13 +00:00
John Wellbelove
1b244ec4c0
Fix link rotations for etl::tree_node (#1299)
* Fixed tree node rotate

Improved tree node rotate tests to test all links.

* Removed trailing whitespace

* Removed trailing whitespace

---------

Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
2026-02-18 20:46:21 +00:00
Benedek Kupper
bfbb7259e1 delegate: allow constructing from non-capturing lambdas
Signed-off-by: Benedek Kupper <kupper.benedek@gmail.com>
2026-02-10 22:35:52 +01:00
Marco Nilsson
dc0f62cc3f Deduce underlying storage size when constructing string_ext from char[]. (#1269)
* Deduce underlying storage size when constructing string_ext from char[].

This removes the need for passing sizeof(storage) to the constructor.

* Add array constructors for the other string types.

- u16string_ext
- u32string_ext
- u8string_ext
- wstring_ext

* Add additional constructors to match existing API.

* Fix inconsistent test argument order.

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-02-09 11:07:13 +00:00
Roland Reichwein
13c90eb8f2 Add support for size_t and unsigned long to etl::format (#1290)
* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Add support for size_t and unsigned long to etl::format

* Document list of supported types in etl::supported_format_types

* Add further types and tests for etl::format

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
Co-authored-by: Sergei <sergej.shirokov@gmail.com>
2026-02-09 11:07:13 +00:00
Drew Rife
4cf97675bd Add ref-qualifiers to basic_format_spec (#1292)
* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* feat: use ref-qualifiers for basic_format_spec

Converted the l-value methods to ref-qualified and also added r-value ref-qualified methods.

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
Co-authored-by: Sergei <sergej.shirokov@gmail.com>
2026-02-09 11:07:12 +00:00
Marco Nilsson
45b352a059
Deduce underlying storage size when constructing string_ext from char[]. (#1269)
* Deduce underlying storage size when constructing string_ext from char[].

This removes the need for passing sizeof(storage) to the constructor.

* Add array constructors for the other string types.

- u16string_ext
- u32string_ext
- u8string_ext
- wstring_ext

* Add additional constructors to match existing API.

* Fix inconsistent test argument order.

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-02-09 11:01:20 +00:00
John Wellbelove
43972b416e Added etl::type_list_remove, etl::type_list_remove_if, etl::type_list_unique, etl::type_list_pop_front, etl::type_list_pop_back 2026-02-09 10:56:23 +00:00
John Wellbelove
f25e6b9d07 Replaced type_list_size<TTypeList>::value with TTypeList::size internally for better clarity. 2026-02-09 07:48:41 +00:00
John Wellbelove
81c8e351ff Renamed type_list_select_from_sequence to type_list_select_from_index_sequence 2026-02-08 21:22:07 +00:00
John Wellbelove
fe1f19ce4d Added new type_list features
Added make_index_sequence_with_offset
2026-02-08 10:42:03 +00:00
Roland Reichwein
10fd81c2be
Add support for size_t and unsigned long to etl::format (#1290)
* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Add support for size_t and unsigned long to etl::format

* Document list of supported types in etl::supported_format_types

* Add further types and tests for etl::format

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
Co-authored-by: Sergei <sergej.shirokov@gmail.com>
2026-02-06 10:08:17 +00:00
Drew Rife
2a79845dd5
Add ref-qualifiers to basic_format_spec (#1292)
* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* feat: use ref-qualifiers for basic_format_spec

Converted the l-value methods to ref-qualified and also added r-value ref-qualified methods.

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
Co-authored-by: Sergei <sergej.shirokov@gmail.com>
2026-02-06 09:32:54 +00:00
John Wellbelove
82f168c96e Fixed unused variable in unti test 2026-02-05 20:57:54 +00:00
John Wellbelove
6cec4a3971 Fixed internal constexptr flag in message_packet 2026-02-05 11:42:09 +00:00
John Wellbelove
ca6bbd50d0 PR review changes 2026-02-05 11:01:51 +00:00
John Wellbelove
1e2b69bc95 PR review changes 2026-02-05 10:53:08 +00:00
John Wellbelove
2e54c01c69 Fixed incorrect comment from 'tuple' to 'message_router' 2026-02-03 20:35:44 +00:00
John Wellbelove
fc7c80bb97 accepts(id) for empty router passes on to a sucessor 2026-02-03 20:34:04 +00:00
John Wellbelove
a4c2272ad6
Merge branch 'development' into feature/#1234-Add-etl--type_list-API-to-more-classes 2026-02-03 09:05:31 +00:00
John Wellbelove
58619ec675 Added etl::visitor_from_type_list 2026-02-03 08:59:56 +00:00
John Wellbelove
3826e2ab2e QR Code for Github 2026-02-03 08:59:55 +00:00
Mike Bloom
e80623bc1a Add basic_format_arg constructor for ibasic_string (#1288)
* Allow string as format arg

* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Added test string escaped

* Add temporary string test

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
Co-authored-by: Sergei <sergej.shirokov@gmail.com>
2026-02-03 08:59:55 +00:00
Roland Reichwein
75eb6680d6 Make typed_storage constructor constexpr (#1291)
* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Make typed_storage constructor constexpr

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
Co-authored-by: Sergei <sergej.shirokov@gmail.com>
2026-02-03 08:59:54 +00:00
Roland Reichwein
353c36c393 Move comparison operators of etl::expected to namespace etl (#1287)
* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Move comparison operators of etl::expected to namespace etl

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
Co-authored-by: Sergei <sergej.shirokov@gmail.com>
2026-02-03 08:59:53 +00:00
Roland Reichwein
d8d4187176 Add missing includes (#1286)
* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Add missing includes

Before this change, the includes needed to be done explicitly by
files using basic_string_stream.h, and be included first. This
was error prone, especially if includes are reordered (e.g. via
the currently defined clang-format rules).

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
Co-authored-by: Sergei <sergej.shirokov@gmail.com>
2026-02-03 08:59:53 +00:00
Roland Reichwein
17e6167317 Remove advance() on static spans (#1281)
* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Remove advance() on static spans

Since the size of a static span is constant, we can't reasonably
advance() on it.

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
Co-authored-by: Sergei <sergej.shirokov@gmail.com>
2026-02-03 08:59:52 +00:00
Bryton Flecker
012bbea249 Fix etl::tuple template signature error in pair assignment operator (#1265)
* Fix etl::tuple template signature error in pair assignment operator

* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update etl::tuple to explicitly use etl::pair or std::pair in assignment operator

* Added tests for etl::tuple assignment from pair

---------

Co-authored-by: Bryton Flecker <bflecker@swe.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-02-03 08:59:51 +00:00
Mike Bloom
8b0fd64289 Fix return value of get_token_list (#1271)
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-02-03 08:59:51 +00:00
Bo Rydberg
dbaffa9169 Update C++26 deprecated constructs to ensure future standard compliance (#1267)
* Update C++26 deprecated constructs to ensure future standard compliance

I replaced std::is_trivial with a combination of std::is_trivially_default_constructible and std::is_trivially_copyable. Additionally, I added the required comma before the ellipsis in variadic functions to match updated language specifications.

* Some additional is_trivial related changes not found directly when compiling tests in C++26

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-02-03 08:59:50 +00:00
Bo Rydberg
a843650649 Remove some UB in test_vector_non_trivial.cpp (#1268)
Some of the tests' UB are detectable by Gcc15 and thus give a compile error due to warnings-as-error flag.

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-02-03 08:59:49 +00:00
taltenbach
d419bbf16f Fix etl::as_bytes for etl::span<const T> (#1266)
A missing 'const' in the etl::as_bytes implementation was causing a
compile-time error when etl::as_bytes was called on a span of const
values.

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-02-03 08:59:49 +00:00
Roland Reichwein
24421edd29 Document how to implement platform specifics (#1262)
Some interfaces need to be implemented in every project
or platform using the ETL:

* etl_get_high_resolution_clock
* etl_get_system_clock
* etl_get_steady_clock
* etl_putchar

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-02-03 08:59:48 +00:00
Mike Bloom
45e5668782 Add template deduction guide for span from vector (#1264)
* Create span from vector deduction

* Use ivector for deduction.  Add vector_ext to test

* Add vector pointer to test

* Finish tests

* Initialize pdata_ext and others
2026-02-03 08:59:47 +00:00
Roland Reichwein
2a727b12b4 Suppress warnings from std in optimized builds (#1259)
When testing with ./run-tests.sh 23 3 10, some warnings from
std surfaced which resulted in build errors.
2026-02-03 08:59:47 +00:00
Bo Rydberg
86fea52f5c Fix year_month arithmetic and correct chrono API behavior (#1257)
* Fix & add more tests for year_month arithmetic

* Minor addtions to previous commit

* More missing values to be uninitialized

* Update the default constructors to = default and correct default constructor tests accordingly

* Fix & add more tests for year_month arithmetic

* Minor addtions to previous commit

* More missing values to be uninitialized

* Update the default constructors to = default and correct default constructor tests accordingly

* Restore default constructor behavior for chrono calender
2026-02-03 08:59:46 +00:00
John Wellbelove
21a1f58299 QR Code for Github 2026-02-02 19:32:04 +00:00
Mike Bloom
b51968d6dd
Add basic_format_arg constructor for ibasic_string (#1288)
* Allow string as format arg

* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Added test string escaped

* Add temporary string test

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
Co-authored-by: Sergei <sergej.shirokov@gmail.com>
2026-02-02 18:35:25 +00:00
Roland Reichwein
a3c8f80216
Make typed_storage constructor constexpr (#1291)
* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Make typed_storage constructor constexpr

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
Co-authored-by: Sergei <sergej.shirokov@gmail.com>
2026-02-02 16:43:26 +00:00
Roland Reichwein
570a7adaa3
Move comparison operators of etl::expected to namespace etl (#1287)
* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Move comparison operators of etl::expected to namespace etl

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
Co-authored-by: Sergei <sergej.shirokov@gmail.com>
2026-02-02 10:46:00 +00:00
Roland Reichwein
db89cc8920
Add missing includes (#1286)
* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Add missing includes

Before this change, the includes needed to be done explicitly by
files using basic_string_stream.h, and be included first. This
was error prone, especially if includes are reordered (e.g. via
the currently defined clang-format rules).

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
Co-authored-by: Sergei <sergej.shirokov@gmail.com>
2026-02-01 10:16:41 +00:00
John Wellbelove
15b96484d5 Fixed missing zero message specialisation for <= C++14 2026-01-30 18:33:30 +00:00
John Wellbelove
491c648d3e Fixed missing zero message specialisation for <= C++14 2026-01-30 11:08:09 +00:00
John Wellbelove
53a9cde9a4 Synced message_router generator to updated code
# Conflicts:
#	include/etl/generators/message_router_generator.h
#	include/etl/message_router.h
2026-01-30 09:22:57 +00:00
John Wellbelove
f0372eaeaa
Merge branch 'master' into feature/#1234-Add-etl--type_list-API-to-more-classes 2026-01-30 09:12:02 +00:00
John Wellbelove
a7fe6bc6b0 Synced message_router generator to updated code 2026-01-30 09:06:54 +00:00
John Wellbelove
0ad0cec342 Synced message_packet generator to updated code 2026-01-29 10:06:42 +00:00
John Wellbelove
ff03b2807d Fix C++03 compatibility
Fixed unused aregument warnings
2026-01-28 22:24:46 +00:00
John Wellbelove
fa8f07ab80 Added missing test files CMakeLists.txt 2026-01-28 17:46:35 +00:00
John Wellbelove
eb1216146c Updated VS2022 project files 2026-01-28 17:46:10 +00:00
John Wellbelove
a4ee9d01aa Allow creation of a message_router with no message types 2026-01-28 17:45:29 +00:00
John Wellbelove
fed1274324 Allow creation of a message_packet with no message types 2026-01-28 17:45:11 +00:00
John Wellbelove
21f68eb7b9 Fix iter_swap namespace 2026-01-28 17:42:43 +00:00
John Wellbelove
bde8747be8 Add type_list functionality to etl::visitor using etl::visitor_from_type_list 2026-01-28 17:42:25 +00:00
John Wellbelove
a61980660f Allow etl::make_index_sequence to be created from an etl::type_list 2026-01-28 17:33:32 +00:00
John Wellbelove
a4e4527669 Add type_list functionality to etl::tuple using etl::tuple_from_type_list 2026-01-28 17:26:57 +00:00
John Wellbelove
a669d1f46e Add type_list functionality to etl::observer using etl::observer_from_type_list 2026-01-28 17:26:20 +00:00
John Wellbelove
1243099471 Add type_list functionality to etl::message_router using etl::message_router_from_type_list 2026-01-28 17:25:08 +00:00
John Wellbelove
746761124c Add type_list functionality to etl::message_packet using etl::message_packet_from_type_list 2026-01-28 17:24:45 +00:00
John Wellbelove
69b741adb8 Add type_list functionality to etl::variant using etl::variant_from_type_list 2026-01-28 17:22:37 +00:00
John Wellbelove
d7dc1281ae Fix iter_swap namespace 2026-01-28 17:20:01 +00:00
John Wellbelove
49d7fa80bc Removed unused tests 2026-01-27 19:28:40 +00:00
John Wellbelove
947e89a6e9 Copy changes from other source 2026-01-26 17:56:33 +00:00
John Wellbelove
8320b35d47 Work in progress 2026-01-26 17:56:32 +00:00
John Wellbelove
92e33bb974 Added member type_list type to tuple 2026-01-26 17:56:31 +00:00
John Wellbelove
c67c617d8c Addedetl::type~_list to message_router, observer, visitor
# Conflicts:
#	include/etl/observer.h
#	test/vs2022/etl.vcxproj.filters
2026-01-26 17:56:31 +00:00
John Wellbelove
1c0d7a87de Updated comments 2026-01-25 19:19:18 +01:00
John Wellbelove
61796bee8f Added etl::type_list to etl::variant 2026-01-25 11:10:38 +01:00
John Wellbelove
682b1e7011 Added type_list definitions for nth_type and observer 2026-01-25 11:09:59 +01:00
Roland Reichwein
9757860241
Remove advance() on static spans (#1281)
* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Remove advance() on static spans

Since the size of a static span is constant, we can't reasonably
advance() on it.

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
Co-authored-by: Sergei <sergej.shirokov@gmail.com>
2026-01-23 19:33:08 +01:00
Sergei
af1caa88fd Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)
* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.
2026-01-22 10:25:22 +01:00
Sergei
c600605734
Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)
* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.
2026-01-22 10:22:23 +01:00
Bryton Flecker
f9dc1caa94
Fix etl::tuple template signature error in pair assignment operator (#1265)
* Fix etl::tuple template signature error in pair assignment operator

* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update etl::tuple to explicitly use etl::pair or std::pair in assignment operator

* Added tests for etl::tuple assignment from pair

---------

Co-authored-by: Bryton Flecker <bflecker@swe.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-01-22 05:30:20 +01:00
Mike Bloom
b82bf3b79d
Fix return value of get_token_list (#1271)
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-01-21 19:40:19 +01:00
John Wellbelove
01a0b63919 Added missing 'typename' to type_list nth_type 2026-01-21 11:26:14 +01:00
John Wellbelove
2862b3b247 Added etl::type_list to etl::nth_type 2026-01-21 09:50:15 +01:00
John Wellbelove
2cae496620 Added etl::type_list to etl::observer 2026-01-21 09:26:48 +01:00
John Wellbelove
fcd50486ce
Update CONTRIBUTING.md
Updated the instructions for contributing.
2026-01-21 09:00:51 +01:00
Bo Rydberg
2c78c3d151
Update C++26 deprecated constructs to ensure future standard compliance (#1267)
* Update C++26 deprecated constructs to ensure future standard compliance

I replaced std::is_trivial with a combination of std::is_trivially_default_constructible and std::is_trivially_copyable. Additionally, I added the required comma before the ellipsis in variadic functions to match updated language specifications.

* Some additional is_trivial related changes not found directly when compiling tests in C++26

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-01-20 11:36:14 +01:00
Bo Rydberg
1b1145ea4e
Remove some UB in test_vector_non_trivial.cpp (#1268)
Some of the tests' UB are detectable by Gcc15 and thus give a compile error due to warnings-as-error flag.

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-01-20 11:15:38 +01:00
John Wellbelove
142dff245c
Update README.md 2026-01-20 10:53:08 +01:00
John Wellbelove
a1744add1f
Remove AppVeyor build status badge
Removed AppVeyor build status badge from README.
2026-01-20 10:35:02 +01:00
taltenbach
55503e0b97
Fix etl::as_bytes for etl::span<const T> (#1266)
A missing 'const' in the etl::as_bytes implementation was causing a
compile-time error when etl::as_bytes was called on a span of const
values.

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-01-17 23:04:52 +01:00
Roland Reichwein
c92dbc2fce
Document how to implement platform specifics (#1262)
Some interfaces need to be implemented in every project
or platform using the ETL:

* etl_get_high_resolution_clock
* etl_get_system_clock
* etl_get_steady_clock
* etl_putchar

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-01-17 14:26:16 +01:00
Mike Bloom
3b1ca75ba2
Add template deduction guide for span from vector (#1264)
* Create span from vector deduction

* Use ivector for deduction.  Add vector_ext to test

* Add vector pointer to test

* Finish tests

* Initialize pdata_ext and others
2026-01-16 09:57:09 +01:00
Roland Reichwein
3780070bcf
Suppress warnings from std in optimized builds (#1259)
When testing with ./run-tests.sh 23 3 10, some warnings from
std surfaced which resulted in build errors.
2026-01-16 09:51:11 +01:00
John Wellbelove
226caa30b5
Changed ETL_OR_STD:: to etl:: (#1261)
Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.co.uk>
2026-01-16 09:47:32 +01:00
Bo Rydberg
0644f9827b
Fix year_month arithmetic and correct chrono API behavior (#1257)
* Fix & add more tests for year_month arithmetic

* Minor addtions to previous commit

* More missing values to be uninitialized

* Update the default constructors to = default and correct default constructor tests accordingly

* Fix & add more tests for year_month arithmetic

* Minor addtions to previous commit

* More missing values to be uninitialized

* Update the default constructors to = default and correct default constructor tests accordingly

* Restore default constructor behavior for chrono calender
2026-01-16 09:02:46 +01:00
John Wellbelove
e9c2577d8e Updated release note and version 2026-01-11 21:06:22 +01:00
John Wellbelove
cdd1de4b56 Updated release note and version 2026-01-11 18:56:17 +01:00
John Wellbelove
14ce8a93fb Updated release note and version 2026-01-11 18:55:00 +01:00
mike919192
3206ac9feb
ivector swap (#1256)
* Etl vector swap implementation

* Implement swap function overload

* Fix nitpicks

* Add size check

* Remove unnessecary etl swap overloads

* Use swap_range and move range

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-01-11 18:05:21 +01:00
John Wellbelove
6d6ecc9fb5
Add etl::inplace_function (#1251)
* Imported inplace_function and invoke functionality from original branch

* Fixed spelling mistake

* Update test/CMakeLists.txt

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update test/test_inplace_function.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Moved member type function_ptr to private section

* Updated comments in inplace_function.h

* Updated action workflows to be triggered on a pull-request based on development branch

* Added suggested changes from PR reviews

---------

Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.co.uk>
2026-01-10 09:46:50 +01:00
John Wellbelove
09555434f6 Fixed multiple definition of 'expected' 2026-01-08 23:05:46 +01:00
Bo Rydberg
f8ee5f450b
Make code base with tests compile under gcc-14 (#1254)
* Make code base with tests compile under gcc-14

* Update buffer_descriptors.h

Following the same style as non-tests headers have. E.g., include/etl/intrusive_list.h & include/etl/intrusive_forward_list.h

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-01-08 22:58:27 +01:00
Bo Rydberg
5b99aa50b3
Fix syntax errors in base64 test (#1255)
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-01-08 21:12:43 +01:00
littepoint
0c3dafa09e
feat(mutex): Add ThreadX mutex support (#1252)
* feat(mutex): Add ThreadX mutex support

* fix(mutex): Fix ThreadX mutex naming and destructor issues

Correct the header guard macro naming error from ETL_MUTEX_THREAD to ETL_MUTEX_THREADX
Add mutex destructor to properly release resources
Modify mutex creation name identifier to "etl mutex"

---------

Co-authored-by: littepoint <1053049738@qq.com>
2026-01-04 10:38:09 +00:00
Iványi Béla
16389b3eea
Indirect vector checks (#1239)
* Check in indirect_vector::emplace_back if the vector is full, when push pop checks are requested

* Add extra checks to indirect_vector

* Fix emplace in indirect_vector not taking const_iterator

* Fix usage of ipool::create<T> in indirect_vector, so that there are no intermitten objects created

---------

Co-authored-by: Béla Iványi <bela.ivanyi@idata.hu>
2026-01-01 09:56:25 +00:00
John Wellbelove
4f70ed5329 Merge branch 'development' of https://github.com/ETLCPP/etl into development
# Conflicts:
#	test/test_optional.cpp
2025-12-26 07:25:56 +00:00
Nik Delgado
af8ec168c4 implement .begin() and .end() for etl::optional (#1246)
Co-authored-by: nikdelgado <nikdelgado@icloud.com>
2025-12-26 07:25:33 +00:00
Nik Delgado
46a937fc34
implement .begin() and .end() for etl::optional (#1246)
Co-authored-by: nikdelgado <nikdelgado@icloud.com>
2025-12-26 07:01:58 +00:00
John Wellbelove
94d960748d Fixed incompatibilities with C++03 2025-12-23 08:28:47 +00:00
John Wellbelove
16b7183eb8 Merge branch 'pull-request/#1245-Fix-discrepancy-with-STL-in-max_element-and-minmax_element' into development 2025-12-23 07:35:26 +00:00
John Wellbelove
62c654c749 Merge branch 'pull-request/#1244-Fix-no-check-macros' into development 2025-12-23 07:17:28 +00:00
mike919192
819d813a12
Fix no check macros (#1244) 2025-12-23 07:11:07 +00:00
John Wellbelove
339f5abf0f Updated ignore 2025-12-23 07:10:10 +00:00
mike919192
342e43e28b
Fix discrepency with STL in max element and minmax element (#1245) 2025-12-23 07:09:37 +00:00
John Wellbelove
96e3229933 Fixed issue with use of binary constants with C++11 in etl::format tests 2025-12-23 07:05:23 +00:00
John Wellbelove
c798bd337b Revert script to full scrolling terminal style 2025-12-23 07:04:31 +00:00
John Wellbelove
c8fa20620e Fixed C++11 issue with constexpr in exception.h 2025-12-23 07:03:46 +00:00
John Wellbelove
922cfde453 Reverted scrolling changes on test script 2025-12-22 21:02:54 +00:00
John Wellbelove
6b3e776eb5 Fixed filters on VS2022 project 2025-12-22 21:02:17 +00:00
John Wellbelove
62d3fa12f1 Merge branch 'development' of https://github.com/ETLCPP/etl into development 2025-12-22 10:04:35 +00:00
John Wellbelove
84f037b616 Enhanced test and syntax check scripts to add non-scrolling command line header 2025-12-22 10:04:17 +00:00
John Wellbelove
d98c3ac903 Fixed issues with unsigned to signed conversion.
Added format.h to VS2022 project.
Added format.h to syntax check CMakeLists.txt
2025-12-22 10:04:16 +00:00
Roland Reichwein
8c90eb8ba8 Add etl::format (#1204)
* Synchronize on C++ 17 for "Windows - STL" and "Windows - No STL"

MSVC C++20 handles char* differently on iteration

* Add etl::format

This adds etl::format, guided by std::format, avoiding dynamic memory
allocation
2025-12-22 10:04:15 +00:00
John Wellbelove
f548cfc602 Fixed C++ standard check for concepts 2025-12-22 10:04:15 +00:00
John Wellbelove
fc951ff9e2 Disabled header include if <C++20 2025-12-22 10:04:14 +00:00
John Wellbelove
a948ffe686 Added concepts.h to VS2022 project.
Added concepts.h to syntax check CMakeLists.txt
2025-12-22 10:04:13 +00:00
Roland Reichwein
e85d29b1dd Added concepts.h and tests (#1213) 2025-12-22 10:04:13 +00:00
Christoph Rüthing
b2a4b4410c Spare more Resources for non-verbose Errors (#1214)
* Spare more Resources for non-verbose Errors

At the moment we only remove the __FILE__ in case ETL_VERBOSE_ERRORS is
not set. However, we also want to remove the error text which can
consume quite some resources and without the file name the line number
is also not very useful.

* Introduce separate ETL_MINIMAL_ERRORS to keep backwards compatability

To not break runtime backwards compatability, instead of removing the
text in case of ETL_VERBOSE_ERRORS not defined, we introduce a second
flag ETL_MINIMAL_ERRORS which is mutually exclusive. The semantic is as
follows:

- ETL_VERBOSE_ERRORS: We use verbose text, file names and line numbers.
- ETL_MINIMAL_ERRORS: We do not use anything.
- ETL_VERBOSE_ERRORS and ETL_MINIMAL_ERRORS: Issue an error.
- non defined: We use terse text without file names nor line numbers.

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2025-12-22 10:04:12 +00:00
John Wellbelove
8d2f91de9f Updated test_invoke 2025-12-22 10:04:12 +00:00
John Wellbelove
702dda4373 Synchronised etl::invoke_result with that in the etl::inplace_function branch 2025-12-22 10:04:11 +00:00
John Wellbelove
1f1e2c54c3 Updated VS2022 project to include invoke.h 2025-12-22 10:04:10 +00:00
John Wellbelove
054fca0e25 Updated functional.h from the code in the inplace_function branch 2025-12-22 10:04:10 +00:00
John Wellbelove
1ac82dc83e Updated invoke.h from the code in the inplace_function branch 2025-12-22 10:04:09 +00:00
John Wellbelove
552e0f8b90 Formatting updates 2025-12-22 10:04:09 +00:00
whitfijs-jw
269f3ffdfd Topic/expected monadic operations (#1219)
* topic/expected-monadic-operations:
	- added and_then, or_else, transform, and transform_error with simple tests

* topic/expected-monadic-operation:
	- added void TValue specialization operations
	- updated unit tests to include expected<void, TError>
	- added is_expected to expected.h, used in and_then to ensure that the returned type is an expected

* topic/expected-monadic-operations:
	- made implementation c++11 compatible

* topic/expected-monadic-operations:
	- started addressing coderabbit feedback

* topic/expected-monadic-operations:
	- adapted invoke to etl
	- reworked return type deduction
	- filled in or_else unit tests to be more complete
	- still need to add invoke unit tests

* topic/expected-monadic-operations:
	-c++14 compliance

* topic/expected-monadic-operations:
	- completed coderabbit suggestions

* topic/expected-monadic-operations:
	- formatting in invoke and expected
	- added test suite for invoke

* topic/expected-monadic-operations:
	- fixed missing moves for const TValue&& and const TError&&

* topic/expected-monadic-operations:
	- made everything c++11 compatible, very verbose as a result

* topic/expected-monadic-operations:
	- fixed code rabbit rewivew for move semantics in const && overloads

* topic/expected-monadic-operations:
	- moved around a move

* topic/expected-monadic-operations:
	- added etl:: to invoke_result calls that were missing it

* topic/expected-monadic-operations:
	- formatting

* topic/expected-monadic-operations:
	- added invoke for void f() calls for consistency

* topic/expected-monadic-operations:
	- reworked entire thing to be able to handle expected<T,E> to expected<void,E> without even more code duplication

* topic/expected-monadic-operations:
	- added trailing return type to maintain c++11 compatibility

* topic/expected-monadic-operations:
	- fixed mismatch between deduced type and return for a few functions

* topic/expected-monadic-operations:
	- replaced calls to get<TError> and get<TValue> with get<Error_Type> and get<Value_Type>

---------

Co-authored-by: Jon Whitfield <jon@volumetrix.com>
2025-12-22 10:04:08 +00:00
John Wellbelove
520b4a9f46 Removed redundant semicolon from TEST_SUITE block 2025-12-22 10:04:07 +00:00
Iványi Béla
0d792ef13b Exception std based option (#1232)
* Add ability to derive etl::exception from std::exception

* Only add test for exception std base when using STL

* Use ETL_NOEXCEPT macro to define a function as noexcept

* Rename macro to keep in line with common style

* Add using_std_exception to etl::traits

---------

Co-authored-by: Béla Iványi <bela.ivanyi@idata.hu>
2025-12-22 10:04:07 +00:00
Roland Reichwein
3c36e696f5 Bugfixes for compile errors in optimized tests (#1235)
* Fix optimized tests by suppressing warning from STL

* Fix uninitialized buffer in hash for month_weekday

* Fix overlapping memcpy with memmove

* Fix random out of bounds index in __builtin_memmove

Suppressing compiler warning

* Fix array bounds warnings from static casts in message_router

In compiled code, casting to wrong message types is generated,
even though the code paths are supposed to be never taken due to runtime
msg id checks. Therefore, the warnings can be suppressed.

* Fix syntax errors in base64 decoder tests

* Fix test failure in test_rounded_integral_division.cpp when optimized

When building tests optimized, test_round_to_half_even_signed_limits
fails due to the fact that

etl::absolute(std::numeric_limits<int32_t>::min()) < 0
2025-12-22 10:04:06 +00:00
John Wellbelove
636ed523bd Enhanced test and syntax check scripts to add non-scrolling command line header 2025-12-20 12:51:01 +00:00
John Wellbelove
8918cab50a Merge branch 'pull-request/#1238-Various-cleanup' of https://github.com/ETLCPP/etl into pull-request/#1238-Various-cleanup 2025-12-20 10:42:55 +00:00
Roland Reichwein
33f7bbc43d Various cleanup (#1238)
* Fix typo for remainder in rounded_integral_division.h

* Use etl::make_unsigned instead of std::make_unsigned

* Fix divide_round_half_down and divide_round_half_odd
2025-12-20 10:42:47 +00:00
John Wellbelove
6f11b19cfa Remove legacy VS2019 project 2025-12-17 09:55:35 +00:00
John Wellbelove
cb2b3fe6f4 Added --pedandic-errors and -Werror to CMakeLists.txt 2025-12-16 10:41:53 +00:00
John Wellbelove
d884719098 Fixed all 'extra semicolon' warnings 2025-12-16 09:15:26 +00:00
Roland Reichwein
8f3db74be8
Various cleanup (#1238)
* Fix typo for remainder in rounded_integral_division.h

* Use etl::make_unsigned instead of std::make_unsigned

* Fix divide_round_half_down and divide_round_half_odd
2025-12-13 07:46:14 +00:00
John Wellbelove
558c04b0a0 Added <type_traits> for C++23 clang 2025-12-10 18:35:45 +00:00
John Wellbelove
0744ee6989 Added type_traits to test_memory 2025-12-10 08:22:45 +00:00
John Wellbelove
6ebd24578b Don't test deprecated has_denorm in C++23 and above 2025-12-09 10:10:49 +00:00
John Wellbelove
9eb17369c4 Don't test deprecated has_denorm in C++23 and above 2025-12-09 09:47:00 +00:00
John Wellbelove
338d0a4cf5 Don't test deprecated has_denorm in C++23 and above 2025-12-09 09:34:07 +00:00
John Wellbelove
868eaa2b79 Changed Github CI to use macos-15 2025-12-09 09:11:07 +00:00
John Wellbelove
133d065bf1 Updated release notes 2025-12-09 08:58:07 +00:00
John Wellbelove
1039327148 Minor comment and project file change 2025-12-09 08:57:23 +00:00
John Wellbelove
31b658ba81 Improve implementation of traits for functions 2025-12-08 09:11:25 +00:00
John Wellbelove
57c50fce89 Updated misleading template parameter names 2025-12-08 09:11:25 +00:00
mike919192
3525c63b54
Bugfix: Issue 1212 span constructor (#1231)
* Quick fix for issue 1212

* #if macro around std array uses

* Fix macro placement

* Maybe size_t

* Maybe SIZE_

* Check if old boost style works

* Fix angle brackets

* Cleanup traits and add const constructors

* Add traits to C++03 constructors
2025-12-08 09:07:29 +00:00
John Wellbelove
743ed78223 Merge branch 'development' 2025-12-04 08:25:39 +00:00
John Wellbelove
1128414d21 Synced type_traits generator 2025-12-04 08:15:24 +00:00
John Wellbelove
1f15e86ebf Updated version and release notes 2025-12-04 08:11:50 +00:00
John Wellbelove
f5f76165ef Replaced locally defined logical_not_t with etl::negation 2025-12-04 08:11:11 +00:00
John Wellbelove
7fd0360664 Replaced locally defined logical_not_t with etl::negation 2025-12-04 07:47:39 +00:00
John Wellbelove
3c64940e90 Fixed C++03 compatibility
Updated type_traits generator
2025-12-03 09:07:27 +00:00
John Wellbelove
34abed35b0 Synchronised generators with source files 2025-12-02 17:13:10 +00:00
raitraak-rrk
ea73cde70b
variant_legacy.h: Rename template parameters (#1229)
* Bugfix: Fixed span reinterpret_as should return fixed span (#1210)

* Fixed span reinterpret should also return fixed span

* Use auto instead of CTAD

* variant_legacy.h: Rename template parameters

* Allows compatibility with legacy libraries defining U8 similar to uint8_t (e.g. Segger).

---------

Co-authored-by: mike919192 <91038685+mike919192@users.noreply.github.com>
2025-12-02 10:34:06 +00:00
John Wellbelove
ee820f0742 #1228u nused parameter 'secure'
Also fixed for 'truncated'
2025-11-29 09:54:36 +00:00
mike919192
cb25fdfff5 Bugfix: Fixed span reinterpret_as should return fixed span (#1210)
* Fixed span reinterpret should also return fixed span

* Use auto instead of CTAD
2025-11-29 09:54:35 +00:00
David Ockey
79afa52c1e
Catch reentrant calls to FSM and HFSM start, receive, etc. (#1202)
* Added mechanism to catch reentrant calls to methods that could change states in FSM/HFSM

* Added missing include for HFSM unit tests

* Fixed error text spacing

* Disabled move/copy semantics for reentrancy guard

* Updated FSM generator

* Made move semantics only available for C++11 and higher

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2025-11-29 09:54:17 +00:00
mike919192
81a643b9b5
Bugfix: Fixed span reinterpret_as should return fixed span (#1210)
* Fixed span reinterpret should also return fixed span

* Use auto instead of CTAD
2025-11-29 09:41:54 +00:00
Iványi Béla
79b41c85af
Fix is_truncated in basic_string (#1223)
Co-authored-by: Iványi Béla <bela.ivanyi@idata.hu>
2025-11-29 09:38:10 +00:00
Roland Reichwein
efd5c57419
Change generators to reflect changes in fsm.h and type_traits.h (#1211)
Previous changes were wrongfully made in fsm.h and type_traits.h
instead of in their generator counterparts.

Add CI check to ensure generated files are in sync.
2025-11-27 08:54:13 +00:00
mike919192
a6f4c0b4d1
Basic string checks (#1222)
* Add checks for index, front, back, and insert

* Add erase checks

* Add tests to string_char

* Add u16 tests

* Add tests to string u32

* Add u8 tests

* Add wchar tests

* Use size() for back functions.  Fix some uses of buffer2

* Add assert for swapped insert iterators.  Add tests
2025-11-27 08:52:37 +00:00
Roland Reichwein
14e3b9d11e
Cleanup platform.h includes, add missing test for unaligned_type (#1218)
* platform.h include cleanup

* Add test for implicit value conversion in unaligned_type
2025-11-27 08:50:39 +00:00
Helder Duarte
78f04ad298
Fix value_or not taking const in optional (#1225) 2025-11-27 08:48:27 +00:00
lschneidercor
e5dd953c8b
Add missing include to optional (#1226)
When the initializer list is not included, the default std::initializer
list is used and ETL_NO_STL would be ignored.
2025-11-27 08:47:50 +00:00
Roland Reichwein
2f535d385f
Add test for swap (#1221) 2025-11-12 18:05:20 +00:00
Filipe Cuim
43d3f0e89c
Add const specialization for etl::get_object_at (#1217)
Signed-off-by: Filipe Cuim <filipemocuim@gmail.com>
2025-11-11 19:12:39 +00:00
John Wellbelove
b6e78b7c9c Updated etl::array and etl::delegate
Updated release nots and version
2025-10-19 18:40:58 +01:00
mike919192
bb24ea2164
Fix array noexcept expr (#1208) 2025-10-19 17:10:32 +01:00
John Wellbelove
a025d0cc68 Update version and release notes 2025-10-15 08:33:38 +01:00
John Wellbelove
817f2ab99e Update version and release notes 2025-10-14 18:03:14 +01:00
John Wellbelove
4b8ab3eeda Added type_list_has_duplicates_of and type_list_count_of 2025-10-13 23:02:45 +01:00
John Wellbelove
c7d2682659 Added macro settings 2025-10-13 22:31:33 +01:00
John Wellbelove
02b0de1ae9 Added extra static assert checks for functors and lambdas 2025-10-13 17:42:27 +01:00
John Wellbelove
e0e7155d63 Merge branch 'pull-request/#1188-etl-array-checks' into development 2025-10-13 17:37:56 +01:00
mike919192
4147216231
etl::span checks (#1201)
* Implement checks

* handle cpp11 constexpr exceptions

* Cant use local variables

* Tests should be implemented

* Try to fix msvc

* Fix etl error text
2025-10-13 17:34:34 +01:00
John Wellbelove
23d78d5dc7 Merge branch 'hotfix/#1203-Potential-issue-with-forwarding-in-etl--delegate' into development 2025-10-12 11:05:45 +01:00
John Wellbelove
30ccdea629 Opimisation of delegate invocations 2025-10-12 11:05:30 +01:00
John Wellbelove
532c9737b7 Merge branch 'hotfix/Fix-usage-of-noexcept' into development
# Conflicts:
#	include/etl/platform.h
2025-10-11 16:37:39 +01:00
John Wellbelove
399899bbe2 Updated version 2025-10-11 16:30:28 +01:00
John Wellbelove
3f7b18e3c2 Changed result of etl::is_constant_evaluated() in test_is_constant_evaluated from const to constexpr. 2025-10-11 11:41:02 +01:00
John Wellbelove
85678586c4 Merge branch 'pull-request/#1199-Added-support-for-transitions-on-state-enter-for-HFSM' into development 2025-10-11 11:01:53 +01:00
John Wellbelove
07894526e0 Added test_hfsm_recurse_to_inner_state_on_start.cpp to project 2025-10-11 11:01:35 +01:00
John Wellbelove
047071211c Merge branch 'pull-request/#1012-Implement-Signal' into development
# Conflicts:
#	test/vs2022/etl.vcxproj.filters
2025-10-11 10:51:19 +01:00
John Wellbelove
11c509bb44 Merge branch 'pull-request/#1196-Added-back-in-support-for-populating-non-8-bit-strings-with-8-bit-data' into development 2025-10-11 10:47:46 +01:00
John Wellbelove
b328d06746 Merge branch 'pull-request/#1198-Add-etl--is_constant_evaluated' into development 2025-10-11 10:35:38 +01:00
John Wellbelove
115e0e91a2 Removed redundant member function 2025-10-10 09:51:11 +01:00
John Wellbelove
6ab05a5d7e Rebased on development 2025-10-08 10:26:28 +01:00
John Wellbelove
fa10567482 Restore ETL_NOEXCEPT_FROM missing from merges 2025-10-08 10:25:45 +01:00
John Wellbelove
d14f7a66a9 Added and fixed noexcept attributes
Added ETL_NOEXCEPT_FROM to set noexcept attributes based on an object or function.

# Conflicts:
#	include/etl/platform.h
2025-10-08 10:25:44 +01:00
John Wellbelove
07734033d3 Minor layout changes 2025-10-08 10:25:44 +01:00
David Ockey
1ea45ff28e Added conditional support of noexcept to fix IAR support (#1195) 2025-10-08 10:25:43 +01:00
mike919192
99a33535d3 Vector checks (#1193)
* Add checks to vector and fix test failures

* Add tests to vector

* Add tests to external buffer and non trivial

* All tests should be implemented

* Add checks to vector_pointer and vector_pointer_ext

* Get bad iterators from a second vector
2025-10-08 10:25:42 +01:00
Igor Pugachev
d2e0b07791 fix variant_variadic documentation (#1194)
* fix variant_variadic default constructor documentation

* fix valueless doc
2025-10-08 10:25:42 +01:00
John Wellbelove
a25f195637 Renamed ETL_ASSERT_UNTYPED to ETL_ASSERT_GENERIC 2025-10-08 10:25:41 +01:00
John Wellbelove
d456c78589 Fixed indentation
Removed unused ETL_ASSERT
2025-10-08 10:25:18 +01:00
John Wellbelove
9c3e786509 Added missing CI scripts to the project 2025-10-08 10:25:18 +01:00
Christoph Rüthing
ad1679ff93 Introduce Cast to void for Condition of Assert (#1191)
* Removed ETL_NOEXCEPT from delegate operator(), call_if(), and call_or()

Removed ETL_NOEXCEPT from closureoperator(), call_if(), and call_or()

* Updated version and release notes

* Updated version and release notes

* Remove noexcept from delegate method stubs. (#1185)

In addition to removing noexcept from call_if, this is also needed to prevent
an abort when cancelling a pthread that is executing a delegate.

* Updated version and release notes

* Introduce Cast to void for Condition of Assert

Currently, in case we use a parameter of a function _only_ inside of an
ETL_ASSERT and the ETL configuration disables the ETL_ASSERT, we get a
compiler warning about an unused parameter. Therefore, this change casts
the condition of ETL_ASSERT to void.

* Use sizeof to avoid evaluation of Expression

In case we disable ASSERTs in e.g. non debug builds, we want to expand
it to "nothing", similar to how the std assert works. Introducing a cast
to void on the conidition would still evaluate it and potentially cause
side-effects. Therefore, we use the sizeof operator to ensure the
expression is not evaluated in case ASSERTs are disabled.

---------

Co-authored-by: John Wellbelove <john.wellbelove@asterconsulting.co.uk>
Co-authored-by: Marco Nilsson <marco@zyax.se>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2025-10-08 10:25:17 +01:00
Christoph Rüthing
9e0121125f Allow easy Creation of Generic Exceptions with just a Text (#1192)
* Removed ETL_NOEXCEPT from delegate operator(), call_if(), and call_or()

Removed ETL_NOEXCEPT from closureoperator(), call_if(), and call_or()

* Updated version and release notes

* Updated version and release notes

* Remove noexcept from delegate method stubs. (#1185)

In addition to removing noexcept from call_if, this is also needed to prevent
an abort when cancelling a pthread that is executing a delegate.

* Updated version and release notes

* Allow easy Creation of Generic Exceptions with just a Text

Today when using ETL_ASSERT you need to pass a concrete exception type.
However, it can be quite unhandy to define a custom exception type for
each assert, therefore we want to also allow to simply use the generic
etl::exception type and directly provide the message.

---------

Co-authored-by: John Wellbelove <john.wellbelove@asterconsulting.co.uk>
Co-authored-by: Marco Nilsson <marco@zyax.se>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2025-10-08 10:25:17 +01:00
Christoph Rüthing
32a2e78d79 Enforce Semicolon after ETL_ASSERT (#1190)
* Removed ETL_NOEXCEPT from delegate operator(), call_if(), and call_or()

Removed ETL_NOEXCEPT from closureoperator(), call_if(), and call_or()

* Updated version and release notes

* Updated version and release notes

* Remove noexcept from delegate method stubs. (#1185)

In addition to removing noexcept from call_if, this is also needed to prevent
an abort when cancelling a pthread that is executing a delegate.

* Updated version and release notes

* Enforce Semicolon after ETL_ASSERT

---------

Co-authored-by: John Wellbelove <john.wellbelove@asterconsulting.co.uk>
Co-authored-by: Marco Nilsson <marco@zyax.se>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2025-10-08 10:25:16 +01:00
John Wellbelove
a2415cc30f Removed #define ETL_DEBUG as this is a project define 2025-10-08 10:25:00 +01:00
mike919192
f2c33a4466 Debug assert (#1175)
* debug assert POC

* Swith to ETL_CONSTEXPR14

* Finish TODO checks

* First and last can be equal

* Add ETL_DEBUG_THROW_EXCEPTIONS

* Try allowing c++11 constexpr

* Add macro for throwing from c++11 constexpr

* Remove braces

* Add extra asserts in size_t overload functions

* Fill out debug asserts

* Line up comments
2025-10-08 10:24:59 +01:00
John Wellbelove
da5e42a4bc Moved and renamed common class to base 2025-10-08 10:23:32 +01:00
John Wellbelove
8dff499500 Added insert/remove tests 2025-10-08 10:23:32 +01:00
John Wellbelove
947f9e523b Changed timer to match the internal layout of other timers 2025-10-08 10:23:31 +01:00
John Wellbelove
21d7ebe879 Added insert and remove timer callback tests to test_message_timer_interrupt and test_message_timer_locked 2025-10-08 10:23:30 +01:00
Mario Luzeiro
793bafa1b4 Added callbacks when a timer is inserted or removed (#1155) 2025-10-08 10:23:30 +01:00
mike919192
c13d01319e etl array checks (#1188)
* Regression fix: Support zero arguments emplace() in etl::optional (#1183)

* Added coderabbitai configuration

* Added builtin mem function tests

* Modified etl::typed_storage

* Modified etl::typed_storage

# Conflicts:
#	include/etl/alignment.h

* Added ETL_NOEXCEPT and ETL_NOEXCEPT_IF_NO_THROW

* Added etl::typed_storage_ext and swap for same

* Added etl::typed_storage_ext and swap for same

# Conflicts:
#	include/etl/alignment.h

* Added release notes

* Fixes to GCC -O2 errors

* Changed char* parameters to value_type* parameters

* Fixed compilation issues for const containers unit tests

* Added automatic selection of __builtin_memxxx functions for GCC and clang

* Added enhanced coderabbit configuration

* Updated version and release notes

* Disabled constexpr const container tests for C++11

* Attempted fixes for MacOS compilation

* Attempted fixes for MacOS compilation

* Attempted fixes for MacOS compilation

* Attempted fixes for MacOS compilation

* Updated version and release notes

* feat: removed unreachable break statements (#1169)

* Updated version and release notes

* Modified etl::typed_storage

# Conflicts:
#	include/etl/alignment.h

* Support zero arguments emplace() in etl::optional

For non-fundamental types, a recent change in etl::optional was
introduced that doesn't support zero arguments emplace() anymore.

This change fixes it and adds the respective test.

---------

Co-authored-by: John Wellbelove <john.wellbelove@asterconsulting.co.uk>
Co-authored-by: Drew Rife <darife@jlg.com>

* Fix etl::typed_storage by supporting omitted destructors (#1182)

* Added coderabbitai configuration

* Added builtin mem function tests

* Modified etl::typed_storage

* Modified etl::typed_storage

# Conflicts:
#	include/etl/alignment.h

* Added ETL_NOEXCEPT and ETL_NOEXCEPT_IF_NO_THROW

* Added etl::typed_storage_ext and swap for same

* Added etl::typed_storage_ext and swap for same

# Conflicts:
#	include/etl/alignment.h

* Added release notes

* Fixes to GCC -O2 errors

* Changed char* parameters to value_type* parameters

* Fixed compilation issues for const containers unit tests

* Added automatic selection of __builtin_memxxx functions for GCC and clang

* Added enhanced coderabbit configuration

* Updated version and release notes

* Disabled constexpr const container tests for C++11

* Attempted fixes for MacOS compilation

* Attempted fixes for MacOS compilation

* Attempted fixes for MacOS compilation

* Attempted fixes for MacOS compilation

* Updated version and release notes

* feat: removed unreachable break statements (#1169)

* Updated version and release notes

* Modified etl::typed_storage

# Conflicts:
#	include/etl/alignment.h

* Fix etl::typed_storage by supporting omitted destructors

In a recent change to alignment.h, the etl::typed_storage was
changed in a way that in case of an already constructed object,
the object is created via assignment.

However, this contradicts the original use case that led to
etl::typed_storage in the first place:
https://github.com/ETLCPP/etl/pull/1023

The goal is to omit destructors (and at the same time support
classes with deleted assignment operators), so they can be optimized out
at link time.

This change reverts commit ac7b268 to restore the original
functionality and changes the test to reflect the original
use case.

* Fix missing create() in non-C++11 typed_storage_ext constructor

* Typo fix

---------

Co-authored-by: John Wellbelove <john.wellbelove@asterconsulting.co.uk>
Co-authored-by: Drew Rife <darife@jlg.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>

* removed navis file from project

* Updated version and release notes

* Removed forced unsigned int cast in type_def bit-shift operators (#1178)

* Removed UB in type_def bit-shift operators

* Changed shift operators to allow both signed and unsigned operands for shifts
This allows the library user to explicitly use unsigned values to avoid UB

* Fixed constexpr errors for CPP11

* Changed is_arithmetic checks to use is_integral since valid shifts require integral operands

* Removed need for CPP11 since changes are CPP03 compatible

* Delete project navis files

* Add force CI check on piull requests

* Removed ETL_NOEXCEPT from delegate operator(), call_if(), and call_or()

Removed ETL_NOEXCEPT from closureoperator(), call_if(), and call_or()

* Updated version and release notes

* Updated version and release notes

* Remove noexcept from delegate method stubs. (#1185)

In addition to removing noexcept from call_if, this is also needed to prevent
an abort when cancelling a pthread that is executing a delegate.

* Updated version and release notes

* Re architect the extra checks

* Add CHECK_EXTRA

* Fix newline at end of file

* The check index macro also needs to be defined to throw

* Remove ETL_VERBOSE_ERRORS macros

---------

Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>
Co-authored-by: John Wellbelove <john.wellbelove@asterconsulting.co.uk>
Co-authored-by: Drew Rife <darife@jlg.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
Co-authored-by: David Ockey <2897027+ockeydockey@users.noreply.github.com>
Co-authored-by: Marco Nilsson <marco@zyax.se>
2025-10-08 10:22:54 +01:00
John Wellbelove
df6b0b20c8 Modified to use new ETL_ASSERTs 2025-10-08 10:22:54 +01:00
John Wellbelove
abc2735504 Added more ETL_NOEXCEPT to etl::array 2025-10-08 10:22:15 +01:00
John Wellbelove
da32625f10 Removed #define ETL_DEBUG as this is a project define 2025-10-08 10:22:14 +01:00
mike919192
5b76824c61 Debug assert (#1175)
* debug assert POC

* Swith to ETL_CONSTEXPR14

* Finish TODO checks

* First and last can be equal

* Add ETL_DEBUG_THROW_EXCEPTIONS

* Try allowing c++11 constexpr

* Add macro for throwing from c++11 constexpr

* Remove braces

* Add extra asserts in size_t overload functions

* Fill out debug asserts

* Line up comments
2025-10-08 10:21:14 +01:00
David Ockey
f9982a6fde
Added back in support for populating non 8-bit strings with 8-bit data (#1196)
* Fixed ability to populate 16-bit strings with 8-bit data

* Added more unit tests

* Fixed C++11 build errors

* Changed testing to accommodate C++11 better

* Cleaned up comments

* Cleaned up tests to be more consistent

* Make template matches mutually exclusive to prevent ambiguous behavior

* Added changes to u32 and wchar strings

* Changed const range tests to use const string
2025-10-08 09:39:26 +01:00
Roland Reichwein
05731c2786
Add etl::is_constant_evaluated (#1198)
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2025-10-08 09:32:43 +01:00
David Ockey
86b9e0903f
Added support for transitions on state enter for HFSM (#1199)
* Added support for transitions on state enter for HFSM

* Fixed unit test build error

* Comment clean-up

* Changed FSM so that self-transitions can also transition "on enter"

* Fixing C++03 build error for clang
2025-10-08 08:43:09 +01:00
John Wellbelove
85fc48302d Merge branch 'pull-request/#1188-etl-array-checks' into development 2025-10-04 08:08:10 +01:00
John Wellbelove
421edaf165 Merge branch 'pull-request/#1195-Added-conditional-support-of-noexcept-to-fix-IAR-support' into development 2025-10-04 08:07:47 +01:00
John Wellbelove
2c170118ff Merge branch 'pull-request/#1188-etl-array-checks' of https://github.com/ETLCPP/etl into pull-request/#1188-etl-array-checks 2025-10-04 08:05:58 +01:00
John Wellbelove
d21b0a27f0 Restore ETL_NOEXCEPT_FROM missing from merges 2025-10-04 08:02:56 +01:00
John Wellbelove
ed718a97e9 Added and fixed noexcept attributes
Added ETL_NOEXCEPT_FROM to set noexcept attributes based on an object or function.

# Conflicts:
#	include/etl/platform.h
2025-10-04 08:02:55 +01:00
mike919192
24e603b27d Vector checks (#1193)
* Add checks to vector and fix test failures

* Add tests to vector

* Add tests to external buffer and non trivial

* All tests should be implemented

* Add checks to vector_pointer and vector_pointer_ext

* Get bad iterators from a second vector
2025-10-04 08:02:54 +01:00
Igor Pugachev
e1126aafd2 fix variant_variadic documentation (#1194)
* fix variant_variadic default constructor documentation

* fix valueless doc
2025-10-04 08:02:54 +01:00
John Wellbelove
27a19f5c52 Restore ETL_NOEXCEPT_FROM missing from merges 2025-10-04 08:02:17 +01:00
John Wellbelove
d0feb3d175 Added and fixed noexcept attributes
Added ETL_NOEXCEPT_FROM to set noexcept attributes based on an object or function.

# Conflicts:
#	include/etl/platform.h
2025-10-03 10:49:43 +01:00
John Wellbelove
b90bcaaaab Minor layout changes 2025-10-03 10:49:25 +01:00
David Ockey
0323dabeff Added conditional support of noexcept to fix IAR support (#1195) 2025-10-03 10:49:24 +01:00
mike919192
2bf512dd42 Vector checks (#1193)
* Add checks to vector and fix test failures

* Add tests to vector

* Add tests to external buffer and non trivial

* All tests should be implemented

* Add checks to vector_pointer and vector_pointer_ext

* Get bad iterators from a second vector
2025-10-03 10:49:23 +01:00
John Wellbelove
b38feb17b5 Minor layout changes 2025-10-03 10:18:21 +01:00
mike919192
44e7516278
Vector checks (#1193)
* Add checks to vector and fix test failures

* Add tests to vector

* Add tests to external buffer and non trivial

* All tests should be implemented

* Add checks to vector_pointer and vector_pointer_ext

* Get bad iterators from a second vector
2025-10-03 10:10:15 +01:00
Igor Pugachev
077590838b
fix variant_variadic documentation (#1194)
* fix variant_variadic default constructor documentation

* fix valueless doc
2025-10-03 08:54:12 +01:00
David Ockey
15cbb12e4b
Added conditional support of noexcept to fix IAR support (#1195) 2025-10-03 08:44:16 +01:00
John Wellbelove
bcf7a95bb6 Renamed ETL_ASSERT_UNTYPED to ETL_ASSERT_GENERIC 2025-10-02 08:28:50 +01:00
John Wellbelove
a9265b1a71 Merge branch 'pull-request/#1191-Introduce-Cast-to-void-for-Condition-of-Assert' into development
# Conflicts:
#	include/etl/error_handler.h
2025-10-02 08:15:17 +01:00
John Wellbelove
f7cdf1bc3f Fixed indentation
Removed unused ETL_ASSERT
2025-10-02 07:45:54 +01:00
John Wellbelove
07bf063daa Added missing CI scripts to the project 2025-10-01 18:58:33 +01:00
Christoph Rüthing
018c7ce849
Introduce Cast to void for Condition of Assert (#1191)
* Removed ETL_NOEXCEPT from delegate operator(), call_if(), and call_or()

Removed ETL_NOEXCEPT from closureoperator(), call_if(), and call_or()

* Updated version and release notes

* Updated version and release notes

* Remove noexcept from delegate method stubs. (#1185)

In addition to removing noexcept from call_if, this is also needed to prevent
an abort when cancelling a pthread that is executing a delegate.

* Updated version and release notes

* Introduce Cast to void for Condition of Assert

Currently, in case we use a parameter of a function _only_ inside of an
ETL_ASSERT and the ETL configuration disables the ETL_ASSERT, we get a
compiler warning about an unused parameter. Therefore, this change casts
the condition of ETL_ASSERT to void.

* Use sizeof to avoid evaluation of Expression

In case we disable ASSERTs in e.g. non debug builds, we want to expand
it to "nothing", similar to how the std assert works. Introducing a cast
to void on the conidition would still evaluate it and potentially cause
side-effects. Therefore, we use the sizeof operator to ensure the
expression is not evaluated in case ASSERTs are disabled.

---------

Co-authored-by: John Wellbelove <john.wellbelove@asterconsulting.co.uk>
Co-authored-by: Marco Nilsson <marco@zyax.se>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2025-10-01 18:43:52 +01:00
Christoph Rüthing
4cbc601a69
Allow easy Creation of Generic Exceptions with just a Text (#1192)
* Removed ETL_NOEXCEPT from delegate operator(), call_if(), and call_or()

Removed ETL_NOEXCEPT from closureoperator(), call_if(), and call_or()

* Updated version and release notes

* Updated version and release notes

* Remove noexcept from delegate method stubs. (#1185)

In addition to removing noexcept from call_if, this is also needed to prevent
an abort when cancelling a pthread that is executing a delegate.

* Updated version and release notes

* Allow easy Creation of Generic Exceptions with just a Text

Today when using ETL_ASSERT you need to pass a concrete exception type.
However, it can be quite unhandy to define a custom exception type for
each assert, therefore we want to also allow to simply use the generic
etl::exception type and directly provide the message.

---------

Co-authored-by: John Wellbelove <john.wellbelove@asterconsulting.co.uk>
Co-authored-by: Marco Nilsson <marco@zyax.se>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2025-09-28 11:10:50 +01:00
Christoph Rüthing
813e26e3b4
Enforce Semicolon after ETL_ASSERT (#1190)
* Removed ETL_NOEXCEPT from delegate operator(), call_if(), and call_or()

Removed ETL_NOEXCEPT from closureoperator(), call_if(), and call_or()

* Updated version and release notes

* Updated version and release notes

* Remove noexcept from delegate method stubs. (#1185)

In addition to removing noexcept from call_if, this is also needed to prevent
an abort when cancelling a pthread that is executing a delegate.

* Updated version and release notes

* Enforce Semicolon after ETL_ASSERT

---------

Co-authored-by: John Wellbelove <john.wellbelove@asterconsulting.co.uk>
Co-authored-by: Marco Nilsson <marco@zyax.se>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2025-09-27 10:28:57 +01:00
mike919192
4cf522ed46 etl array checks (#1188)
* Regression fix: Support zero arguments emplace() in etl::optional (#1183)

* Added coderabbitai configuration

* Added builtin mem function tests

* Modified etl::typed_storage

* Modified etl::typed_storage

# Conflicts:
#	include/etl/alignment.h

* Added ETL_NOEXCEPT and ETL_NOEXCEPT_IF_NO_THROW

* Added etl::typed_storage_ext and swap for same

* Added etl::typed_storage_ext and swap for same

# Conflicts:
#	include/etl/alignment.h

* Added release notes

* Fixes to GCC -O2 errors

* Changed char* parameters to value_type* parameters

* Fixed compilation issues for const containers unit tests

* Added automatic selection of __builtin_memxxx functions for GCC and clang

* Added enhanced coderabbit configuration

* Updated version and release notes

* Disabled constexpr const container tests for C++11

* Attempted fixes for MacOS compilation

* Attempted fixes for MacOS compilation

* Attempted fixes for MacOS compilation

* Attempted fixes for MacOS compilation

* Updated version and release notes

* feat: removed unreachable break statements (#1169)

* Updated version and release notes

* Modified etl::typed_storage

# Conflicts:
#	include/etl/alignment.h

* Support zero arguments emplace() in etl::optional

For non-fundamental types, a recent change in etl::optional was
introduced that doesn't support zero arguments emplace() anymore.

This change fixes it and adds the respective test.

---------

Co-authored-by: John Wellbelove <john.wellbelove@asterconsulting.co.uk>
Co-authored-by: Drew Rife <darife@jlg.com>

* Fix etl::typed_storage by supporting omitted destructors (#1182)

* Added coderabbitai configuration

* Added builtin mem function tests

* Modified etl::typed_storage

* Modified etl::typed_storage

# Conflicts:
#	include/etl/alignment.h

* Added ETL_NOEXCEPT and ETL_NOEXCEPT_IF_NO_THROW

* Added etl::typed_storage_ext and swap for same

* Added etl::typed_storage_ext and swap for same

# Conflicts:
#	include/etl/alignment.h

* Added release notes

* Fixes to GCC -O2 errors

* Changed char* parameters to value_type* parameters

* Fixed compilation issues for const containers unit tests

* Added automatic selection of __builtin_memxxx functions for GCC and clang

* Added enhanced coderabbit configuration

* Updated version and release notes

* Disabled constexpr const container tests for C++11

* Attempted fixes for MacOS compilation

* Attempted fixes for MacOS compilation

* Attempted fixes for MacOS compilation

* Attempted fixes for MacOS compilation

* Updated version and release notes

* feat: removed unreachable break statements (#1169)

* Updated version and release notes

* Modified etl::typed_storage

# Conflicts:
#	include/etl/alignment.h

* Fix etl::typed_storage by supporting omitted destructors

In a recent change to alignment.h, the etl::typed_storage was
changed in a way that in case of an already constructed object,
the object is created via assignment.

However, this contradicts the original use case that led to
etl::typed_storage in the first place:
https://github.com/ETLCPP/etl/pull/1023

The goal is to omit destructors (and at the same time support
classes with deleted assignment operators), so they can be optimized out
at link time.

This change reverts commit ac7b268 to restore the original
functionality and changes the test to reflect the original
use case.

* Fix missing create() in non-C++11 typed_storage_ext constructor

* Typo fix

---------

Co-authored-by: John Wellbelove <john.wellbelove@asterconsulting.co.uk>
Co-authored-by: Drew Rife <darife@jlg.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>

* removed navis file from project

* Updated version and release notes

* Removed forced unsigned int cast in type_def bit-shift operators (#1178)

* Removed UB in type_def bit-shift operators

* Changed shift operators to allow both signed and unsigned operands for shifts
This allows the library user to explicitly use unsigned values to avoid UB

* Fixed constexpr errors for CPP11

* Changed is_arithmetic checks to use is_integral since valid shifts require integral operands

* Removed need for CPP11 since changes are CPP03 compatible

* Delete project navis files

* Add force CI check on piull requests

* Removed ETL_NOEXCEPT from delegate operator(), call_if(), and call_or()

Removed ETL_NOEXCEPT from closureoperator(), call_if(), and call_or()

* Updated version and release notes

* Updated version and release notes

* Remove noexcept from delegate method stubs. (#1185)

In addition to removing noexcept from call_if, this is also needed to prevent
an abort when cancelling a pthread that is executing a delegate.

* Updated version and release notes

* Re architect the extra checks

* Add CHECK_EXTRA

* Fix newline at end of file

* The check index macro also needs to be defined to throw

* Remove ETL_VERBOSE_ERRORS macros

---------

Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>
Co-authored-by: John Wellbelove <john.wellbelove@asterconsulting.co.uk>
Co-authored-by: Drew Rife <darife@jlg.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
Co-authored-by: David Ockey <2897027+ockeydockey@users.noreply.github.com>
Co-authored-by: Marco Nilsson <marco@zyax.se>
2025-09-26 09:57:00 +01:00
John Wellbelove
69c3f74b0f Modified to use new ETL_ASSERTs 2025-09-26 09:56:59 +01:00
John Wellbelove
5ac8070a8c Added more ETL_NOEXCEPT to etl::array 2025-09-26 09:56:59 +01:00
John Wellbelove
972aedd944 Removed #define ETL_DEBUG as this is a project define 2025-09-26 09:56:58 +01:00
mike919192
fbb92f85fc Debug assert (#1175)
* debug assert POC

* Swith to ETL_CONSTEXPR14

* Finish TODO checks

* First and last can be equal

* Add ETL_DEBUG_THROW_EXCEPTIONS

* Try allowing c++11 constexpr

* Add macro for throwing from c++11 constexpr

* Remove braces

* Add extra asserts in size_t overload functions

* Fill out debug asserts

* Line up comments
2025-09-26 09:55:40 +01:00
John Wellbelove
5face0d8f2 Updated version and release notes
# Conflicts:
#	support/Release notes.txt
2025-09-26 09:54:59 +01:00
John Wellbelove
1b5ff74a3d Fixed spelling of gdc to gcd 2025-09-26 09:53:49 +01:00
John Wellbelove
081b693e0b Merge branch 'pull-request/#1188-etl-array-checks' into development 2025-09-25 09:26:33 +01:00
mike919192
3295cb30ca
etl array checks (#1188)
* Regression fix: Support zero arguments emplace() in etl::optional (#1183)

* Added coderabbitai configuration

* Added builtin mem function tests

* Modified etl::typed_storage

* Modified etl::typed_storage

# Conflicts:
#	include/etl/alignment.h

* Added ETL_NOEXCEPT and ETL_NOEXCEPT_IF_NO_THROW

* Added etl::typed_storage_ext and swap for same

* Added etl::typed_storage_ext and swap for same

# Conflicts:
#	include/etl/alignment.h

* Added release notes

* Fixes to GCC -O2 errors

* Changed char* parameters to value_type* parameters

* Fixed compilation issues for const containers unit tests

* Added automatic selection of __builtin_memxxx functions for GCC and clang

* Added enhanced coderabbit configuration

* Updated version and release notes

* Disabled constexpr const container tests for C++11

* Attempted fixes for MacOS compilation

* Attempted fixes for MacOS compilation

* Attempted fixes for MacOS compilation

* Attempted fixes for MacOS compilation

* Updated version and release notes

* feat: removed unreachable break statements (#1169)

* Updated version and release notes

* Modified etl::typed_storage

# Conflicts:
#	include/etl/alignment.h

* Support zero arguments emplace() in etl::optional

For non-fundamental types, a recent change in etl::optional was
introduced that doesn't support zero arguments emplace() anymore.

This change fixes it and adds the respective test.

---------

Co-authored-by: John Wellbelove <john.wellbelove@asterconsulting.co.uk>
Co-authored-by: Drew Rife <darife@jlg.com>

* Fix etl::typed_storage by supporting omitted destructors (#1182)

* Added coderabbitai configuration

* Added builtin mem function tests

* Modified etl::typed_storage

* Modified etl::typed_storage

# Conflicts:
#	include/etl/alignment.h

* Added ETL_NOEXCEPT and ETL_NOEXCEPT_IF_NO_THROW

* Added etl::typed_storage_ext and swap for same

* Added etl::typed_storage_ext and swap for same

# Conflicts:
#	include/etl/alignment.h

* Added release notes

* Fixes to GCC -O2 errors

* Changed char* parameters to value_type* parameters

* Fixed compilation issues for const containers unit tests

* Added automatic selection of __builtin_memxxx functions for GCC and clang

* Added enhanced coderabbit configuration

* Updated version and release notes

* Disabled constexpr const container tests for C++11

* Attempted fixes for MacOS compilation

* Attempted fixes for MacOS compilation

* Attempted fixes for MacOS compilation

* Attempted fixes for MacOS compilation

* Updated version and release notes

* feat: removed unreachable break statements (#1169)

* Updated version and release notes

* Modified etl::typed_storage

# Conflicts:
#	include/etl/alignment.h

* Fix etl::typed_storage by supporting omitted destructors

In a recent change to alignment.h, the etl::typed_storage was
changed in a way that in case of an already constructed object,
the object is created via assignment.

However, this contradicts the original use case that led to
etl::typed_storage in the first place:
https://github.com/ETLCPP/etl/pull/1023

The goal is to omit destructors (and at the same time support
classes with deleted assignment operators), so they can be optimized out
at link time.

This change reverts commit ac7b268 to restore the original
functionality and changes the test to reflect the original
use case.

* Fix missing create() in non-C++11 typed_storage_ext constructor

* Typo fix

---------

Co-authored-by: John Wellbelove <john.wellbelove@asterconsulting.co.uk>
Co-authored-by: Drew Rife <darife@jlg.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>

* removed navis file from project

* Updated version and release notes

* Removed forced unsigned int cast in type_def bit-shift operators (#1178)

* Removed UB in type_def bit-shift operators

* Changed shift operators to allow both signed and unsigned operands for shifts
This allows the library user to explicitly use unsigned values to avoid UB

* Fixed constexpr errors for CPP11

* Changed is_arithmetic checks to use is_integral since valid shifts require integral operands

* Removed need for CPP11 since changes are CPP03 compatible

* Delete project navis files

* Add force CI check on piull requests

* Removed ETL_NOEXCEPT from delegate operator(), call_if(), and call_or()

Removed ETL_NOEXCEPT from closureoperator(), call_if(), and call_or()

* Updated version and release notes

* Updated version and release notes

* Remove noexcept from delegate method stubs. (#1185)

In addition to removing noexcept from call_if, this is also needed to prevent
an abort when cancelling a pthread that is executing a delegate.

* Updated version and release notes

* Re architect the extra checks

* Add CHECK_EXTRA

* Fix newline at end of file

* The check index macro also needs to be defined to throw

* Remove ETL_VERBOSE_ERRORS macros

---------

Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>
Co-authored-by: John Wellbelove <john.wellbelove@asterconsulting.co.uk>
Co-authored-by: Drew Rife <darife@jlg.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
Co-authored-by: David Ockey <2897027+ockeydockey@users.noreply.github.com>
Co-authored-by: Marco Nilsson <marco@zyax.se>
2025-09-23 16:26:19 +01:00
John Wellbelove
e88a74362b Modified to use new ETL_ASSERTs 2025-09-22 10:41:50 +01:00
John Wellbelove
cc62f212ab Rebased on development 2025-09-21 10:06:12 +01:00
John Wellbelove
62b5a4a6ae Rebased on development 2025-09-20 11:25:09 +01:00
John Wellbelove
1da478fa60 Merge branch 'hotfix/#1181-Compilation-errors-on-basic_string' into development
# Conflicts:
#	include/etl/optional.h
#	support/Release notes.txt
2025-09-18 09:09:53 +01:00
John Wellbelove
bc78ebb72e Fixed spelling of gdc to gcd 2025-09-18 09:07:34 +01:00
Roland Reichwein
16060ee0ae Guards around usage of std::initializer_list in optional.h (#1186)
* Guards around usage of std::initializer_list in optional.h

In optional.h, ETL_HAS_INITIALIZER_LIST is being used to
guard against cases where std::initializer_list is not available.
But not consistently. This changes fixes it by adding it in the
remaining places.

* Fixed #undef in optional.h

Instead of undefining ETL_OPTIONAL_ENABLE_CONSTEXPR_BOOL_RETURN_CPP14,
ETL_OPTIONAL_ENABLE_CONSTEXPR_BOOL_RETURN_CPP20_STL was undefined twice
(one of the misspelled).

* Fix comment typos
2025-09-18 09:01:25 +01:00
Roland Reichwein
191d4fb0f0 Guards around usage of std::initializer_list in optional.h (#1186)
* Guards around usage of std::initializer_list in optional.h

In optional.h, ETL_HAS_INITIALIZER_LIST is being used to
guard against cases where std::initializer_list is not available.
But not consistently. This changes fixes it by adding it in the
remaining places.

* Fixed #undef in optional.h

Instead of undefining ETL_OPTIONAL_ENABLE_CONSTEXPR_BOOL_RETURN_CPP14,
ETL_OPTIONAL_ENABLE_CONSTEXPR_BOOL_RETURN_CPP20_STL was undefined twice
(one of the misspelled).

* Fix comment typos
2025-09-18 08:52:30 +01:00
John Wellbelove
cabfa28401 Updated version and release notes 2025-09-18 08:52:30 +01:00
Marco Nilsson
9f7e4abd42 Remove noexcept from delegate method stubs. (#1185)
In addition to removing noexcept from call_if, this is also needed to prevent
an abort when cancelling a pthread that is executing a delegate.
2025-09-18 08:52:29 +01:00
John Wellbelove
f5bdca7216 Updated version and release notes 2025-09-18 08:52:28 +01:00
John Wellbelove
8ed8a47c55 Updated version and release notes 2025-09-18 08:52:28 +01:00
John Wellbelove
88e2aaeec0 Removed ETL_NOEXCEPT from delegate operator(), call_if(), and call_or()
Removed ETL_NOEXCEPT from closureoperator(), call_if(), and call_or()
2025-09-18 08:52:27 +01:00
Roland Reichwein
a21b96396e Guards around usage of std::initializer_list in optional.h (#1186)
* Guards around usage of std::initializer_list in optional.h

In optional.h, ETL_HAS_INITIALIZER_LIST is being used to
guard against cases where std::initializer_list is not available.
But not consistently. This changes fixes it by adding it in the
remaining places.

* Fixed #undef in optional.h

Instead of undefining ETL_OPTIONAL_ENABLE_CONSTEXPR_BOOL_RETURN_CPP14,
ETL_OPTIONAL_ENABLE_CONSTEXPR_BOOL_RETURN_CPP20_STL was undefined twice
(one of the misspelled).

* Fix comment typos
2025-09-18 08:50:28 +01:00
John Wellbelove
e4117e9eb4 Updated version and release notes 2025-09-18 08:50:27 +01:00
Marco Nilsson
c80939759c Remove noexcept from delegate method stubs. (#1185)
In addition to removing noexcept from call_if, this is also needed to prevent
an abort when cancelling a pthread that is executing a delegate.
2025-09-18 08:50:26 +01:00
John Wellbelove
df6d3b8f02 Updated version and release notes 2025-09-18 08:50:25 +01:00
John Wellbelove
5177f69994 Updated version and release notes 2025-09-18 08:50:25 +01:00
John Wellbelove
7a2c918b1e Removed ETL_NOEXCEPT from delegate operator(), call_if(), and call_or()
Removed ETL_NOEXCEPT from closureoperator(), call_if(), and call_or()
2025-09-18 08:50:24 +01:00
John Wellbelove
294720937f Added and fixed noexcept attributes
Added ETL_NOEXCEPT_FROM to set noexcept attributes based on an object or function.
2025-09-17 20:44:52 +01:00
Roland Reichwein
9028cf09b3
Guards around usage of std::initializer_list in optional.h (#1186)
* Guards around usage of std::initializer_list in optional.h

In optional.h, ETL_HAS_INITIALIZER_LIST is being used to
guard against cases where std::initializer_list is not available.
But not consistently. This changes fixes it by adding it in the
remaining places.

* Fixed #undef in optional.h

Instead of undefining ETL_OPTIONAL_ENABLE_CONSTEXPR_BOOL_RETURN_CPP14,
ETL_OPTIONAL_ENABLE_CONSTEXPR_BOOL_RETURN_CPP20_STL was undefined twice
(one of the misspelled).

* Fix comment typos
2025-09-17 20:16:57 +01:00
John Wellbelove
f9cf20d79a Updated version and release notes 2025-09-13 08:28:22 +01:00
Marco Nilsson
18caa159ac
Remove noexcept from delegate method stubs. (#1185)
In addition to removing noexcept from call_if, this is also needed to prevent
an abort when cancelling a pthread that is executing a delegate.
2025-09-13 08:23:15 +01:00
John Wellbelove
c2e7e8aca9 Updated version and release notes 2025-09-12 20:38:41 +01:00
John Wellbelove
54ba9a8aea Updated version and release notes 2025-09-12 20:20:19 +01:00
John Wellbelove
5c91f8b573 Removed ETL_NOEXCEPT from delegate operator(), call_if(), and call_or()
Removed ETL_NOEXCEPT from closureoperator(), call_if(), and call_or()
2025-09-12 20:19:27 +01:00
John Wellbelove
9a9a96f5c5 Moved and renamed common class to base 2025-09-12 12:48:18 +01:00
John Wellbelove
fd7edc937d Added insert/remove tests 2025-09-12 12:47:51 +01:00
John Wellbelove
4165448282 Changed timer to match the internal layout of other timers 2025-09-12 12:47:18 +01:00
John Wellbelove
95ff22821c Added more ETL_NOEXCEPT to etl::array 2025-09-11 19:57:19 +01:00
John Wellbelove
5dfdea7115 Removed #define ETL_DEBUG as this is a project define 2025-09-11 19:57:18 +01:00
John Wellbelove
59ec7855c1 Add force CI check on piull requests 2025-09-11 19:57:18 +01:00
John Wellbelove
bc027139e2 Delete project navis files 2025-09-11 19:57:17 +01:00
David Ockey
042a62154e Removed forced unsigned int cast in type_def bit-shift operators (#1178)
* Removed UB in type_def bit-shift operators

* Changed shift operators to allow both signed and unsigned operands for shifts
This allows the library user to explicitly use unsigned values to avoid UB

* Fixed constexpr errors for CPP11

* Changed is_arithmetic checks to use is_integral since valid shifts require integral operands

* Removed need for CPP11 since changes are CPP03 compatible
2025-09-11 19:57:16 +01:00
John Wellbelove
b5e065e1c8 Updated version and release notes 2025-09-11 19:57:16 +01:00
Roland Reichwein
193b6ba3e8 Fix etl::typed_storage by supporting omitted destructors (#1182)
* Added coderabbitai configuration

* Added builtin mem function tests

* Modified etl::typed_storage

* Modified etl::typed_storage

# Conflicts:
#	include/etl/alignment.h

* Added ETL_NOEXCEPT and ETL_NOEXCEPT_IF_NO_THROW

* Added etl::typed_storage_ext and swap for same

* Added etl::typed_storage_ext and swap for same

# Conflicts:
#	include/etl/alignment.h

* Added release notes

* Fixes to GCC -O2 errors

* Changed char* parameters to value_type* parameters

* Fixed compilation issues for const containers unit tests

* Added automatic selection of __builtin_memxxx functions for GCC and clang

* Added enhanced coderabbit configuration

* Updated version and release notes

* Disabled constexpr const container tests for C++11

* Attempted fixes for MacOS compilation

* Attempted fixes for MacOS compilation

* Attempted fixes for MacOS compilation

* Attempted fixes for MacOS compilation

* Updated version and release notes

* feat: removed unreachable break statements (#1169)

* Updated version and release notes

* Modified etl::typed_storage

# Conflicts:
#	include/etl/alignment.h

* Fix etl::typed_storage by supporting omitted destructors

In a recent change to alignment.h, the etl::typed_storage was
changed in a way that in case of an already constructed object,
the object is created via assignment.

However, this contradicts the original use case that led to
etl::typed_storage in the first place:
https://github.com/ETLCPP/etl/pull/1023

The goal is to omit destructors (and at the same time support
classes with deleted assignment operators), so they can be optimized out
at link time.

This change reverts commit ac7b268 to restore the original
functionality and changes the test to reflect the original
use case.

* Fix missing create() in non-C++11 typed_storage_ext constructor

* Typo fix

---------

Co-authored-by: John Wellbelove <john.wellbelove@asterconsulting.co.uk>
Co-authored-by: Drew Rife <darife@jlg.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2025-09-11 19:57:15 +01:00
Roland Reichwein
ea91dabee5 Regression fix: Support zero arguments emplace() in etl::optional (#1183)
* Added coderabbitai configuration

* Added builtin mem function tests

* Modified etl::typed_storage

* Modified etl::typed_storage

# Conflicts:
#	include/etl/alignment.h

* Added ETL_NOEXCEPT and ETL_NOEXCEPT_IF_NO_THROW

* Added etl::typed_storage_ext and swap for same

* Added etl::typed_storage_ext and swap for same

# Conflicts:
#	include/etl/alignment.h

* Added release notes

* Fixes to GCC -O2 errors

* Changed char* parameters to value_type* parameters

* Fixed compilation issues for const containers unit tests

* Added automatic selection of __builtin_memxxx functions for GCC and clang

* Added enhanced coderabbit configuration

* Updated version and release notes

* Disabled constexpr const container tests for C++11

* Attempted fixes for MacOS compilation

* Attempted fixes for MacOS compilation

* Attempted fixes for MacOS compilation

* Attempted fixes for MacOS compilation

* Updated version and release notes

* feat: removed unreachable break statements (#1169)

* Updated version and release notes

* Modified etl::typed_storage

# Conflicts:
#	include/etl/alignment.h

* Support zero arguments emplace() in etl::optional

For non-fundamental types, a recent change in etl::optional was
introduced that doesn't support zero arguments emplace() anymore.

This change fixes it and adds the respective test.

---------

Co-authored-by: John Wellbelove <john.wellbelove@asterconsulting.co.uk>
Co-authored-by: Drew Rife <darife@jlg.com>
2025-09-11 19:57:15 +01:00
John Wellbelove
df30de2877 removed navis file from project 2025-09-11 19:57:14 +01:00
John Wellbelove
91aa52988b Added insert and remove timer callback tests to test_message_timer_interrupt and test_message_timer_locked 2025-09-11 19:28:03 +01:00
John Wellbelove
14c9e9d48e Merge branch 'pull-request/#1155-Added-callbacks-when-a-timer-is-inserted-or-removed' of https://github.com/ETLCPP/etl into pull-request/#1155-Added-callbacks-when-a-timer-is-inserted-or-removed 2025-09-11 18:39:12 +01:00
Mario Luzeiro
5f70befa4a
Added callbacks when a timer is inserted or removed (#1155) 2025-09-11 18:38:48 +01:00
John Wellbelove
73cf38cc57 Merge branch 'pull-request/#1155-Added-callbacks-when-a-timer-is-inserted-or-removed' of https://github.com/ETLCPP/etl into pull-request/#1155-Added-callbacks-when-a-timer-is-inserted-or-removed
# Conflicts:
#	test/vs2022/etl.vcxproj.filters
2025-09-11 18:27:54 +01:00
John Wellbelove
96201f7919 Add force CI check on piull requests 2025-09-11 18:21:54 +01:00
John Wellbelove
96f494aeae Delete project navis files 2025-09-11 18:21:10 +01:00
David Ockey
603c977733
Removed forced unsigned int cast in type_def bit-shift operators (#1178)
* Removed UB in type_def bit-shift operators

* Changed shift operators to allow both signed and unsigned operands for shifts
This allows the library user to explicitly use unsigned values to avoid UB

* Fixed constexpr errors for CPP11

* Changed is_arithmetic checks to use is_integral since valid shifts require integral operands

* Removed need for CPP11 since changes are CPP03 compatible
2025-09-11 16:23:50 +01:00
John Wellbelove
db57df1e41 Merge branch 'development'
# Conflicts:
#	include/etl/alignment.h
2025-09-10 20:54:48 +01:00
John Wellbelove
476c965a1f Updated version and release notes 2025-09-10 20:52:16 +01:00
mike919192
999c210d28
Debug assert (#1175)
* debug assert POC

* Swith to ETL_CONSTEXPR14

* Finish TODO checks

* First and last can be equal

* Add ETL_DEBUG_THROW_EXCEPTIONS

* Try allowing c++11 constexpr

* Add macro for throwing from c++11 constexpr

* Remove braces

* Add extra asserts in size_t overload functions

* Fill out debug asserts

* Line up comments
2025-09-10 10:52:22 +01:00
John Wellbelove
5add8a94a7 Merge branch 'development' of https://github.com/ETLCPP/etl into development 2025-09-10 10:50:09 +01:00
John Wellbelove
02853e5bb6 removed navis file from project 2025-09-10 10:50:02 +01:00
Roland Reichwein
d6d78eb8bd
Fix etl::typed_storage by supporting omitted destructors (#1182)
* Added coderabbitai configuration

* Added builtin mem function tests

* Modified etl::typed_storage

* Modified etl::typed_storage

# Conflicts:
#	include/etl/alignment.h

* Added ETL_NOEXCEPT and ETL_NOEXCEPT_IF_NO_THROW

* Added etl::typed_storage_ext and swap for same

* Added etl::typed_storage_ext and swap for same

# Conflicts:
#	include/etl/alignment.h

* Added release notes

* Fixes to GCC -O2 errors

* Changed char* parameters to value_type* parameters

* Fixed compilation issues for const containers unit tests

* Added automatic selection of __builtin_memxxx functions for GCC and clang

* Added enhanced coderabbit configuration

* Updated version and release notes

* Disabled constexpr const container tests for C++11

* Attempted fixes for MacOS compilation

* Attempted fixes for MacOS compilation

* Attempted fixes for MacOS compilation

* Attempted fixes for MacOS compilation

* Updated version and release notes

* feat: removed unreachable break statements (#1169)

* Updated version and release notes

* Modified etl::typed_storage

# Conflicts:
#	include/etl/alignment.h

* Fix etl::typed_storage by supporting omitted destructors

In a recent change to alignment.h, the etl::typed_storage was
changed in a way that in case of an already constructed object,
the object is created via assignment.

However, this contradicts the original use case that led to
etl::typed_storage in the first place:
https://github.com/ETLCPP/etl/pull/1023

The goal is to omit destructors (and at the same time support
classes with deleted assignment operators), so they can be optimized out
at link time.

This change reverts commit ac7b268 to restore the original
functionality and changes the test to reflect the original
use case.

* Fix missing create() in non-C++11 typed_storage_ext constructor

* Typo fix

---------

Co-authored-by: John Wellbelove <john.wellbelove@asterconsulting.co.uk>
Co-authored-by: Drew Rife <darife@jlg.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2025-09-10 10:41:09 +01:00
Roland Reichwein
75606fc079
Regression fix: Support zero arguments emplace() in etl::optional (#1183)
* Added coderabbitai configuration

* Added builtin mem function tests

* Modified etl::typed_storage

* Modified etl::typed_storage

# Conflicts:
#	include/etl/alignment.h

* Added ETL_NOEXCEPT and ETL_NOEXCEPT_IF_NO_THROW

* Added etl::typed_storage_ext and swap for same

* Added etl::typed_storage_ext and swap for same

# Conflicts:
#	include/etl/alignment.h

* Added release notes

* Fixes to GCC -O2 errors

* Changed char* parameters to value_type* parameters

* Fixed compilation issues for const containers unit tests

* Added automatic selection of __builtin_memxxx functions for GCC and clang

* Added enhanced coderabbit configuration

* Updated version and release notes

* Disabled constexpr const container tests for C++11

* Attempted fixes for MacOS compilation

* Attempted fixes for MacOS compilation

* Attempted fixes for MacOS compilation

* Attempted fixes for MacOS compilation

* Updated version and release notes

* feat: removed unreachable break statements (#1169)

* Updated version and release notes

* Modified etl::typed_storage

# Conflicts:
#	include/etl/alignment.h

* Support zero arguments emplace() in etl::optional

For non-fundamental types, a recent change in etl::optional was
introduced that doesn't support zero arguments emplace() anymore.

This change fixes it and adds the respective test.

---------

Co-authored-by: John Wellbelove <john.wellbelove@asterconsulting.co.uk>
Co-authored-by: Drew Rife <darife@jlg.com>
2025-09-10 10:37:30 +01:00
John Wellbelove
73243883ce Merge branch 'master' of https://github.com/ETLCPP/etl
# Conflicts:
#	.coderabbit.yaml
#	include/etl/alignment.h
#	support/Release notes.txt
2025-09-07 09:36:47 +01:00
John Wellbelove
ac7b268c32 Modified etl::typed_storage
# Conflicts:
#	include/etl/alignment.h
2025-09-07 09:31:40 +01:00
John Wellbelove
7301617708 Updated version and release notes 2025-09-07 09:26:54 +01:00
John Wellbelove
0d0e290474 Changed #if ETL_USING_STL to #if ETL_USING_STD_OSTREAM around std::basic_ostream
Fixed warnings when using ETL_DEBUG_COUNT in non debug build
2025-09-06 20:51:13 +01:00
John Wellbelove
2fa82d579e Macro changes to fix issues 2025-09-06 20:51:12 +01:00
John Wellbelove
d27adeb510 #1171 optional of a const arary can't be emplaced with gcc-15 2025-09-06 20:51:11 +01:00
John Wellbelove
ea61ff7770 Updated version and release notes 2025-09-06 20:51:10 +01:00
John Wellbelove
0326edef42 Replaced ETL_NOEXCEPT_IF_NO_THROW with ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS) 2025-09-06 20:51:10 +01:00
Roland Reichwein
363d2e8ab5
Make call interfaces in etl::delegate and etl::closure conditionally noexcept (#1172)
* Make all call interfaces in etl::delegate conditionally noexcept

This covers the case when the invoked code can throw.

For operator(), this was already implemented. Do similarly for the
other call interfaces.

* Make all call interfaces in etl::closure conditionally noexcept

Similar to etl::delegate, the contained delegate might be
throwing. Apply the same solution as in etl::delegate to make
the call interfaces conditionally noexcept.
2025-09-06 20:50:58 +01:00
John Wellbelove
97cd7e90dc Changed #if ETL_USING_STL to #if ETL_USING_STD_OSTREAM around std::basic_ostream
Fixed warnings when using ETL_DEBUG_COUNT in non debug build
2025-09-06 20:49:39 +01:00
John Wellbelove
1b65c4ec91 Macro changes to fix issues 2025-09-06 16:25:20 +01:00
Roland Reichwein
92f07a66fc
Fix .clang-format (#1177)
* Added coderabbitai configuration

* Fix .clang-format

---------

Co-authored-by: John Wellbelove <john.wellbelove@asterconsulting.co.uk>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2025-09-06 14:12:34 +01:00
John Wellbelove
0536abe826 #1171 optional of a const arary can't be emplaced with gcc-15 2025-09-06 11:23:20 +01:00
John Wellbelove
228d789a6c Updated version and release notes 2025-09-06 10:19:31 +01:00
John Wellbelove
ce1c0e504b Replaced ETL_NOEXCEPT_IF_NO_THROW with ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS) 2025-09-06 09:46:11 +01:00
David Ockey
b85b071a3e
Made all 'noexcept' statements use ETL_NOEXCEPT macro (#1179)
* Added coderabbitai configuration

* Made all 'noexcept' statements use ETL_NOEXCEPT macro

---------

Co-authored-by: John Wellbelove <john.wellbelove@asterconsulting.co.uk>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2025-09-06 09:32:03 +01:00
John Wellbelove
8c29238116 Updated version and release notes 2025-09-04 19:53:15 +01:00
Drew Rife
4bdb55cfe6 feat: removed unreachable break statements (#1169) 2025-09-04 19:53:14 +01:00
John Wellbelove
8dc10b7a37 Updated version and release notes 2025-09-04 19:53:14 +01:00
John Wellbelove
c2143f5d6c Attempted fixes for MacOS compilation 2025-09-04 19:53:13 +01:00
John Wellbelove
99432a8e71 Attempted fixes for MacOS compilation 2025-09-04 19:53:12 +01:00
John Wellbelove
1216ab2247 Attempted fixes for MacOS compilation 2025-09-04 19:53:11 +01:00
John Wellbelove
dffb611036 Attempted fixes for MacOS compilation 2025-09-04 19:53:11 +01:00
John Wellbelove
57e52ba217 Disabled constexpr const container tests for C++11 2025-09-04 19:53:10 +01:00
John Wellbelove
90f933ff69 Updated version and release notes 2025-09-04 19:53:09 +01:00
John Wellbelove
475e6dd878 Added enhanced coderabbit configuration 2025-09-04 19:53:08 +01:00
John Wellbelove
eea7fe227d Added automatic selection of __builtin_memxxx functions for GCC and clang 2025-09-04 19:52:50 +01:00
John Wellbelove
f835daec50 Fixed compilation issues for const containers unit tests 2025-09-04 19:52:49 +01:00
John Wellbelove
ebd2edde8f Changed char* parameters to value_type* parameters 2025-09-04 19:52:48 +01:00
John Wellbelove
0676f8345f Fixes to GCC -O2 errors 2025-09-04 19:52:47 +01:00
John Wellbelove
9db992256f Added release notes 2025-09-04 19:52:47 +01:00
John Wellbelove
ece4b711f5 Added etl::typed_storage_ext and swap for same
# Conflicts:
#	include/etl/alignment.h
2025-09-04 19:52:46 +01:00
John Wellbelove
33302790ba Added etl::typed_storage_ext and swap for same 2025-09-04 19:52:45 +01:00
John Wellbelove
aea6e7da8b Added ETL_NOEXCEPT and ETL_NOEXCEPT_IF_NO_THROW 2025-09-04 19:52:45 +01:00
John Wellbelove
dffbd1e1ef Modified etl::typed_storage
# Conflicts:
#	include/etl/alignment.h
2025-09-04 19:52:44 +01:00
John Wellbelove
c52b6d0673 Modified etl::typed_storage 2025-09-04 19:52:07 +01:00
John Wellbelove
e2a07c98bf Added builtin mem function tests 2025-09-04 19:52:06 +01:00
John Wellbelove
e760e62dcd Updated version and release notes 2025-09-04 19:45:12 +01:00
Drew Rife
515dcf4bf6
feat: removed unreachable break statements (#1169) 2025-09-04 19:32:57 +01:00
John Wellbelove
efdfee8333 Updated version and release notes 2025-09-04 18:07:00 +01:00
John Wellbelove
bb628aa25d Attempted fixes for MacOS compilation 2025-09-04 15:00:22 +01:00
John Wellbelove
b5ea03133d Attempted fixes for MacOS compilation 2025-09-04 14:35:16 +01:00
John Wellbelove
73ae8f4d85 Attempted fixes for MacOS compilation 2025-09-04 14:26:01 +01:00
John Wellbelove
2d1af2dfb6 Attempted fixes for MacOS compilation 2025-09-04 13:51:32 +01:00
John Wellbelove
0deb855676 Disabled constexpr const container tests for C++11 2025-09-04 12:52:35 +01:00
John Wellbelove
958c331d49 Updated version and release notes 2025-09-04 11:29:02 +01:00
John Wellbelove
76d0a78463 Added enhanced coderabbit configuration 2025-09-04 11:27:27 +01:00
John Wellbelove
51675a6ce7 Added automatic selection of __builtin_memxxx functions for GCC and clang 2025-09-04 10:11:57 +01:00
John Wellbelove
119d381570 Fixed compilation issues for const containers unit tests 2025-09-04 10:10:52 +01:00
John Wellbelove
d92eb4d3ff Changed char* parameters to value_type* parameters 2025-09-04 10:10:02 +01:00
John Wellbelove
3837e36d71 Fixes to GCC -O2 errors 2025-09-02 13:51:45 +01:00
John Wellbelove
c93440dadb Added coderabbitai configuration 2025-08-30 18:29:52 +01:00
John Wellbelove
18f50d01c4 Added release notes 2025-08-28 14:09:17 +01:00
John Wellbelove
89c479ef15 Added etl::typed_storage_ext and swap for same
# Conflicts:
#	include/etl/alignment.h
2025-08-28 13:45:41 +01:00
John Wellbelove
18a7e79c56 Added etl::typed_storage_ext and swap for same 2025-08-28 10:30:24 +01:00
John Wellbelove
7c2804c1a9 Added ETL_NOEXCEPT and ETL_NOEXCEPT_IF_NO_THROW 2025-08-26 17:41:51 +01:00
John Wellbelove
bfe4f62574 Merge branch 'feature/#1170-Place-a-typed-pointer-instead-of-a-bool-into-etl--typed_storage' of https://github.com/ETLCPP/etl into feature/#1170-Place-a-typed-pointer-instead-of-a-bool-into-etl--typed_storage
# Conflicts:
#	include/etl/alignment.h
2025-08-26 17:39:08 +01:00
John Wellbelove
0081cfa794 Modified etl::typed_storage 2025-08-26 17:38:46 +01:00
John Wellbelove
0ca68938ff Modified etl::typed_storage 2025-08-26 16:43:33 +01:00
John Wellbelove
5f8b7f7120 Added builtin mem function tests 2025-08-22 19:20:15 +01:00
John Wellbelove
f801b9a093 Fix VS2022 filters 2025-08-20 09:25:50 +01:00
John Wellbelove
e3dac1e33e Merge branch 'development' 2025-08-19 19:13:31 +01:00
John Wellbelove
cde5bcff69 Updated release notes and version 2025-08-19 18:50:57 +01:00
John Wellbelove
2a970134da Removed releaser and destroyer in favour of lambdas and similar 2025-08-19 16:01:46 +01:00
John Wellbelove
6b7bfb8633 Merge branch 'development' of https://github.com/ETLCPP/etl into development 2025-08-19 13:18:34 +01:00
John Wellbelove
4d5cb98d29 Fixed ETL_NOEXCEPT_IF_NO_THROW and #define ETL_NOEXCEPT_IF_NO_THROW_EXPR(...) for C++03
Updated example

Added releaser and destroyer functors to etl::ipool to simplify integration with etl::unique_ptr
2025-08-19 13:18:21 +01:00
John Wellbelove
fb6c42ec78 Fixed ETL_NOEXCEPT_IF_NO_THROW and #define ETL_NOEXCEPT_IF_NO_THROW_EXPR(...) for C++03 2025-08-18 19:45:40 +01:00
John Wellbelove
5f37af3f83 Changed release() to destroy() to match create() 2025-08-18 19:44:51 +01:00
John Wellbelove
44ec1e4f25 Updated release notes 2025-08-18 17:34:53 +01:00
John Wellbelove
ac1d2c82d1 Added not_null comparison tests 2025-08-18 17:13:07 +01:00
John Wellbelove
0a5fcef331 Merge branch 'feature/#1166-Feature-Request--implement-not_null' of https://github.com/ETLCPP/etl into feature/#1166-Feature-Request--implement-not_null 2025-08-18 16:52:00 +01:00
John Wellbelove
3a25d5934a Added constexpr. Removed some member functions. Removed 'move' member functions for etl::not_null<etl::unique_ptr<T, TDeleter>> 2025-08-18 16:51:49 +01:00
John Wellbelove
3bc87f1045 Changed unique() to underlying_type()
Added underlying_type() to etl::not_null<T*>
2025-08-18 16:51:00 +01:00
John Wellbelove
2d22dfe236 Changed unique() to underlying_type()
Added underlying_type() to etl::not_null<T*>
2025-08-18 16:50:59 +01:00
John Wellbelove
877ef005ea Fixed file Id error
Updated CMakeLists.txt for tests and syntax checks
2025-08-18 16:50:58 +01:00
John Wellbelove
28d90aa80c Initial implementation 2025-08-18 16:50:57 +01:00
John Wellbelove
f6fd44a096 Initial implementation 2025-08-18 16:50:57 +01:00
John Wellbelove
63d7470685 Added etl::nontype_t, with C++11 and C++17 alternatives 2025-08-18 14:22:33 +01:00
John Wellbelove
450948933f Added example of the use of etl::unique_ptr with etl::pool 2025-08-18 14:20:45 +01:00
John Wellbelove
037029ea84 Added constexpr. Removed some member functions. Removed 'move' member functions for etl::not_null<etl::unique_ptr<T, TDeleter>> 2025-08-17 10:37:27 +01:00
John Wellbelove
ae8aff5ed8 Merge branch 'feature/#1166-Feature-Request--implement-not_null' of https://github.com/ETLCPP/etl into feature/#1166-Feature-Request--implement-not_null 2025-08-16 10:57:20 +01:00
John Wellbelove
2edde546c4 Merge branch 'feature/#1166-Feature-Request--implement-not_null' of https://github.com/ETLCPP/etl into feature/#1166-Feature-Request--implement-not_null 2025-08-16 10:57:14 +01:00
John Wellbelove
1963593159 Merge branch 'feature/#1166-Feature-Request--implement-not_null' of https://github.com/ETLCPP/etl into feature/#1166-Feature-Request--implement-not_null 2025-08-16 10:38:38 +01:00
John Wellbelove
94f7d9956d Changed unique() to underlying_type()
Added underlying_type() to etl::not_null<T*>
2025-08-16 10:38:29 +01:00
John Wellbelove
d7585508da Changed unique() to underlying_type()
Added underlying_type() to etl::not_null<T*>
2025-08-16 10:12:41 +01:00
John Wellbelove
109ba9350d Updated syntax check tests 2025-08-15 19:26:18 +01:00
John Wellbelove
08ed69bac7 Fixed file Id error
Updated CMakeLists.txt for tests and syntax checks
2025-08-15 18:04:50 +01:00
John Wellbelove
20f5c0402e Initial implementation 2025-08-15 17:18:15 +01:00
John Wellbelove
9c046b710c Initial implementation 2025-08-15 10:27:35 +01:00
John Wellbelove
f67ae46be6 Merge branch 'master' of https://github.com/ETLCPP/etl 2025-08-15 10:25:46 +01:00
John Wellbelove
efae99252b Fixed VS2022 project file list 2025-08-15 10:25:08 +01:00
John Wellbelove
5312f5eddd Added explicit check for remainder in divide_round_to_infinity 2025-08-15 10:24:45 +01:00
John Wellbelove
2a32826b86 Merge branch 'master' of https://github.com/ETLCPP/etl 2025-08-13 21:07:03 +01:00
John Wellbelove
3553f5db22 Fixed VS2022 project file list 2025-08-13 21:06:35 +01:00
John Wellbelove
8c49e67702 Added return_type and argument_types to etl::delegate 2025-08-13 19:51:31 +01:00
John Wellbelove
2d470d20f5 Fixed VS2022 project file list 2025-08-13 17:51:03 +01:00
John Wellbelove
1af74206d2 Updated PlatformIO action 2025-08-13 16:10:35 +01:00
John Wellbelove
534fcc6ebe Updated fsm generator 2025-08-13 10:46:14 +01:00
John Wellbelove
e449a09b3e Added automated PlatformIO update CI action 2025-08-13 10:37:59 +01:00
John Wellbelove
ca5f5394f7 Minor style change 2025-08-13 10:14:13 +01:00
John Wellbelove
87f121222f Merge branch 'development' of https://github.com/ETLCPP/etl into development
# Conflicts:
#	test/test_delegate_observable.cpp
2025-08-13 09:32:12 +01:00
John Wellbelove
f973d31ad1 Merge branch 'development' of https://github.com/ETLCPP/etl into development
# Conflicts:
#	test/test_delegate_observable.cpp
2025-08-13 09:31:42 +01:00
John Wellbelove
85b15552ba Merge branch 'development' of https://github.com/ETLCPP/etl into development
# Conflicts:
#	test/test_delegate_observable.cpp
2025-08-13 08:53:26 +01:00
John Wellbelove
b734df629b Attempt to fix Github CI
GCC 11 incompatibility
2025-08-13 08:53:03 +01:00
John Wellbelove
4beadd18f4 Attempt to fix Github CI
GCC 11 incompatibility
2025-08-13 08:49:23 +01:00
John Wellbelove
8f94ef619a Attempt to fix Github CI
GCC 11 incompatibility
2025-08-12 21:32:51 +01:00
John Wellbelove
5c24ae2f0d Attempt to fix Github CI
GCC 11 incompatibility
2025-08-12 21:21:16 +01:00
John Wellbelove
3e95e772c3 Attempt to fix Github CI 2025-08-12 18:28:04 +01:00
John Wellbelove
310cc6e501 Attempt to fix Github CI 2025-08-12 18:22:52 +01:00
John Wellbelove
86f76933c1 Added full rounded integral division 2025-08-12 15:13:03 +01:00
John Wellbelove
ddfd3fa443 Added remaining limits tests
Fixed divide_round_half_odd and added tests
2025-08-11 20:19:18 +01:00
John Wellbelove
5c52fd19cc Added new unit tests
Fixed integer overflow issue at limits
2025-08-11 09:49:37 +01:00
John Wellbelove
ff1e4296bc Added complete set of rounded integral division 2025-08-07 18:45:46 +01:00
John Wellbelove
2de4057021 Added transition_to member function to change state
Pulled out the core state change code to process_state_change
2025-08-05 18:48:15 +01:00
John Wellbelove
2ae0a422cd Updated release notes 2025-08-04 20:36:02 +01:00
John Wellbelove
0fc2cfeff3 Updated fsm_generator.h to match edited fsm.h 2025-08-04 17:20:05 +01:00
John Wellbelove
5d694e7aa8 Added ETL_UNLIKELY to ETL_ASSERT if (!(b)) conditions 2025-08-04 16:11:20 +01:00
John Wellbelove
1d4dbc8976 Added etl::fsm_state_pack and corresponding constructor 2025-08-04 16:10:04 +01:00
John Wellbelove
7504646301 Added delegate_observable 2025-08-03 16:22:50 +01:00
John Wellbelove
51a4d0e8da Update templates for pentential macro name conflicts 2025-08-03 16:22:10 +01:00
John Wellbelove
e67066b788 Added emplace type constructors to etl::optional 2025-08-02 13:47:33 +01:00
John Wellbelove
2cd28ce7c5 Fixed minor issues 2025-08-01 09:23:42 +01:00
John Wellbelove
5a2aeb683e Update templates for potential macro name conflicts 2025-07-28 09:32:10 +01:00
John Wellbelove
fa25b8cd5e Added instructions and scripts the convert ETL header guards 2025-07-27 11:23:20 +01:00
John Wellbelove
5fc7e33228 Added basic instructions for using guard2once and once2guard 2025-07-27 10:39:40 +01:00
John Wellbelove
43385fea63 Very minor layout change 2025-07-27 10:38:49 +01:00
John Wellbelove
e60f68bad8 Removed asserts from copy_s and move_s algorithms 2025-07-27 10:38:20 +01:00
John Wellbelove
c26e2de7ec Changed generate scripts to use python3 2025-07-27 10:35:49 +01:00
John Wellbelove
833e352dcb Merge branch 'hotfix/#1154-etl-20.42.2-not-compiling-with-IAR-Arm-compiler-v9.20' into development 2025-07-26 19:35:57 +01:00
John Wellbelove
b7de57fbf1 Update templates for pentential macro name conflicts 2025-07-26 14:10:01 +01:00
John Wellbelove
05e45117ea Update templates for pentential macro name conflicts 2025-07-26 13:23:02 +01:00
John Wellbelove
b77698810f hotfix #1154-etl-20.42.2-not-compiling-with-IAR-Arm-compiler-v9.20 2025-07-24 15:40:10 +01:00
John Wellbelove
5df08645da Updated release notes 2025-07-20 12:45:14 +01:00
John Wellbelove
7858d66884 Removed redundant VS2022 project settings 2025-07-20 11:14:23 +01:00
John Wellbelove
5d7573e513 Minor changes 2025-07-20 11:05:44 +01:00
John Wellbelove
42677dd9ee Merge branch 'pull-request/#955-Implements-deferred-callback-timer-with-optional-priority' of https://github.com/ETLCPP/etl into pull-request/#955-Implements-deferred-callback-timer-with-optional-priority
# Conflicts:
#	test/CMakeLists.txt
2025-07-20 08:42:59 +01:00
Mario Luzeiro
5c5e5df788 Implements deferred callback timer with optional priority (#955)
* Refactored callback_timer_locked to allow base class extention of tick method

* Implement callback timer deferred with priority option

---------

Co-authored-by: Mario Luzeiro <mluzeiro@gliderbits.com>
2025-07-20 08:36:04 +01:00
John Wellbelove
f07b7e75fc Updated release notes 2025-07-19 16:12:00 +01:00
John Wellbelove
2c904baf80 Updated release notes 2025-07-19 16:10:08 +01:00
John Wellbelove
0e6e961039 #1126 to_arithmetic does not compile on C++98 2025-07-19 15:54:06 +01:00
John Wellbelove
7f53572b53 Fix gamma tests 2025-07-18 16:33:23 +01:00
John Wellbelove
8de211acd9 #1151 test failure in i386 in 20.42.1: test_replace_strings in test_string_utilities.c fails 2025-07-18 14:59:25 +01:00
John Wellbelove
13fa2801a3 Updated version and release notes 2025-07-15 11:12:05 +01:00
John Wellbelove
d7875adf9e Added CRC64-ISO added 2025-07-15 10:36:43 +01:00
John Wellbelove
481e29896a Merge branch 'pull-request/#1149-Fix-bug-in-the-void-etl--unlink(first,-last)-for-bidirectional-links' into development 2025-07-14 09:53:40 +01:00
Sergei
4979c8a20b
Fix bug in the void etl::unlink(first, last) for bidirectional links. (#1149)
* Reproduce bug in the `void etl::unlink(first, last)` for bidirectional links.

- correct `test_unlink_range_bidirectional_link` unit test according to the documentation - now this test fails.
- enhance `test_intrusive_list::test_splice_range_self` unit test to verify also `etl_previous` links after splicing lists - now unit test crashes.

* Fix bug in the `void etl::unlink(first, last)` for bidirectional links.

- `test_unlink_range_bidirectional_link` unit test now is green.
- `test_intrusive_list::test_splice_range_self` is not crashing anymore and green.
2025-07-14 08:50:28 +01:00
John Wellbelove
be5a6e2951 Added CRC8 and CRC16 opensafety algorithms 2025-07-14 08:43:20 +01:00
John Wellbelove
73e354c3be Added constexpr for delegate invocations 2025-07-14 08:42:27 +01:00
John Wellbelove
8e02bb3059 Strengthened static assert tests
Changed enable_if checks to static asserts
2025-07-13 10:33:30 +01:00
John Wellbelove
dffd86544c Added etl::type_lists_are_convertible 2025-07-13 10:33:29 +01:00
John Wellbelove
400f438958
Update README.md 2025-07-13 10:19:09 +01:00
John Wellbelove
69f34515e0
Update README.md 2025-07-13 09:32:17 +01:00
John Wellbelove
e4620be180
Update README.md 2025-07-13 09:23:28 +01:00
John Wellbelove
fa77f58247 Updated version and release notes 2025-07-11 15:48:55 +01:00
Roland Reichwein
1a430f4029
Fix compile error in closure.h by using etl::forward (#1147) 2025-07-11 15:44:59 +01:00
John Wellbelove
7f7127a6ab Added doxygen comments to etl::closure
Added bind member function for the full set of arguments
2025-07-11 11:46:47 +01:00
John Wellbelove
ea09c5ee8d Fixed declaration of etl::const_multiset_ext template deduction guides. 2025-07-11 11:45:05 +01:00
John Wellbelove
3da8b20dfe Updated version and release notes 2025-07-10 15:41:15 +01:00
John Wellbelove
94e18bee81 Undated type_traits generator 2025-07-10 15:19:56 +01:00
John Wellbelove
3dce945223 Added ETL_NOEXCEPT to etl::delegate 2025-07-10 14:30:18 +01:00
John Wellbelove
3888b623e7 Added ETL_NOEXCEPT to etl::type_def 2025-07-10 10:25:27 +01:00
wandns
dc6f028b99
Workaround for link libraries call on Zephyr platform (#1145)
zephyr_link_interface() does not work as intended because the
implementation in zephyr/cmake/modules/extensions.cmake:

function(zephyr_link_interface interface)
  target_link_libraries(${interface} INTERFACE zephyr_interface)
endfunction()

is backwards, i.e., target_link_libraries(etl INTERFACE zephyr_interface)
vs. target_link_libraries(zephyr_interface INTERFACE etl).

The workaround results in the following CMake code being executed:

target_link_libraries(zephyr_interface INTERFACE etl::etl)
2025-07-10 10:17:01 +01:00
John Wellbelove
7535d9b63a Merge branch 'pull-request/#1144-Add-support-for-CRC8-NRSC5' into development 2025-07-09 10:22:12 +01:00
John Wellbelove
99e3ebd3d5 Added crc8_nrsc5 for VS2022 and CMake projects 2025-07-09 10:21:35 +01:00
Cpt-Seablue
bb496e6262
Add support for CRC8-NRSC5 (#1144)
* Add CRC8-NRSC5 parameters

* Add CRC8-NRSC5 header

* Add CRC8-NRSC5 header

* Add tests
2025-07-08 20:48:17 +01:00
John Wellbelove
9b3d8dc96e Fixed lower and upper bound tests for std::less comparator 2025-07-08 20:47:05 +01:00
John Wellbelove
67dfd5c0dd Completed tests for const_map, const_multimap, const_setand const_multiset 2025-07-08 20:41:34 +01:00
John Wellbelove
89647c14f2 Fixed const_map and const_set operator== to check container sizes 2025-07-08 08:18:03 +01:00
John Wellbelove
9026ef8933 Merge branch 'pull-request/#1135-Fix-error-on-running-clang-test-only' into development
# Conflicts:
#	test/vs2022/etl.vcxproj
#	test/vs2022/etl.vcxproj.filters
2025-07-07 11:18:49 +01:00
rolandreichweinmusic
28da1fa3ef
Fix tests on big endian (#1142)
* Fix bitset_new test: bitset is implemented as little endian container

* Fix test_bsd_checksum.cpp: endian test was only implemented for little endian

* Fix endianness test

* Fix endian in crc tests

* Fix test_fnv_1

* Fix test_hash

* Fix test_jenkins

* Fix test_memory

* Fix pearson test

* Fix test_xor_rotate_checksum

* Fix murmur test
2025-07-07 08:55:59 +01:00
Roland Reichwein
72e71a8cb6
Fix build of tuple on clang >= 19 (#1141) 2025-07-06 23:53:28 +01:00
John Wellbelove
f2d9ec18a4 Changed name of macro
Added macro to etl traits
2025-07-06 23:46:52 +01:00
Roland Reichwein
2c3eee4c58
Byteswap depends on individual availability of std::byteswap (#1140) 2025-07-06 23:28:55 +01:00
Roland Reichwein
cb6b384f88
Cleanup to get more independent of std (#1139)
* Remove redundant test.sh

* Fix includes according to usage / dependency in individual header files
2025-07-06 20:59:39 +01:00
Roland Reichwein
5807337721
Ignore deprecated float_denorm_style (#1138) 2025-07-06 20:30:42 +01:00
John Wellbelove
feeb0d480a Fixed C++03 compatibility
Added syntax checks for closure.h
2025-07-06 20:24:19 +01:00
Roland Reichwein
3c783e2de7
Add etl::closure (#1137) 2025-06-28 11:18:46 +01:00
John Wellbelove
3784991dd2 Added const_set_constexpr tests 2025-06-28 09:05:50 +01:00
John Wellbelove
5f73295392 Modified const_map & const_multimap type definitions
Added const_set
2025-06-28 08:53:48 +01:00
John Wellbelove
79f93b797b Remove const_map test 2025-06-27 09:33:51 +01:00
John Wellbelove
39469d29dc Revert "Split classes into ETL standard top level and 'i' base classes."
This reverts commit de13fb8afea9aa2777958d902336dcb04f87968e.

# Conflicts:
#	include/etl/const_map.h
#	include/etl/const_multimap.h
#	test/test_const_map.cpp
#	test/test_const_map_constexpr.cpp
#	test/test_const_multimap.cpp
#	test/test_const_multimap_constexpr.cpp
#	test/vs2022/etl.vcxproj
#	test/vs2022/etl.vcxproj.filters
2025-06-27 09:28:58 +01:00
John Wellbelove
f6b969eeba Revert "etl::const_map completed"
This reverts commit 697cd0a5aaa87ab9da6d1ad337a6c55d9934be57.

# Conflicts:
#	include/etl/const_map.h
2025-06-27 09:26:23 +01:00
John Wellbelove
3db20a4e91 Revert "Added const_map_ext and const_multimap_ext"
This reverts commit 8591569eb530a33a0d136bb5bfe2d1fe8c8d2f31.

# Conflicts:
#	include/etl/const_map.h
#	test/test_const_map.cpp
2025-06-27 09:25:03 +01:00
John Wellbelove
a94d0ce986 Revert "Work in progress"
This reverts commit 799280f615c4c46d68571e990926f2dd2fc3d64f.

# Conflicts:
#	include/etl/const_map.h
#	test/test_const_map.cpp
2025-06-27 09:22:31 +01:00
John Wellbelove
52cd92d31a Minor format change 2025-06-26 20:23:24 +01:00
Roland Reichwein
3ec2db51c8 Fix error on running clang test only (#1135)
* Fix error on running clang test only

Consolidate tests by factoring out redundant test function

* Make run-tests.sh executable
2025-06-26 20:23:23 +01:00
John Wellbelove
8591569eb5 Added const_map_ext and const_multimap_ext 2025-06-26 20:23:22 +01:00
John Wellbelove
de13fb8afe Split classes into ETL standard top level and 'i' base classes.
Split into const and constexpr unit tests files
2025-06-26 20:23:22 +01:00
John Wellbelove
4808919caf Added value_compare to lexicographical_compare call 2025-06-26 20:23:21 +01:00
John Wellbelove
6530c9625f Modified to have iconst_map base type 2025-06-26 20:23:20 +01:00
John Wellbelove
4d10d47f5e Removed non-const iterator and pointer types
Updated Doxygen comments
2025-06-26 20:23:20 +01:00
John Wellbelove
697cd0a5aa etl::const_map completed 2025-06-26 20:23:19 +01:00
John Wellbelove
4dee5e81cd Work in progress 2025-06-26 20:23:18 +01:00
John Wellbelove
ae43011468 Fixed reversed struct greater<void> parameters 2025-06-26 20:23:18 +01:00
John Wellbelove
799280f615 Work in progress 2025-06-26 20:23:17 +01:00
John Wellbelove
9fdc1e1326 Minor format change 2025-06-26 20:22:41 +01:00
Roland Reichwein
51040d1a28
Fix error on running clang test only (#1135)
* Fix error on running clang test only

Consolidate tests by factoring out redundant test function

* Make run-tests.sh executable
2025-06-25 18:38:25 +01:00
rolandreichweinmusic
0f408a43ba
Fix gamma.h on i386 (#1136)
Add tests for gamma decode
2025-06-25 18:09:37 +01:00
John Wellbelove
64eb9742f0 Added const_map_ext and const_multimap_ext 2025-06-25 14:47:47 +01:00
John Wellbelove
e84be139c5 Split classes into ETL standard top level and 'i' base classes.
Split into const and constexpr unit tests files
2025-06-24 13:24:17 +01:00
John Wellbelove
d458811c26 Added value_compare to lexicographical_compare call 2025-06-24 13:19:56 +01:00
Roland Reichwein
185557db59 Fix usage of template keyword (#1131)
For non-GCC-compilers, the template keyword is being used in
parameter_pack.h for referring to a template template member.

However, clang 19 and 20 don't accept this.

It should be verified which compiler really needs the template
keyword here at all. If not, the if-branch can be removed.

Removed redundant ETL_USING_WIDE_CHARACTERS

Added using_libc_wchar_h to ETL traits

#1127 type_traits.h and C++03

Changed many instances of mem_copy to mem_move
2025-06-22 11:13:43 +01:00
John Wellbelove
62ffe81c1f Modified to have iconst_map base type 2025-06-22 11:13:07 +01:00
Roland Reichwein
bcf00d008e
Fix usage of template keyword (#1131)
For non-GCC-compilers, the template keyword is being used in
parameter_pack.h for referring to a template template member.

However, clang 19 and 20 don't accept this.

It should be verified which compiler really needs the template
keyword here at all. If not, the if-branch can be removed.
2025-06-21 16:25:10 +01:00
John Wellbelove
eb6df0ec82 Removed non-const iterator and pointer types
Updated Doxygen comments
2025-06-16 08:30:35 +01:00
John Wellbelove
609dc3dc2d etl::const_map completed 2025-06-15 20:11:08 +01:00
John Wellbelove
a2efcd2fe7 Work in progress 2025-06-15 17:32:49 +01:00
John Wellbelove
16a61050ca Fixed reversed struct greater<void> parameters 2025-06-15 17:32:27 +01:00
John Wellbelove
9832157fc4 Work in progress 2025-06-14 19:50:41 +01:00
John Wellbelove
ad9a17b6db Removed redundant ETL_USING_WIDE_CHARACTERS
Added using_libc_wchar_h to ETL traits
2025-06-12 18:32:00 +01:00
John Wellbelove
293c7dfcfc Update release 2025-06-12 13:22:32 +01:00
John Wellbelove
a037af120b Merge branch 'hotfix/Accomodate-libc++-with-disabled-wchar_t-features' into development
# Conflicts:
#	include/etl/basic_string.h
2025-06-12 13:15:38 +01:00
John Wellbelove
964e53974a Merge branch 'hotfix/#1124-alignmenth-wont-compile-as-c03' into development 2025-06-12 13:14:05 +01:00
John Wellbelove
8441069b71 Fixed possible nullptr references 2025-06-12 13:13:34 +01:00
John Wellbelove
8659091ff3 Fixed std::string_view include warning for < C++17 2025-06-11 13:16:30 +01:00
John Wellbelove
130859c3b7 Made destructor compatible with C++03 2025-06-11 13:16:29 +01:00
Roland Reichwein
400d6d7da0
For cogapp, use cog instead of python (#1125) 2025-06-11 13:16:06 +01:00
John Wellbelove
e4977a8218 Made destructor compatible with C++03 2025-06-11 10:13:19 +01:00
John Wellbelove
be5537ec0a Updated release notes 2025-06-08 14:24:25 +01:00
Drew Rife
7889d44db6
chore: add newline at end of file (#1122) 2025-06-08 14:21:14 +01:00
John Wellbelove
a85e517196 Updated release notes and version 2025-06-08 11:19:54 +01:00
John Wellbelove
933da4dcb4 Added C++23 Preview configuration 2025-06-06 18:18:16 +01:00
John Wellbelove
59eab34162 Used mem_copy and mem_move to optimise vectors of pointers 2025-06-06 17:27:43 +01:00
John Wellbelove
2ff1ed1a12 Removed instances of ETL_NTH_TYPE_FORCE_CPP03_IMPLEMENTATION 2025-06-06 13:53:26 +01:00
John Wellbelove
3e9f4a99ed #1119 Forced compiler error in nth_type.h breaks containers for C++03
# Conflicts:
#	include/etl/nth_type.h
2025-06-06 13:02:10 +01:00
John Wellbelove
2085295358 #1119 Forced compiler error in nth_type.h breaks containers for C++03 2025-06-06 12:17:49 +01:00
John Wellbelove
896a2e43b7 Disable std::tuple_index and std::tuple_element forward declarations for MacOS and Clang 2025-06-06 10:15:15 +01:00
John Wellbelove
b56394a84f Further optimisation of etl::basic_string::insert by using etl::mem_move() 2025-06-06 09:39:21 +01:00
John Wellbelove
1433fb8f25 Fixed usage of structured bindings for tuple, when not using the STL 2025-06-06 09:37:53 +01:00
John Wellbelove
78d3c45cfd Fixed const&& move constructors
# Conflicts:
#	include/etl/tuple.h
2025-06-05 12:01:37 +01:00
John Wellbelove
ccb37a12a3 Fixed const&& move constructors
# Conflicts:
#	include/etl/tuple.h
2025-06-05 09:57:53 +01:00
Roland Reichwein
e2f2a39a97
Fix forward in tuple ctor (#1116) 2025-06-05 09:54:43 +01:00
John Wellbelove
ea89cf79bc Updated release 2025-06-04 19:14:03 +01:00
Roland Reichwein
a1367fc05f
Conditionally use wchar.h (#1115) 2025-06-04 19:05:41 +01:00
John Wellbelove
cd273e777d Initial solution 2025-06-04 10:12:01 +01:00
John Wellbelove
fe6fd35174 Updated version 2025-06-02 23:38:15 +01:00
Eden Frosst
6a1211c854
Fix West support and add ETL configuration options to Kconfig (#1114)
* Fix West support

* Add ETL Kconfig options
2025-06-02 23:21:48 +01:00
Roland Reichwein
bf8e924308
Add missing header wchar.h for usage of wcslen() (#1113) 2025-06-02 23:11:00 +01:00
John Wellbelove
0f9a845050 Merge branch 'pull-request/#955-Implements-deferred-callback-timer-with-optional-priority' of https://github.com/ETLCPP/etl into pull-request/#955-Implements-deferred-callback-timer-with-optional-priority 2025-06-02 10:53:45 +01:00
Mario Luzeiro
acad52a9a4 Implements deferred callback timer with optional priority (#955)
* Refactored callback_timer_locked to allow base class extention of tick method

* Implement callback timer deferred with priority option

---------

Co-authored-by: Mario Luzeiro <mluzeiro@gliderbits.com>
2025-06-02 10:48:01 +01:00
John Wellbelove
276415dc19 Updated release 2025-06-01 18:08:38 +01:00
John Wellbelove
c5b63faca3 Updated type_traits_generator 2025-06-01 18:08:18 +01:00
John Wellbelove
aa085ca65b Merge branch 'feature/#1100-Optimise-string-class-initialisation-from-C-data' into development 2025-06-01 17:42:48 +01:00
John Wellbelove
228de00dc7 Optimisation of strings 2025-06-01 17:40:38 +01:00
John Wellbelove
f39922dddc Merge branch 'feature/#1100-Optimise-string-class-initialisation-from-C-data' into development
# Conflicts:
#	include/etl/basic_string.h
2025-06-01 13:50:25 +01:00
John Wellbelove
155050b816 Optimisation of strings 2025-06-01 13:49:14 +01:00
John Wellbelove
f178cde02d Optimisation of strings 2025-06-01 10:57:14 +01:00
John Wellbelove
31caeec248 Optimisation of strings 2025-05-31 21:51:48 +01:00
John Wellbelove
8fb4090e75 Minor script updates 2025-05-31 21:49:37 +01:00
John Wellbelove
0428118553 Optimisation of strings 2025-05-31 21:47:25 +01:00
John Wellbelove
896baaa076 Minor script updates 2025-05-31 15:56:24 +01:00
John Wellbelove
f21b54ff3e Updated release notes 2025-05-30 13:52:40 +01:00
John Wellbelove
a5b15136d7 Optimisation of strings 2025-05-30 13:52:39 +01:00
John Wellbelove
690ad2f082 Added ability to disable -Wformat-security 2025-05-30 13:52:39 +01:00
John Wellbelove
f653279948 Added char8_t, char16_t and char32_t is _integral and is_signed traits 2025-05-30 13:52:38 +01:00
John Wellbelove
1cb75ff072 Added -Wformat-security 2025-05-30 13:52:37 +01:00
John Wellbelove
ddcc975cec Optimisation of strings 2025-05-30 13:52:37 +01:00
John Wellbelove
e87e24557f Hardened mem_set and mem_char parameter requirements 2025-05-30 13:52:36 +01:00
Roland Reichwein
15ba2b71cb Remove -Wuseless-cast (#1110) 2025-05-30 11:41:07 +01:00
John Wellbelove
9c91688a5f Updated release notes 2025-05-30 11:40:08 +01:00
John Wellbelove
045535caff Optimisation of strings 2025-05-30 11:30:16 +01:00
John Wellbelove
d913bda0ea Added ability to disable -Wformat-security 2025-05-29 20:19:28 +01:00
John Wellbelove
ffc4666fe9 Added char8_t, char16_t and char32_t is _integral and is_signed traits 2025-05-29 20:19:02 +01:00
John Wellbelove
083439f60b Added -Wformat-security 2025-05-29 20:15:35 +01:00
John Wellbelove
cb6d924dad Optimisation of strings 2025-05-29 20:15:19 +01:00
John Wellbelove
e8a5673f7a Hardened mem_set and mem_char parameter requirements 2025-05-29 20:14:37 +01:00
Roland Reichwein
09acfca5a6
Remove -Wuseless-cast (#1110) 2025-05-28 13:21:04 +01:00
John Wellbelove
f2ec53a344 Updated release 2025-05-27 19:21:21 +01:00
John Wellbelove
eed23ffedf Merge branch 'hotfix/#936-HFSM-Self-Transition' into development 2025-05-27 17:09:47 +01:00
John Wellbelove
4cd2a6ed6e Refactored hfsm receive function 2025-05-27 17:07:58 +01:00
John Wellbelove
ffc17160da Added support for self transition to etl::hfsm
Changed all instances of 'return STATE_ID' to 'return No_State_Change'
2025-05-27 17:07:58 +01:00
John Wellbelove
2d3a80e2b7 Refactored hfsm receive function 2025-05-27 16:47:27 +01:00
Roland Reichwein
0abd618271
Add C++23 detection (#1109) 2025-05-27 16:11:45 +01:00
John Wellbelove
e0ef2da603 Added support for self transition to etl::hfsm
Changed all instances of 'return STATE_ID' to 'return No_State_Change'
2025-05-27 16:05:46 +01:00
Roland Reichwein
65bae7e264
Add unit tests for bit_stream (#1108)
* Add unit tests for bit_stream

* Include issue number in test name

* Included issue number in test name

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2025-05-27 09:02:00 +01:00
John Wellbelove
84ef87dbf0 Added missing files in unit test CMakeLists.txt 2025-05-26 10:23:56 +01:00
John Wellbelove
daeb4bdbcd Updated version and release 2025-05-25 23:12:27 +01:00
John Wellbelove
f950133d51 Merge branch 'development' of https://github.com/ETLCPP/etl into development 2025-05-25 22:41:16 +01:00
TheComet
b62a6d0d1d
Make public function definition inline (#1106)
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2025-05-25 22:40:36 +01:00
John Wellbelove
2e3b91a19b Fixed missing return in compare function 2025-05-25 19:34:10 +01:00
John Wellbelove
c78b5ca76a Added inline namespaces
Added missing comparison operators
Replaced 'typedef' with 'using'
2025-05-25 19:17:49 +01:00
John Wellbelove
a0d81170c8 Added inline namespaces 2025-05-25 19:07:18 +01:00
John Wellbelove
afdb37715d Added arithmetic tests 2025-05-25 19:06:27 +01:00
John Wellbelove
30281b2a1d Syntax stlye chnage 2025-05-25 19:05:19 +01:00
John Wellbelove
2df0039781 Moved chrono.h in the VS2022 project list 2025-05-22 10:20:21 +01:00
Will Sciaroni
aa317de2db
Restore CMake < 3.14 compatibility (#1098) 2025-05-22 10:06:06 +01:00
Will Sciaroni
21e5c2a6e3
Add Devcontainer configurations (#1093)
* Add clang devcontainers

* Add gcc devcontainers

* Remove comment

* Transition to bullseye variants of clang image to build

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2025-05-22 09:44:18 +01:00
John Wellbelove
6d14a73e2e Merge branch 'master' of https://github.com/ETLCPP/etl
# Conflicts:
#	zephyr/module.yml
2025-05-21 15:27:05 +01:00
John Wellbelove
c34cfd30ab Add IWYU pragmas to private headers which provide library symbols (#1103)
* Add Zephyr build system module.yml (#1074)

The Zephyr build system requires that modules have a `module.yml` file to specify where the module cmake and kconfig files are located.
These can also be explicitly set as "external" meaning that they do not exist within the module tree, itself. These build file can still be specified elsewhere via cmake variables, explained more in-depth here: https://docs.zephyrproject.org/latest/develop/modules.html#modules-module-ext-root
This change makes it such that ETL can be included more easily in zephyr projects running on embedded systems. A similar change can be observed in the public nanopb repository, where the repo only requires its own `zephyr/module.yml` file to be found by the zephyr build system, but the kconfig and cmake additions can exist outside of the library repository.

* Add full West support for ETL (#1075)

This will allow ETL to be included via west in a zephyr build without any additional wrappers or external kconfigs.

Signed-off-by: Zach Van Camp <zach.vancamp@etcconnect.com>
Co-authored-by: Zach Van Camp <zach.vancamp@etcconnect.com>

* Add IWYU pragmas to private headers which provide library symbols
This prevents warnings in clang compiler and IWYU tool
https://clangd.llvm.org/guides/include-cleaner#iwyu-pragmas
https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/IWYUPragmas.md#iwyu-pragma-export

---------

Signed-off-by: Zach Van Camp <zach.vancamp@etcconnect.com>
Co-authored-by: Zach Van Camp <marshmilo100@gmail.com>
Co-authored-by: Zach Van Camp <zach.vancamp@etcconnect.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2025-05-21 15:26:02 +01:00
mlandersonjlg
1ebc659c29
Add IWYU pragmas to private headers which provide library symbols (#1103)
* Add Zephyr build system module.yml (#1074)

The Zephyr build system requires that modules have a `module.yml` file to specify where the module cmake and kconfig files are located. 
These can also be explicitly set as "external" meaning that they do not exist within the module tree, itself. These build file can still be specified elsewhere via cmake variables, explained more in-depth here: https://docs.zephyrproject.org/latest/develop/modules.html#modules-module-ext-root
This change makes it such that ETL can be included more easily in zephyr projects running on embedded systems. A similar change can be observed in the public nanopb repository, where the repo only requires its own `zephyr/module.yml` file to be found by the zephyr build system, but the kconfig and cmake additions can exist outside of the library repository.

* Add full West support for ETL (#1075)

This will allow ETL to be included via west in a zephyr build without any additional wrappers or external kconfigs.

Signed-off-by: Zach Van Camp <zach.vancamp@etcconnect.com>
Co-authored-by: Zach Van Camp <zach.vancamp@etcconnect.com>

* Add IWYU pragmas to private headers which provide library symbols
This prevents warnings in clang compiler and IWYU tool
https://clangd.llvm.org/guides/include-cleaner#iwyu-pragmas
https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/IWYUPragmas.md#iwyu-pragma-export

---------

Signed-off-by: Zach Van Camp <zach.vancamp@etcconnect.com>
Co-authored-by: Zach Van Camp <marshmilo100@gmail.com>
Co-authored-by: Zach Van Camp <zach.vancamp@etcconnect.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2025-05-21 15:24:06 +01:00
John Wellbelove
df90b5d630 Updated release notes 2025-05-21 12:35:57 +01:00
John Wellbelove
b13b2ae93c Removed redundant code 2025-05-21 12:35:43 +01:00
John Wellbelove
6b14aeec2f Merge branch 'development' of https://github.com/ETLCPP/etl into development
# Conflicts:
#	include/etl/cyclic_value.h
2025-05-21 12:30:02 +01:00
John Wellbelove
ca12a2ec0c Use etl::clamp for setting value in cyclic_value 2025-05-21 12:29:27 +01:00
Drew Rife
8496e71e6f
Use etl::clamp for setting value in cyclic_value (#1104)
* Add Zephyr build system module.yml (#1074)

The Zephyr build system requires that modules have a `module.yml` file to specify where the module cmake and kconfig files are located. 
These can also be explicitly set as "external" meaning that they do not exist within the module tree, itself. These build file can still be specified elsewhere via cmake variables, explained more in-depth here: https://docs.zephyrproject.org/latest/develop/modules.html#modules-module-ext-root
This change makes it such that ETL can be included more easily in zephyr projects running on embedded systems. A similar change can be observed in the public nanopb repository, where the repo only requires its own `zephyr/module.yml` file to be found by the zephyr build system, but the kconfig and cmake additions can exist outside of the library repository.

* Add full West support for ETL (#1075)

This will allow ETL to be included via west in a zephyr build without any additional wrappers or external kconfigs.

Signed-off-by: Zach Van Camp <zach.vancamp@etcconnect.com>
Co-authored-by: Zach Van Camp <zach.vancamp@etcconnect.com>

* refactor: use etl::clamp for clamping the set value

---------

Signed-off-by: Zach Van Camp <zach.vancamp@etcconnect.com>
Co-authored-by: Zach Van Camp <marshmilo100@gmail.com>
Co-authored-by: Zach Van Camp <zach.vancamp@etcconnect.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2025-05-21 12:29:07 +01:00
John Wellbelove
f33c40001f Added get_token_list to string_utilities to retrieve multiple tokens 2025-05-21 10:21:30 +01:00
Jędrzej Boczar
95a4b107c7
Fix numeric overflow in bip buffer's get_write_reserve (#1088) 2025-05-20 08:32:11 +01:00
John Wellbelove
fc71a9a10f Updated version to 20.41.0 2025-05-19 12:33:51 +01:00
John Wellbelove
ad99c5aaf5 Updated release notes 2025-05-19 12:32:34 +01:00
John Wellbelove
30003cc9c4 Fixed signed/unsigned warning 2025-05-19 12:32:20 +01:00
John Wellbelove
67396c94ef Changed make_array to ETL_NOEXCEPT 2025-05-19 12:31:57 +01:00
John Wellbelove
152581b81b Updated type_traits generator 2025-05-19 09:02:32 +01:00
John Wellbelove
c133c4d8c0 #1102 Optimise clear of sequence containers for trivially destructible types 2025-05-18 18:09:53 +01:00
John Wellbelove
79fb8ba183 Replaced etl::is_duration with etl::is_specialization 2025-05-18 18:09:16 +01:00
John Wellbelove
b05e779d2b Merge branch 'development' of https://github.com/ETLCPP/etl into development 2025-05-18 16:07:53 +01:00
John Wellbelove
f69d39e220 Allow zero sized etl::array 2025-05-18 16:07:47 +01:00
John Wellbelove
ab11c39430 Allow zero sized etl::array 2025-05-18 16:02:02 +01:00
John Wellbelove
66392ba8fe Fixed constexpr labels + other small changes to fix syntax check errors. 2025-05-18 15:53:03 +01:00
John Wellbelove
3f138f68b9 Fixed constexpr labels + other small changes to fix syntax check errors. 2025-05-18 13:42:08 +01:00
John Wellbelove
c25df24b03 Allow zero sized etl::array 2025-05-18 13:41:01 +01:00
John Wellbelove
ba31479481 Added sys_day and local_day constructors and conversions 2025-05-17 21:00:23 +01:00
John Wellbelove
d04ee8c5e7 Added configuration for selection of STL-like or ETL-verbose chrono literals 2025-05-17 11:46:52 +01:00
John Wellbelove
a724dd08b8 Removed useless-cast warning 2025-05-15 19:05:49 +01:00
John Wellbelove
01e30c8f53 #1096 bit_stream_reader constructors do not accept const pointers 2025-05-15 09:45:23 +01:00
John Wellbelove
94e24fd513 #1095 bit_stream_writer::empty() compares the wrong values to determine empty or not 2025-05-15 09:22:14 +01:00
John Wellbelove
7b603e201c Merge branch 'feature/add-time-date-classes' into development
# Conflicts:
#	include/etl/tuple.h
#	test/vs2022/etl.vcxproj.filters
2025-05-14 19:23:21 +01:00
John Wellbelove
9e965b07e0 Small layout and comment alterations 2025-05-14 19:16:42 +01:00
Roland Reichwein
420474593b
Added iterator and const_iterator to etl::ipool (#1043)
* Added iterator and const_iterator to etl::ipool

* Adjusted source code format
2025-05-14 19:14:23 +01:00
John Wellbelove
fe592d5d19 Fixed C++03 compatibility 2025-05-13 22:58:53 +01:00
John Wellbelove
d577dc7256 Fixed C++03 compatibility 2025-05-13 22:44:22 +01:00
John Wellbelove
e3aa7cb46c Fixed C++03 compatibility 2025-05-13 22:11:45 +01:00
Roland Reichwein
fe928fa53a
Support C++23 (#1069)
* Support C++23

* Fix syntax checks for correct C++ standard version

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2025-05-13 21:27:04 +01:00
Roland Reichwein
9f5ad35d41
Cleanup fixes for C++03 (#1089)
* Typo fixes

* Fix typo

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2025-05-13 21:21:50 +01:00
Petr
ce9b774760
Fixed compilation errors in algorithm.h in C++03 and compiler warning… (#1080)
* Add Zephyr build system module.yml (#1074)

The Zephyr build system requires that modules have a `module.yml` file to specify where the module cmake and kconfig files are located. 
These can also be explicitly set as "external" meaning that they do not exist within the module tree, itself. These build file can still be specified elsewhere via cmake variables, explained more in-depth here: https://docs.zephyrproject.org/latest/develop/modules.html#modules-module-ext-root
This change makes it such that ETL can be included more easily in zephyr projects running on embedded systems. A similar change can be observed in the public nanopb repository, where the repo only requires its own `zephyr/module.yml` file to be found by the zephyr build system, but the kconfig and cmake additions can exist outside of the library repository.

* Add full West support for ETL (#1075)

This will allow ETL to be included via west in a zephyr build without any additional wrappers or external kconfigs.

Signed-off-by: Zach Van Camp <zach.vancamp@etcconnect.com>
Co-authored-by: Zach Van Camp <zach.vancamp@etcconnect.com>

* Fixed compilation errors in algorithm.h in C++03 and compiler warnings in gcc older than 4.6

---------

Signed-off-by: Zach Van Camp <zach.vancamp@etcconnect.com>
Co-authored-by: Zach Van Camp <marshmilo100@gmail.com>
Co-authored-by: Zach Van Camp <zach.vancamp@etcconnect.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2025-05-13 21:17:41 +01:00
John Wellbelove
270cb33338 Merge updates 2025-05-13 08:32:59 +01:00
John Wellbelove
875d78d015 Fixed buffer size for etl::chrono::month_weekday hash 2025-05-13 08:29:14 +01:00
John Wellbelove
915d668904 Added chrono.h to tests 2025-05-13 08:28:37 +01:00
John Wellbelove
6eff1749ba Added check for C++03 or lower 2025-05-13 08:28:07 +01:00
John Wellbelove
a9393b96ba Updated comments 2025-05-13 08:27:43 +01:00
John Wellbelove
f3541696fb C++03, 11, 14, 17, 20 compatibility changes 2025-05-12 12:10:41 +01:00
John Wellbelove
12328670dd Work in progress 2025-05-11 14:11:22 +01:00
John Wellbelove
e25982a454 Merge branch 'pull-request/#1049-Various-cleanup-changes' into development
# Conflicts:
#	include/etl/algorithm.h
#	include/etl/file_error_numbers.h
2025-05-09 10:06:28 +01:00
John Wellbelove
c37e48d589 Merge branch 'feature/#1085-Add-The-Remaining-Math-Operators-To-ETL_TYPEDEF' into development 2025-05-09 09:00:20 +01:00
John Wellbelove
524ebf9b9f Small style changes to etl::span take() 2025-05-07 07:26:26 +01:00
John Wellbelove
1d19ac22cd Added licence text to tuple header
Removed redundant include
2025-05-07 07:25:41 +01:00
John Wellbelove
b6300d97ff C++03 compatibiity to to_underlying 2025-05-07 07:24:39 +01:00
John Wellbelove
5094a0a9e1 Added C++03 etl::is_enum 2025-05-07 07:23:26 +01:00
John Wellbelove
708c8c0d3a Added largest.h include to algorithm.h to allow C++03 compatibiity to four parameter copy. 2025-05-07 07:23:07 +01:00
John Wellbelove
53b7acffe9 Added largest.h include to algorithm.h to allow C++03 compatibiity to four parameter copy. 2025-05-07 07:21:14 +01:00
John Wellbelove
d1f118bb79 Minor style changes 2025-05-07 07:20:08 +01:00
Roland Reichwein
ba487bcb04
Add take() to etl::span (#1083) 2025-05-06 08:52:51 +01:00
John Wellbelove
0b280bf5f0 Fixed test syntax error 2025-05-05 21:10:03 +01:00
Helder Duarte
66af2a69c1
Add swap(circular_buffer_ext&&) (#1068) (#1072) 2025-05-05 19:16:38 +01:00
John Wellbelove
394b1110fb Added all arithmetic operators to type_def 2025-05-05 18:01:29 +01:00
John Wellbelove
22391aa750 Imported and updated etl::underlying_type 2025-05-03 08:25:45 +01:00
John Wellbelove
879d620094 Merge branch 'development' of https://github.com/ETLCPP/etl into development 2025-05-01 07:31:28 +01:00
Jiang Yi
f69da8577e
Support etl::underlying_type with compiler builtin (#1045)
msvc is unsupported currently

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2025-04-30 17:01:44 +01:00
John Wellbelove
4af8ff22e3 Merge branch 'development' of https://github.com/ETLCPP/etl into development 2025-04-30 16:56:14 +01:00
BartolomeyKant
a24977a3db
Fix cmake helper functions collision (#1065)
* add etl prefix name for cmake helper functions

* remove unused functions from GetGitRevistionDescription
2025-04-30 16:55:57 +01:00
Roland Reichwein
49acd2d2ab Various cleanup changes (#1049)
* Various Cleanup

Remove remove() by pointer because erase() can be used for that

Fix signed distance handling, with added check for order

Add missing file ID

Fix File IDs

Added test for algorithm.h

* Improve types
# Conflicts:
#	include/etl/file_error_numbers.h
2025-04-30 16:54:22 +01:00
Roland Reichwein
f0af24b603
Various cleanup changes (#1049)
* Various Cleanup

Remove remove() by pointer because erase() can be used for that

Fix signed distance handling, with added check for order

Add missing file ID

Fix File IDs

Added test for algorithm.h

* Improve types
2025-04-30 16:49:02 +01:00
BartolomeyKant
2fd4e171ba
rise up cmake minimum required (#1066)
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2025-04-30 16:47:39 +01:00
John Wellbelove
aa0d8b322c Merge branch 'development' of https://github.com/ETLCPP/etl into development
# Conflicts:
#	zephyr/module.yml
2025-04-30 12:23:56 +01:00
Roland Reichwein
6ed64f7b21
Support const pointers in etl::is_aligned() (#1082)
* Add Zephyr build system module.yml (#1074)

The Zephyr build system requires that modules have a `module.yml` file to specify where the module cmake and kconfig files are located. 
These can also be explicitly set as "external" meaning that they do not exist within the module tree, itself. These build file can still be specified elsewhere via cmake variables, explained more in-depth here: https://docs.zephyrproject.org/latest/develop/modules.html#modules-module-ext-root
This change makes it such that ETL can be included more easily in zephyr projects running on embedded systems. A similar change can be observed in the public nanopb repository, where the repo only requires its own `zephyr/module.yml` file to be found by the zephyr build system, but the kconfig and cmake additions can exist outside of the library repository.

* Support const pointers to etl::is_aligned()

---------

Co-authored-by: Zach Van Camp <marshmilo100@gmail.com>
2025-04-30 12:22:38 +01:00
John Wellbelove
a1ec613630 Fixed parameter shadowing warnings 2025-04-30 12:21:36 +01:00
John Wellbelove
2b141e0f22 Fixed tests to be compatible with std::chrono 2025-04-30 12:07:15 +01:00
John Wellbelove
42ba4d8248 Updated tests 2025-04-30 09:26:34 +01:00
John Wellbelove
5143aa7f53 Added year_month_day and year_month_day_last classes and tests 2025-04-28 20:00:18 +01:00
John Wellbelove
e7cbc10df8 Added experimental system_clock, time_point, and time_zone classes 2025-04-28 19:59:32 +01:00
John Wellbelove
39f17a94b8 Added floating point duration types 2025-04-28 19:58:39 +01:00
John Wellbelove
279ce8f0dc Added more chrono classes and operators 2025-04-27 20:22:45 +01:00
John Wellbelove
4485a90c04 Added etl::chrono::year_month 2025-04-25 19:21:41 +01:00
Zach Van Camp
99d899c11c Add full West support for ETL (#1075)
This will allow ETL to be included via west in a zephyr build without any additional wrappers or external kconfigs.

Signed-off-by: Zach Van Camp <zach.vancamp@etcconnect.com>
Co-authored-by: Zach Van Camp <zach.vancamp@etcconnect.com>
# Conflicts:
#	zephyr/module.yml
2025-04-25 18:15:27 +01:00
Zach Van Camp
5896b3b90e
Add full West support for ETL (#1075)
This will allow ETL to be included via west in a zephyr build without any additional wrappers or external kconfigs.

Signed-off-by: Zach Van Camp <zach.vancamp@etcconnect.com>
Co-authored-by: Zach Van Camp <zach.vancamp@etcconnect.com>
2025-04-25 18:09:13 +01:00
John Wellbelove
d604d40648 Added etl::chrono::hh_mm_ss 2025-04-25 18:07:43 +01:00
Zach Van Camp
bda1e8619d
Add Zephyr build system module.yml (#1074)
The Zephyr build system requires that modules have a `module.yml` file to specify where the module cmake and kconfig files are located. 
These can also be explicitly set as "external" meaning that they do not exist within the module tree, itself. These build file can still be specified elsewhere via cmake variables, explained more in-depth here: https://docs.zephyrproject.org/latest/develop/modules.html#modules-module-ext-root
This change makes it such that ETL can be included more easily in zephyr projects running on embedded systems. A similar change can be observed in the public nanopb repository, where the repo only requires its own `zephyr/module.yml` file to be found by the zephyr build system, but the kconfig and cmake additions can exist outside of the library repository.
2025-04-23 17:33:58 +01:00
John Wellbelove
ee748eb6cb Updates to chrono classes 2025-04-22 20:16:52 +01:00
John Wellbelove
a27aa2a556 Full etl:chrono::duration implementation and unit tests 2025-04-20 13:33:30 +01:00
John Wellbelove
fedf429d02 Merge branch 'development' into feature/add-time-date-classes
# Conflicts:
#	.gitignore
#	include/etl/platform.h
#	include/etl/ratio.h
#	test/CMakeLists.txt
#	test/test_ratio.cpp
#	test/vs2022/etl.vcxproj
#	test/vs2022/etl.vcxproj.filters
2025-04-19 12:30:36 +01:00
John Wellbelove
5a02c061e9 Changes merged from chrono updates 2025-04-18 11:30:43 +01:00
John Wellbelove
bc158cbcbc Updates to chrono classes 2025-04-18 10:50:48 +01:00
John Wellbelove
38c9cab2f7 Minor style change 2025-04-17 14:06:34 +01:00
John Wellbelove
88adbab3f4 Added exclusive_disjunction 2025-04-17 10:16:09 +01:00
John Wellbelove
b966e2aca7 Minor style change 2025-04-17 10:15:12 +01:00
John Wellbelove
3f3a8b06d9 Fix misspelt header include 2025-04-16 19:38:11 +01:00
John Wellbelove
459709bff5 Minor style change 2025-04-16 19:33:24 +01:00
John Wellbelove
01f7cf2b17 C++11 compatibility updates 2025-04-15 19:50:31 +01:00
John Wellbelove
192703be9f C++11 compatibility updates 2025-04-15 08:23:09 +01:00
John Wellbelove
2f7cab3520 C++11 compatibility updates 2025-04-15 07:54:22 +01:00
John Wellbelove
475674288c Added etl::tuple to VS project
Added tuple to CMakeLists.txt
2025-04-14 17:34:27 +01:00
John Wellbelove
7726faaf97 Synchronised type_traits.h with generator 2025-04-14 17:18:35 +01:00
John Wellbelove
b6e21ca57d Refactored some traits to be implemented by etl::conjunction and etl::disjunction 2025-04-14 09:52:25 +01:00
John Wellbelove
d9af24f34b Sopporting changes for etl::tuple 2025-04-14 09:51:28 +01:00
John Wellbelove
2fd887ecc3 C++03 compatibility for etl::typed_storage 2025-04-14 09:50:49 +01:00
John Wellbelove
f85bac450c Added etl::tuple 2025-04-14 09:50:09 +01:00
John Wellbelove
73308ede00 Made is_truncated available for all configurations 2025-04-12 15:04:21 +01:00
Mario Luzeiro
520bcf876b
fix missing is_secure function when building without ETL_HAS_STRING_CLEAR_AFTER_USE (#1067) 2025-04-12 10:52:36 +01:00
John Wellbelove
209e8ceedd Added C++03 compatibility 2025-04-12 10:46:27 +01:00
John Wellbelove
9bbd4763b0 Merge branch 'pull-request/#1023-Alignment-typed-storage' of https://github.com/ETLCPP/etl into pull-request/#1023-Alignment-typed-storage 2025-04-02 16:19:49 +01:00
Roland Reichwein
7d91e1f152
Alignment typed storage (#1023)
* Add etl::typed_storage based on etl::aligned_storage_as

* Have create() instead of emplace()
2025-04-02 15:59:37 +01:00
John Wellbelove
409dae2c36 Fix unused variable warnings 2025-04-02 13:29:59 +01:00
John Wellbelove
a5f0cfe60e Enabled constexpr rounding tests for C++14 and above. 2025-04-02 13:16:57 +01:00
John Wellbelove
e30a0e676a Removed appveyor notification for Slack 2025-04-02 12:59:06 +01:00
John Wellbelove
1ada87ad76 Changed minimum cmake version to 3.10.0 2025-04-02 12:58:38 +01:00
John Wellbelove
a1bfce9a41 Full updated tests 2025-04-01 11:58:55 +01:00
John Wellbelove
a6ed8bd4e9 Remove unnecessary asserts 2025-04-01 09:43:02 +01:00
John Wellbelove
efc3238765 Full updated tests 2025-04-01 09:36:41 +01:00
John Wellbelove
e46563fafc Work in progress 2025-03-31 20:25:33 +01:00
John Wellbelove
83e8473864 Work in progress 2025-03-31 11:25:25 +01:00
John Wellbelove
21ea151532 #1056 Bug: variadic_variant doesn't use the type_id_t type to store type_id 2025-03-28 15:35:45 +00:00
John Wellbelove
6508e61153 etl::span constexpr fix 2025-03-28 15:11:29 +00:00
John Wellbelove
60041bf56a #1057 ETL_DECLARE_DEBUG_COUNT increases RAM usage even when ETL_DEBUG_COUNT NOT defined 2025-03-28 11:19:20 +00:00
John Wellbelove
7e85fd7926 #1057 ETL_DECLARE_DEBUG_COUNT increases RAM usage even when ETL_DEBUG_COUNT NOT defined 2025-03-28 11:16:08 +00:00
John Wellbelove
dac1602291 Merge branch 'pull-request/#1055-Add-enable_if-restriction-for-span-constructor-from-c-array' into development
# Conflicts:
#	include/etl/span.h
#	test/test_span_fixed_extent.cpp
2025-03-28 10:10:52 +00:00
John Wellbelove
077518f4fb Added ETL_ASSERT for copy construction of dynamic span to fixed span
Asserts if the sizes are not equal
2025-03-28 10:07:21 +00:00
Andreas
9953c4d139 Returning const ref of member from const member function (#1052)
The `const` marked function needs to return a `const` reference to a member variable

Co-authored-by: Andreas Pelczer <pelczer@stoerk-tronic.com>
2025-03-27 15:25:43 +00:00
John Wellbelove
92cc068f52 Added etl::monostate as a separate header monostate.h so that it can be used without have to include variant.h 2025-03-27 15:25:42 +00:00
John Wellbelove
aacde24aa5 Changed span_base to span_tag
Removed #include of <span>
2025-03-27 15:25:41 +00:00
mike919192
c1cc9f584b Potential fix for span construct (#1051)
* Try fix for span constructors

* Make base class public
2025-03-27 15:24:44 +00:00
John Wellbelove
4f05fbaca1 Added instructions 2025-03-27 15:24:44 +00:00
John Wellbelove
5852ab3b74 Refactored variant_variadic to use etl::nth_type for etl::variant_alternative implementation
Refactored C++11 & C++14 support.
2025-03-27 15:24:43 +00:00
John Wellbelove
13bb9a6df8 Comments for nth_type 2025-03-27 15:24:42 +00:00
mike919192
418513f3f4 Implement << operator for std basic_ostream and etl string_view (#1040)
* Implement << operator for std basic_ostream and etl string_view

* Implement << operator for std basic_ostream and etl ibasic_string.  Still working through tests

* Should be all tests

* Fix comment
2025-03-27 15:24:42 +00:00
John Wellbelove
4b3987c5e1 Reversed loop change 2025-03-27 15:24:41 +00:00
John Wellbelove
5d0a77dc76 Modified etl::variant_variadic to use etl::type_list in place of etl::parameter_pack 2025-03-27 15:24:40 +00:00
John Wellbelove
d4f1c89ff4 Refactored and simplified some features of etl::type_list
Removed nth_type specialisation for etl::type_list
2025-03-27 15:24:40 +00:00
John Wellbelove
a86b124019 Attempt to fix some sanitizer issues for tests 2025-03-27 15:24:39 +00:00
John Wellbelove
ebc588a477 Added etl::index_of_type as a complement to etl::nth_type 2025-03-27 15:24:38 +00:00
John Wellbelove
34f536548f Renamed type_list_index_of to type_list_index_of_type 2025-03-27 15:24:38 +00:00
John Wellbelove
137a5f58f2 Added etl::type_list_type_at_index 2025-03-27 15:24:37 +00:00
Roland Reichwein
d9d9ae1e53 Add traits to type_list (#1044) 2025-03-27 15:24:36 +00:00
John Wellbelove
a6615a419d Added unit tests for initializer_list construction 2025-03-27 15:24:36 +00:00
John Wellbelove
02c5933aff Updated bash test script help 2025-03-27 15:24:35 +00:00
John Wellbelove
9d74b9c093 Removed duplicated header includes 2025-03-27 15:24:34 +00:00
John Wellbelove
ecf2966e40 Minor format change 2025-03-27 15:23:46 +00:00
rolandreichweinbmw
a26fed1a89 etl::span: Add advance(), copy(), reinterpret_as() (#1024)
* etl::span: Add advance(), copy(), reinterpret_as()

* Added further tests for span::reinterpret_as

* Fix size of unaligned_type on Windows

Multiple inheritance leads to additional 1 byte for the second base class.
Fixing it by not inheriting but aggregating via typedef.
2025-03-27 15:23:45 +00:00
John Wellbelove
90e432cd43 Added ETL_HAS_ATOMIC_ALWAYS_LOCK_FREE macro and has_atomic_always_lock_free trait
Fixed coditional unit tests in test_atomic
2025-03-27 15:23:45 +00:00
John Wellbelove
1274ba263b Integration of contains and contains_node 2025-03-27 15:23:44 +00:00
rolandreichweinbmw
a6e64af085 Add contains() and contains_node() to etl::intrusive_forward_list and etl::intrusive_list (#1036)
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2025-03-27 15:23:43 +00:00
rolandreichweinbmw
a733502359 Intrusive forward list add remove by pointer (#1026)
* Add intrusive_forward_list::remove() element by pointer

* Add test
2025-03-27 15:23:43 +00:00
John Wellbelove
9c22c6ce50 Added static assert for variadic constructor
Fixed missing this-> prefix for current_size
2025-03-27 15:23:42 +00:00
John Wellbelove
6e7df8c581 Added erase from pointer to node 2025-03-27 15:23:41 +00:00
John Wellbelove
74cb40c6e1 Added variadic contruction
Added erase from pointer to node
2025-03-27 15:23:41 +00:00
rolandreichweinbmw
ef2337cfe5 Cleanup (#1039) 2025-03-27 15:23:28 +00:00
John Wellbelove
b5ee8fb259 Modified create_linked_list functions to not null terminal link pointers 2025-03-27 15:23:27 +00:00
John Wellbelove
8890f43918 Added variadic constructors 2025-03-27 15:23:26 +00:00
John Wellbelove
e103d0959f Added etl::create_linked_list and etl::detach_linked_list to the intrusive link utilities
# Conflicts:
#	include/etl/intrusive_links.h
2025-03-27 15:23:00 +00:00
John Wellbelove
4197a1ee8a Added static assert for variadic constructor
Fixed missing this-> prefix for current_size
2025-03-27 15:22:42 +00:00
John Wellbelove
9a07ef9cae Improved implementation of etl::is_base_of_all 2025-03-27 15:22:41 +00:00
John Wellbelove
13dfaaa748 Added erase from pointer to node 2025-03-27 15:22:40 +00:00
John Wellbelove
277cd68301 Added variadic contruction
Added erase from pointer to node
2025-03-27 15:22:40 +00:00
rolandreichweinbmw
2b437a60b2 Cleanup (#1039) 2025-03-27 15:22:39 +00:00
John Wellbelove
222cf93056 Modified create_linked_list functions to not null terminal link pointers 2025-03-27 15:22:38 +00:00
John Wellbelove
13ee4bb411 Added variadic constructors 2025-03-27 15:22:38 +00:00
John Wellbelove
44a0d7c3c5 Added etl::create_linked_list and etl::detach_linked_list to the intrusive link utilities 2025-03-27 15:22:37 +00:00
mike919192
a75d1d2a30
Add enable_if restriction for span constructor from c array (#1055)
* Add enable_if restriction for span constructor from c array

* Try to simplify enable if

* Revert "Try to simplify enable if"

This reverts commit b133835f8cfe43e75478f2a8df06ad5265b7f163.
2025-03-27 15:15:31 +00:00
John Wellbelove
a2119d46e4 Merge branch 'pull-request/#1052-Returning-const-ref-of-member-from-const-member-function' into development 2025-03-26 13:10:43 +00:00
Andreas
c547b7804f
Returning const ref of member from const member function (#1052)
The `const` marked function needs to return a `const` reference to a member variable

Co-authored-by: Andreas Pelczer <pelczer@stoerk-tronic.com>
2025-03-26 12:17:23 +00:00
John Wellbelove
af725afc79 Added etl::monostate as a separate header monostate.h so that it can be used without have to include variant.h 2025-03-26 08:34:13 +00:00
John Wellbelove
2bbc3c3f81 Merge branch 'pull-request/#1051-Potential-fix-for-span-construct' into development
# Conflicts:
#	CONTRIBUTING.md
#	include/etl/span.h
#	test/test_span_fixed_extent.cpp
2025-03-26 08:04:33 +00:00
John Wellbelove
e9adc288c6 Changed span_base to span_tag
Removed #include of <span>
2025-03-25 19:47:32 +00:00
mike919192
d794e84c54
Potential fix for span construct (#1051)
* Try fix for span constructors

* Make base class public
2025-03-25 18:16:44 +00:00
John Wellbelove
0ca3043e24 Added instructions 2025-03-18 15:53:51 +00:00
John Wellbelove
a12dbbd911 Merge branch 'master' of https://github.com/ETLCPP/etl 2025-03-18 15:53:16 +00:00
John Wellbelove
c5cbdc5926 Added instructions 2025-03-18 15:53:10 +00:00
John Wellbelove
dbe30a2465 Added instructions 2025-03-18 15:48:29 +00:00
John Wellbelove
258e87569a Added instructions 2025-03-18 15:47:38 +00:00
John Wellbelove
d6e6816ffc Refactored variant_variadic to use etl::nth_type for etl::variant_alternative implementation
Refactored C++11 & C++14 support.
2025-03-18 14:45:38 +00:00
John Wellbelove
32f567f0bc Comments for nth_type 2025-03-17 17:59:50 +00:00
John Wellbelove
14e57362fa Merge branch 'pull-request/#1040-Implement-stream-operator-for-std-basic_ostream-and-etl-string_view' of https://github.com/ETLCPP/etl into pull-request/#1040-Implement-stream-operator-for-std-basic_ostream-and-etl-string_view 2025-03-17 08:54:37 +00:00
mike919192
ecf5d9bca3 Implement << operator for std basic_ostream and etl string_view (#1040)
* Implement << operator for std basic_ostream and etl string_view

* Implement << operator for std basic_ostream and etl ibasic_string.  Still working through tests

* Should be all tests

* Fix comment
2025-03-17 08:54:28 +00:00
John Wellbelove
b021276519 Reversed loop change 2025-03-17 08:53:18 +00:00
John Wellbelove
bcf5ec4985 Merge branch 'pull-request/#1044-Add-traits-to-type_list' into development 2025-03-16 19:10:06 +00:00
John Wellbelove
3360eae62d Modified etl::variant_variadic to use etl::type_list in place of etl::parameter_pack 2025-03-16 19:09:41 +00:00
John Wellbelove
03ca499e5e Refactored and simplified some features of etl::type_list
Removed nth_type specialisation for etl::type_list
2025-03-16 19:08:55 +00:00
John Wellbelove
495ea2b943 Attempt to fix some sanitizer issues for tests 2025-03-16 19:07:25 +00:00
John Wellbelove
36b4d51baf Added etl::index_of_type as a complement to etl::nth_type 2025-03-16 19:06:34 +00:00
John Wellbelove
53887fa105 Renamed type_list_index_of to type_list_index_of_type 2025-03-14 15:46:25 +00:00
John Wellbelove
f1d5b16d38 Added etl::type_list_type_at_index 2025-03-09 10:47:24 +00:00
Roland Reichwein
d4813dff86
Add traits to type_list (#1044) 2025-03-09 09:41:15 +00:00
mike919192
2b27c28861
Implement << operator for std basic_ostream and etl string_view (#1040)
* Implement << operator for std basic_ostream and etl string_view

* Implement << operator for std basic_ostream and etl ibasic_string.  Still working through tests

* Should be all tests

* Fix comment
2025-03-04 09:44:13 +00:00
John Wellbelove
c19a3fe085 Added unit tests for initializer_list construction 2025-03-04 09:27:39 +00:00
John Wellbelove
ceeb2e706e Updated bash test script help 2025-03-04 09:27:07 +00:00
John Wellbelove
c43d9eaea1 Removed duplicated header includes 2025-03-04 09:26:39 +00:00
John Wellbelove
2dac573963 Merge branch 'pull-request/#1024-etl-span-Add-advance(),-copy(),-reinterpret_as()' of https://github.com/ETLCPP/etl into pull-request/#1024-etl-span-Add-advance(),-copy(),-reinterpret_as()
# Conflicts:
#	include/etl/span.h
2025-03-03 10:58:50 +00:00
John Wellbelove
987cb4f78b Minor format change 2025-03-03 10:57:26 +00:00
rolandreichweinbmw
fc638a92a6 etl::span: Add advance(), copy(), reinterpret_as() (#1024)
* etl::span: Add advance(), copy(), reinterpret_as()

* Added further tests for span::reinterpret_as

* Fix size of unaligned_type on Windows

Multiple inheritance leads to additional 1 byte for the second base class.
Fixing it by not inheriting but aggregating via typedef.
2025-03-03 10:04:09 +00:00
John Wellbelove
071a983cba Added ETL_HAS_ATOMIC_ALWAYS_LOCK_FREE macro and has_atomic_always_lock_free trait
Fixed coditional unit tests in test_atomic
2025-03-03 10:03:42 +00:00
rolandreichweinbmw
d5bea3a1f1
etl::span: Add advance(), copy(), reinterpret_as() (#1024)
* etl::span: Add advance(), copy(), reinterpret_as()

* Added further tests for span::reinterpret_as

* Fix size of unaligned_type on Windows

Multiple inheritance leads to additional 1 byte for the second base class.
Fixing it by not inheriting but aggregating via typedef.
2025-03-03 08:52:12 +00:00
John Wellbelove
e478088081 Merge branch 'pull-request/#1036-Add-contains()-and-contains_node()-to-etl--intrusive_forward_list' into development 2025-03-02 12:51:43 +00:00
John Wellbelove
6124367f28 Integration of contains and contains_node 2025-03-02 12:51:17 +00:00
John Wellbelove
8a4159440e Merge branch 'development' of https://github.com/ETLCPP/etl into development 2025-03-02 11:11:36 +00:00
John Wellbelove
ec08fe48df Added static assert for variadic constructor
Fixed missing this-> prefix for current_size
2025-03-02 11:11:25 +00:00
John Wellbelove
24b241e10a Improved implementation of etl::is_base_of_all 2025-03-02 11:11:24 +00:00
John Wellbelove
fc4c74721c Added erase from pointer to node 2025-03-02 11:11:23 +00:00
John Wellbelove
3849e349ec Added variadic contruction
Added erase from pointer to node
2025-03-02 11:11:22 +00:00
rolandreichweinbmw
41a3b855e1 Cleanup (#1039) 2025-03-02 11:10:51 +00:00
John Wellbelove
9ee97ec1b7 Modified create_linked_list functions to not null terminal link pointers 2025-03-02 11:10:50 +00:00
John Wellbelove
5d6771f607 Added variadic constructors 2025-03-02 11:10:49 +00:00
John Wellbelove
5327b5584b Added etl::create_linked_list and etl::detach_linked_list to the intrusive link utilities 2025-03-02 11:10:48 +00:00
rolandreichweinbmw
12743be9e2
Add contains() and contains_node() to etl::intrusive_forward_list and etl::intrusive_list (#1036)
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2025-03-02 11:09:32 +00:00
rolandreichweinbmw
64ae22a093 Intrusive forward list add remove by pointer (#1026)
* Add intrusive_forward_list::remove() element by pointer

* Add test
2025-03-02 11:05:59 +00:00
John Wellbelove
abe765a9cf Added static assert for variadic constructor
Fixed missing this-> prefix for current_size
2025-03-02 10:20:44 +00:00
John Wellbelove
6459ce7b5f Improved implementation of etl::is_base_of_all 2025-03-02 09:43:31 +00:00
John Wellbelove
dc21da2cd4 Merge branch 'pull-request/#1026-Intrusive-forward-list-add-remove-by-pointer' into development
# Conflicts:
#	include/etl/intrusive_forward_list.h
2025-03-02 08:32:28 +00:00
John Wellbelove
68dac39104 Added erase from pointer to node 2025-03-02 08:31:14 +00:00
John Wellbelove
2746cf4060 Added variadic contruction
Added erase from pointer to node
2025-03-02 08:30:54 +00:00
rolandreichweinbmw
37539a2761
Intrusive forward list add remove by pointer (#1026)
* Add intrusive_forward_list::remove() element by pointer

* Add test
2025-03-01 18:24:30 +00:00
rolandreichweinbmw
4e4f7ddbb1
Cleanup (#1039) 2025-03-01 17:57:27 +00:00
John Wellbelove
acc0b4bb89 Modified create_linked_list functions to not null terminal link pointers 2025-03-01 13:40:49 +00:00
John Wellbelove
260a3f4a48 Added variadic constructors 2025-03-01 13:39:51 +00:00
John Wellbelove
a28cbddd4b Added etl::create_linked_list and etl::detach_linked_list to the intrusive link utilities 2025-02-27 10:02:56 +00:00
John Wellbelove
e1b263a10d Updated release notes 2025-02-23 13:07:25 +00:00
John Wellbelove
c882a9c500 Update version 2025-02-23 12:47:19 +00:00
John Wellbelove
3fafc61bba #1032 Tasking Compiler Failure For parameter_pack.h 2025-02-23 12:42:28 +00:00
John Wellbelove
5e689c0a66 Fix some sanitizer issues 2025-02-23 11:54:38 +00:00
John Wellbelove
109d45c646 Added additional checks for self assignment 2025-02-22 13:59:48 +00:00
John Wellbelove
da5404b748 #1031 etl::string is invalid if calling assign() with itself 2025-02-21 10:52:47 +00:00
John Wellbelove
e9ed2fe044 Update class generators to match code changes 2025-02-21 08:56:58 +00:00
John Wellbelove
7af020bde8 Updated message_router_generator.h 2025-02-19 20:11:53 +00:00
John Wellbelove
812eebf507 Updated release notes 2025-02-19 20:06:17 +00:00
John Wellbelove
52c6bca34d Improve efficiency of etl::string_view::compare with text pointer 2025-02-17 19:11:01 +00:00
John Wellbelove
d1e5112e2a Restored full units test permutations
Fixed unit test for non-virtual message_packet
2025-02-17 12:45:32 +00:00
John Wellbelove
baf12b1fcb Changed etl::message_packet to not require virtual messages 2025-02-17 10:42:25 +00:00
John Wellbelove
6c7cb5ac18 Added test for a constexpr lambda under C++17 and above 2025-02-17 08:00:17 +00:00
John Wellbelove
a2bb84d9e6 Fixed mismatch of double and long double in test_unaligned_type_ext.cpp unit tests 2025-02-17 07:59:31 +00:00
John Wellbelove
3ed1c49d35 Added constexpr lambda test to delegate unit tests 2025-02-13 17:11:48 +00:00
John Wellbelove
94e243e274 Fix unaligned_type floating point checks in unit test 2025-02-13 17:11:01 +00:00
John Wellbelove
ac8566ade2 Merge branch 'development' into pull-request/#1027-Add-etl-make_span() 2025-02-11 14:55:56 +00:00
rolandreichweinbmw
f02c89a867
Add etl::make_span() (#1027) 2025-02-11 11:52:42 +00:00
John Wellbelove
5f6384f96b Ignore Clang output 2025-02-11 11:42:29 +00:00
John Wellbelove
deb26318fb Unit test for delegate initialisation with non-capturing lambda as a constexpr function pointer 2025-02-11 11:41:46 +00:00
John Wellbelove
58c57b0a52 Made bool operator explicit for C++11 and above 2025-02-07 18:27:20 +00:00
John Wellbelove
1f897e1095 Added etl::function traits
Removed private delegate function_traits
Added etl::type_list + etl::nth_type overloads
2025-02-07 18:26:39 +00:00
John Wellbelove
dd4d0088c5 Added ETL_NODISCARD to make_delegete functions 2025-02-04 14:05:11 +00:00
Mario Luzeiro
7f86d07628
Implements deferred callback timer with optional priority (#955)
* Refactored callback_timer_locked to allow base class extention of tick method

* Implement callback timer deferred with priority option

---------

Co-authored-by: Mario Luzeiro <mluzeiro@gliderbits.com>
2025-02-04 10:05:20 +00:00
John Wellbelove
37fd5b7c45 Attempt to fix Github CI errors 2025-02-03 16:19:47 +00:00
John Wellbelove
574da35b10 Attempt to fix Github CI errors 2025-02-03 15:03:28 +00:00
John Wellbelove
7aa7c870b3 Updates to CI scripts 2025-02-03 11:37:26 +00:00
John Wellbelove
d1b2a87b92 Updates to CI scripts 2025-02-01 19:47:55 +00:00
John Wellbelove
6872131920 Updates to CI scripts 2025-02-01 19:44:55 +00:00
John Wellbelove
04b3892509 Updates to CI scripts 2025-02-01 19:18:34 +00:00
John Wellbelove
0c2434239b Updates to CI scripts 2025-02-01 19:09:41 +00:00
John Wellbelove
959becdb2e Updates to CI scripts 2025-02-01 18:47:39 +00:00
John Wellbelove
98c35f7f3e Updates to CI scripts 2025-02-01 18:27:05 +00:00
John Wellbelove
548c2be4c3 Merge branch 'hotfix/#1019-UB-when-passing-a-temporary-lambda-to-a-delegate' into development 2025-02-01 17:55:30 +00:00
John Wellbelove
344618d744 Merge branch 'feature/#1022-Add-option-to-disable-non-lock-free-atomics' into development 2025-02-01 17:55:10 +00:00
John Wellbelove
d26c1a105b Merge branch 'pull-request/#1021-Some-minor-cleanup-changes' into development 2025-02-01 17:54:42 +00:00
John Wellbelove
96cdb2cbb1 Re-included header 2025-02-01 17:54:25 +00:00
John Wellbelove
00d020bf43 Refactored syntax check tests 2025-02-01 15:19:55 +00:00
John Wellbelove
8b2009b45c Added is_always_lock_free member constant to etl::atomic 2025-02-01 15:19:07 +00:00
John Wellbelove
fcbbbeaf44 #1009 etl::expected doesn't compile with legacy_variant
Added in_place constructor
2025-02-01 08:59:20 +00:00
rolandreichweinbmw
41f5c0b6bc
Cleanup (#1021)
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2025-01-31 14:44:43 +00:00
John Wellbelove
bbaa60b382 Added debug info to GCC CMakeList.txt 2025-01-31 14:27:35 +00:00
John Wellbelove
d0468d813c Changed etl::addressof to etl::to_address 2025-01-28 11:16:34 +00:00
John Wellbelove
ad9bda90bc Added etl::to_address 2025-01-28 11:16:04 +00:00
John Wellbelove
1da482d616 Updated CRC constexpr tests for 'force C++03 implementation' option 2025-01-27 19:04:30 +00:00
John Wellbelove
101cfd598f Disabled initialisation of a delegate from a temporary lambda 2025-01-27 09:13:18 +00:00
John Wellbelove
b7bbd44d8e Merge branch 'development' of https://github.com/ETLCPP/etl into development 2025-01-25 10:42:33 +00:00
MichaelFeistETC
d3aba6033f
#968 Swap PROJECT_IS_TOP_LEVEL called before project() (#1015) 2025-01-24 17:54:26 +00:00
John Wellbelove
42dae979da Merge branch 'pull-request/#1016-Allow-compile-time-CRC-calculation' into development 2025-01-24 17:49:04 +00:00
John Wellbelove
b3f7d82900 Added constexpr to CRC1 2025-01-24 17:48:43 +00:00
Zob314
14b50c6541
Allow compile time CRC calculation (#1016)
* Making crc constexpr for c++14. Allows compile time CRC computation.

* Fix syntax when using c++03 or `ETL_FORCE_NO_ADVANCED_CPP`

* Remove use of `ETL_FORCE_NO_ADVANCED_CPP` option since it is no longer used.

---------

Co-authored-by: Zach O'Brien <zach.obrien@tortugaagtech.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2025-01-24 15:20:05 +00:00
John Wellbelove
a0668ff27f Fixed etl::expected in-place test syntax 2025-01-24 14:32:33 +00:00
John Wellbelove
c3d3a326f7 Merge branch 'pull-request/#1014-Added-missing-rational-arithmetic-functions-from-ratio' into development
# Conflicts:
#	.gitignore
#	test/vs2022/etl.vcxproj.filters
2025-01-23 09:40:42 +00:00
John Wellbelove
a8c6b116ab Added test_ratio to VS2022 project 2025-01-23 09:39:16 +00:00
John Wellbelove
44df80219b Changed 'value' to 'type'
Added C++14 constant tests
2025-01-23 09:38:30 +00:00
rolandreichweinbmw
360f503bcf
Added missing rational arithmetic functions from <ratio> (#1014)
* Added ratio traits

* Fix unused test suite in < C++14 case

* Port to C++11

* Fix header includes
2025-01-22 17:15:53 +00:00
John Wellbelove
208dea6616 Merge branch 'feature/#993-Need-lighter-weight-ETL_ASSERT' into development
# Conflicts:
#	.gitignore
#	test/vs2022/etl.vcxproj.filters
2025-01-22 17:13:05 +00:00
John Wellbelove
aa0f292cce Added new test script for light weight assert 2025-01-22 17:11:16 +00:00
John Wellbelove
074a34a4f9 Merge branch 'feature/#997-index-operator-for-containers-can-be-configured-to-emit-an-exception' into development 2025-01-22 15:01:26 +00:00
John Wellbelove
1592f60d7b Merge branch 'feature/Refactor-unaligned-type' into development 2025-01-22 15:00:57 +00:00
John Wellbelove
6c6c7b00a5 Remove redundant ETL_FORCE_NO_ADVANCED_CPP macro 2025-01-22 14:51:18 +00:00
John Wellbelove
efa7c19e8b Fixed etl::expected in-place constructors 2025-01-22 14:50:42 +00:00
John Wellbelove
20ef1a34fc Removed constexpr from unaligned_type 2025-01-21 17:51:18 +00:00
John Wellbelove
2e6686543b unaligned_type refactor 2025-01-21 17:51:17 +00:00
John Wellbelove
f05e9ff651 Pulled out unaligned_copy to a base class 2025-01-21 17:51:15 +00:00
John Wellbelove
140996b8df Reverted std::array<signed char back to std::array<int8_t 2025-01-21 17:50:55 +00:00
rolandreichweinbmw
8904b91deb Fix arm64 signed char (#1006) 2025-01-21 17:50:53 +00:00
rolandreichweinbmw
a563aed7fc Fixed memory.h: mem_copy, mem_move, mem_compare for pointers to const (#1005) 2025-01-21 17:48:53 +00:00
rolandreichweinbmw
473bfa33d9 Fix span fixed extent empty (#1007) 2025-01-21 17:48:38 +00:00
John Wellbelove
c6c29ca138 Fixed <bit> include for C++20 & STL 2025-01-21 17:48:37 +00:00
John Wellbelove
1f00d06869 Updates to singleton_base 2025-01-21 17:48:35 +00:00
rolandreichweinbmw
8ac05b161d Add singleton_base with test (#1002) 2025-01-21 17:48:00 +00:00
rolandreichweinbmw
00ac508e07 Add max_item_size() to etl::ipool (#1001) 2025-01-21 17:47:58 +00:00
John Wellbelove
153cdd8b9a Allow etl::type_def to be trivially copyable 2025-01-21 17:47:57 +00:00
John Wellbelove
ee95ab4db2 Updated unaligned_type constructors and tests 2025-01-21 17:47:55 +00:00
John Wellbelove
71268c4cf3 Updated packed macro 2025-01-21 17:47:31 +00:00
John Wellbelove
75aca06f2b Packed unaligned_type (#989)
This way, unaligned_types like etl::be_uint32_t can be used in places where POD types are expected.
2025-01-21 17:43:38 +00:00
jonasgampigbmw
b34e3a6f60
#1017 Fix empty range handling of min/max_element (#1018) 2025-01-21 17:08:38 +00:00
John Wellbelove
778351a49e Removed constexpr from unaligned_type 2025-01-20 13:50:36 +00:00
John Wellbelove
10f21a0377 unaligned_type refactor 2025-01-18 14:12:56 +00:00
John Wellbelove
2979648cb1 Merge branch 'pull-request/#1006-Fix-arm64-signed-char' into development
# Conflicts:
#	test/test_bit_stream.cpp
#	test/test_bresenham_line.cpp
#	test/test_correlation.cpp
#	test/test_covariance.cpp
#	test/test_rms.cpp
2025-01-08 13:13:25 +00:00
John Wellbelove
ef6f8781ec Reverted std::array<signed char back to std::array<int8_t 2025-01-05 13:48:36 +00:00
rolandreichweinbmw
7e2aeb9a0a
Fix arm64 signed char (#1006) 2025-01-05 11:42:09 +00:00
John Wellbelove
39e2394275 Merge branch 'pull-request/#1005-mem_copy-mem_move-mem_compare-for-pointers-to-const' into development
# Conflicts:
#	.gitignore
2025-01-05 11:16:26 +00:00
John Wellbelove
8d352bb00d Merge branch 'pull-request/#1007-Fix-fixed-extent-span-empty()' into development
# Conflicts:
#	.gitignore
2025-01-05 11:16:03 +00:00
John Wellbelove
f8cdf432da Added build files to ignore 2025-01-04 14:34:10 +00:00
rolandreichweinbmw
599931f0bf
Fixed memory.h: mem_copy, mem_move, mem_compare for pointers to const (#1005) 2025-01-04 14:31:35 +00:00
John Wellbelove
8f70a3c262 Fixed <bit> include for C++20 & STL 2025-01-04 14:18:45 +00:00
John Wellbelove
de51170f8a Added build to ignore list 2025-01-04 13:51:58 +00:00
rolandreichweinbmw
adeb902241
Fix span fixed extent empty (#1007) 2025-01-04 13:33:05 +00:00
John Wellbelove
1b42b77608 Pulled out unaligned_copy to a base class 2025-01-04 13:31:37 +00:00
John Wellbelove
9bb2edfd78 Merge branch 'pull-request/#1002-Add-singleton_base' into development
# Conflicts:
#	.gitignore
#	include/etl/file_error_numbers.h
2024-12-26 15:52:01 +00:00
John Wellbelove
c1a1d24712 Updates to singleton_base 2024-12-26 15:50:32 +00:00
rolandreichweinbmw
5e3b029af0
Add singleton_base with test (#1002) 2024-12-26 13:27:47 +00:00
John Wellbelove
3d43922845 Merge branch 'pull-request/#1001-Add-max_item_size()-to-etl-ipool' into development 2024-12-26 13:24:21 +00:00
rolandreichweinbmw
f0ebf26b6d
Add max_item_size() to etl::ipool (#1001) 2024-12-26 13:15:14 +00:00
John Wellbelove
c842e807ef Allow etl::type_def to be trivially copyable 2024-12-26 13:12:11 +00:00
John Wellbelove
b28c485d1a Updated unaligned_type constructors and tests 2024-12-26 10:58:10 +00:00
John Wellbelove
3b54c4e7a2 Merge branch 'pull-request/#989-Packed-unaligned_type' into development
# Conflicts:
#	.gitignore
2024-12-26 09:14:35 +00:00
John Wellbelove
91a345bb17 Added experimental assert function handler 2024-12-25 17:42:06 +00:00
John Wellbelove
4f38779219 Updated packed macro 2024-12-25 17:37:18 +00:00
John Wellbelove
56c95b474b Packed unaligned_type (#989)
This way, unaligned_types like etl::be_uint32_t can be used in places where POD types are expected.
2024-12-20 10:28:02 +00:00
John Wellbelove
4cbef7fb6e Merge branch 'pull-request/#990-Add-contains-method-to-etl-unordered_map-and-etl-unordered_set' into development 2024-12-19 18:16:39 +00:00
John Wellbelove
191eaae225 Added transparent comparator overloads of contains() 2024-12-19 16:44:12 +00:00
John Wellbelove
1daa345038 Fix unused variables in test 2024-12-19 14:34:00 +00:00
John Wellbelove
784d95acaf Added additional transparent comparators to unordered containers 2024-12-19 14:33:59 +00:00
John Wellbelove
0f487fa126 Make 'packed' have better cross platform functionality 2024-12-19 14:33:57 +00:00
rolandreichweinbmw
22c1ed4058 Packed unaligned_type (#989)
This way, unaligned_types like etl::be_uint32_t can be used in places where POD types are expected.
2024-12-19 14:33:56 +00:00
John Wellbelove
bde0d7d584 Changed etl::mem_cast to support bidirectional iterators 2024-12-19 14:33:55 +00:00
John Wellbelove
99b2dacb6c Added return reference from stack::emplace 2024-12-19 14:33:53 +00:00
rolandreichweinbmw
00b6c9fcb4 Return reference from emplace() in etl::queue (#992) 2024-12-19 14:33:52 +00:00
John Wellbelove
6b88bef8ab Added uncopyable to VS2022 project and syntax-check scripts 2024-12-19 14:33:51 +00:00
rolandreichweinbmw
72a2ad3fe9 Add uncopyable.h, class uncopyable (#985)
* Add uncopyable.h, class uncopyable

* Added destructor and unit tests for etl::uncopyable
2024-12-19 14:33:49 +00:00
John Wellbelove
cd7fd98b0b Modified test data to have sentinel data 2024-12-19 14:33:48 +00:00
John Wellbelove
1f43b2aa96 Added constexpr 2024-12-19 14:33:46 +00:00
rolandreichweinbmw
e7a17a5fb1 Added const iterators to span (#986) 2024-12-19 14:33:45 +00:00
John Wellbelove
cf646a9d89 Fixed incorrect for loops in unit tests 2024-12-19 14:33:43 +00:00
snadampal
86083e18e7 fix build and test failures on arm64 linux platform (#978)
There are few build and test failures on arm64 platform
with "narrowing conversion" errors. This is due to the char
datatype implementation differences between different platforms
and gcc versions. This commit replaces the char datatype with
the explicit datatype that works across all the platforms.
2024-12-19 14:33:42 +00:00
rolandreichweinbmw
cd1805b1d2 Added return to etl::optional emplace, fixed typo (#982) 2024-12-19 14:32:20 +00:00
John Wellbelove
9ed9b90f1d Fixed merge issues 2024-12-19 14:32:19 +00:00
John Wellbelove
9fdc03ae02 removed redundant parameters 2024-12-19 14:32:17 +00:00
John Wellbelove
7ae2c7626e Fixed shadowing warnings 2024-12-19 14:31:53 +00:00
John Wellbelove
58ff15947d Fixed possible null dereference for etl::multi_span operator -> 2024-12-19 14:31:51 +00:00
John Wellbelove
d40cbf12cc Changed case for script header 2024-12-19 14:31:50 +00:00
John Wellbelove
3deaaeb180 Added contains member function to string_view 2024-12-19 14:31:48 +00:00
John Wellbelove
a6ef8ec08d Added member function resize_and_overwrite 2024-12-19 14:31:47 +00:00
John Wellbelove
7552aa06db Removed remaining std::u8string_view functions 2024-12-19 14:31:46 +00:00
John Wellbelove
bdb8956e8d Made construction from std::basic_string_view explicit 2024-12-19 14:31:44 +00:00
John Wellbelove
6ce4fa40bb Added starts_with and ends_with to basic_string 2024-12-19 14:31:43 +00:00
John Wellbelove
7adf9adfcf Removed std::string_view interface
Added contains member functions
2024-12-19 14:31:41 +00:00
John Wellbelove
9311819fa4 Fixed C++ standard compatibility issues 2024-12-19 14:31:40 +00:00
John Wellbelove
cbe4d5abe0 Added string_view API.
For all string types except _ext
2024-12-19 14:31:38 +00:00
John Wellbelove
b1c6489ac5 Added construction from std::basic_string_view 2024-12-19 14:31:37 +00:00
John Wellbelove
6195aa5f08 Removed using directive in derived message router classes. 2024-12-19 14:31:35 +00:00
John Wellbelove
a87498e125 Removed using directive in derived message router classes. 2024-12-19 14:30:34 +00:00
John Wellbelove
08ab27a90a Added CONTRIBUTING.md to the VS2022 project files. 2024-12-19 14:30:33 +00:00
John Wellbelove
12b46728ab Added string_view API.
Created common implementations for member algorithms.
2024-12-19 14:30:31 +00:00
John Wellbelove
05ed5ff77c Change internal constants from all-caps snake case to initial-caps snake case 2024-12-19 14:30:30 +00:00
David Hebbeker
328a685cee Added basic guidelines for contributing code (#976)
* Update README.md

* Apply instructions for pull requests from Slack to new CONTRIBUTING guideline file.

I copied the [message in Slack](https://etlcpp.slack.com/archives/C7SJ45VFB/p1729596737002559) from @jwellbelove into a new file for [contributing guidelines](https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/setting-guidelines-for-repository-contributors). This way a starting point for potential contributors is delivered next to the source code.

* Added hint for the starting point for contributing commits.

I derived this rule from https://github.com/ETLCPP/etl/issues/802#issuecomment-2323530862

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2024-12-19 14:30:28 +00:00
mike919192
21ab37f773 Add at method to span (#975)
* Update README.md

* Add at method to span

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2024-12-19 14:30:27 +00:00
John Wellbelove
223f1cee6e Fixed syntax issue between GCC and Clang/Visual Studio 2024-12-19 14:30:25 +00:00
John Wellbelove
0a41693271 Fixed syntax issue between GCC and Clang/Visual Studio 2024-12-19 14:30:24 +00:00
John Wellbelove
e4a6bc9c44 Fixed missing conditional macros around transparent comparator C++11 functions 2024-12-19 14:30:23 +00:00
John Wellbelove
290f8d3f64 Replaced ETL_OR_STD::size with ETL_OR_STD17::size in unit tests 2024-12-19 14:30:21 +00:00
John Wellbelove
01f0cc17fa Updated release notes 2024-12-19 14:30:20 +00:00
John Wellbelove
54dc48de02 Changed comment
Simplified unit test
2024-12-19 14:30:18 +00:00
John Wellbelove
4513be3aae Updated version and release notes 2024-12-19 14:30:17 +00:00
John Wellbelove
20989a187a Added new C++17 function wrappers
etl::function_as_functor
etl::function_ptr_as_functor
etl::functor_as_static
etl::member_function_as_static
etl::member_function_as_functor
2024-12-19 14:30:16 +00:00
John Wellbelove
4a1712b733 #957 Support heterogenous lookup for maps 2024-12-19 14:30:14 +00:00
John Wellbelove
d0a9d696fe Simplified definition of is_base_of 2024-12-19 14:30:13 +00:00
John Wellbelove
fd82a9c113 #959 Treat bitset with size_type 2024-12-19 14:30:11 +00:00
John Wellbelove
0026a8b908 #965 Fix accident creation of a delegate to an rvalue delegate when copying/assigning from delegate with mismatching signature
#966 A constructor for delegate with a freestanding function
2024-12-19 14:30:10 +00:00
John Wellbelove
ddef6a04ff Fixed static definition 2024-12-19 14:30:09 +00:00
John Wellbelove
297b7e6786 Redefined ETL_DEPRECATED 2024-12-19 14:30:07 +00:00
John Wellbelove
748e2357f5 Updated nth_type to handle a type list of zero length 2024-12-19 14:30:06 +00:00
John Wellbelove
07333fd1dd Updated release notes and version 2024-12-19 14:30:05 +00:00
ZachOB
6ea2388358 Fix build error in icircular_buffer::iterator and icircular_buffer::const_iterator (#956) 2024-12-19 14:30:03 +00:00
Aleksander Dejewski
602261ce39
Add contains() method to etl::unordered_map and etl::unordered_set (#990)
* Add contains() method to etl::unordered_map and etl::unordered_set

* Add contains() method to etl::unordered_multiset and etl::unordered_multimap

Use predefined variables in UT

Move contains() method to correct place in etl::unordered_set

* Fix contains() parameter type
2024-12-19 13:33:02 +00:00
John Wellbelove
2cb15ca28f Fix unused variables in test 2024-12-19 10:21:59 +00:00
John Wellbelove
a786f61860 Added additional transparent comparators to unordered containers 2024-12-17 17:10:48 +00:00
John Wellbelove
f9b2494ec9 Merge branch 'pull-request/#989-Packed-unaligned_type' into development 2024-12-16 14:58:57 +00:00
John Wellbelove
05682930e1 Make 'packed' have better cross platform functionality 2024-12-16 14:58:16 +00:00
rolandreichweinbmw
84eea5bb1f
Packed unaligned_type (#989)
This way, unaligned_types like etl::be_uint32_t can be used in places where POD types are expected.
2024-12-14 21:36:15 +00:00
John Wellbelove
d6f7d2890d Changed etl::mem_cast to support bidirectional iterators 2024-12-14 20:10:33 +00:00
John Wellbelove
9cdef8e399 Added return reference from stack::emplace 2024-12-12 19:42:54 +00:00
rolandreichweinbmw
2a77222b2c
Return reference from emplace() in etl::queue (#992) 2024-12-12 19:04:40 +00:00
John Wellbelove
aa7af8b62b Merge branch 'pull-request/#985-Add-uncopyable.h-class-uncopyable' into development 2024-12-12 18:51:53 +00:00
John Wellbelove
70da0eea06 Added uncopyable to VS2022 project and syntax-check scripts 2024-12-12 18:15:31 +00:00
rolandreichweinbmw
0ecab77151
Add uncopyable.h, class uncopyable (#985)
* Add uncopyable.h, class uncopyable

* Added destructor and unit tests for etl::uncopyable
2024-12-10 16:23:54 +00:00
John Wellbelove
cabc3a47b9 Merge branch 'pull-request/#986-Added-const-iterators-to-span' into development 2024-12-10 11:56:26 +00:00
John Wellbelove
bbea858af4 Modified test data to have sentinel data 2024-12-10 11:26:30 +00:00
John Wellbelove
978aa3f08a Added constexpr 2024-12-10 11:25:54 +00:00
John Wellbelove
c96cf87302 Fixed incorrect for loops in unit tests 2024-12-06 17:50:15 +00:00
rolandreichweinbmw
4f96a8424d
Added const iterators to span (#986) 2024-12-04 10:17:32 +00:00
John Wellbelove
99d7537506 Updated Github Actions to checkout@v4 2024-12-04 09:42:29 +00:00
John Wellbelove
cf73d9a7fb Merge branch 'pull-request/#978-fix-build-and-test-failures-on-arm64-linux-platform' into development 2024-12-02 19:11:58 +00:00
John Wellbelove
d3689723cc Merge branch 'pull-request/#965-etl-delegate-fix-accident-creation-of-a-delegate' into development 2024-12-02 12:37:23 +00:00
John Wellbelove
3a5b552c82 Merge branch 'pull-request/#982-Added-return-to-etl-optional-emplace-fixed-typo' into development 2024-12-02 12:29:01 +00:00
rolandreichweinbmw
b58ba95e60
Added return to etl::optional emplace, fixed typo (#982) 2024-12-02 12:10:26 +00:00
snadampal
275a3f1ca9
fix build and test failures on arm64 linux platform (#978)
There are few build and test failures on arm64 platform
with "narrowing conversion" errors. This is due to the char
datatype implementation differences between different platforms
and gcc versions. This commit replaces the char datatype with
the explicit datatype that works across all the platforms.
2024-11-30 21:16:46 +00:00
John Wellbelove
1b76d93069 Fixed merge issues 2024-11-30 11:19:43 +00:00
John Wellbelove
ed8321e54e removed redundant parameters 2024-11-30 10:18:10 +00:00
John Wellbelove
f2099b5403 Merge branch 'feature/#962-Request--allow-(overload)-string-append-a-string_view' into development
# Conflicts:
#	include/etl/basic_string.h
2024-11-30 09:40:28 +00:00
John Wellbelove
d53ff4ff05 Removed using directive in derived message router classes. 2024-11-30 09:37:51 +00:00
John Wellbelove
9cd2d463ac Removed using directive in derived message router classes. 2024-11-30 09:37:32 +00:00
John Wellbelove
fb1332662c Merge branch 'hotfix/#979-QueuedMessageRouter-does-not-work-message-are-not-sent-to-queue' into development
# Conflicts:
#	test/test_message_router.cpp
2024-11-30 09:34:53 +00:00
John Wellbelove
de63fcbc5d Removed using directive in derived message router classes. 2024-11-30 09:34:14 +00:00
John Wellbelove
e422be6464 Removed using directive in derived message router classes. 2024-11-29 18:53:44 +00:00
John Wellbelove
ec3d20695b Fixed shadowing warnings 2024-11-27 16:36:35 +00:00
John Wellbelove
2b0690928f Fixed possible null dereference for etl::multi_span operator -> 2024-11-27 16:36:00 +00:00
John Wellbelove
962264e0b1 Changed case for script header 2024-11-27 16:35:09 +00:00
John Wellbelove
27c2093110 Added CONTRIBUTING.md to the VS2022 project files. 2024-11-24 16:39:09 +00:00
David Hebbeker
fe47f91a8d Added basic guidelines for contributing code (#976)
* Update README.md

* Apply instructions for pull requests from Slack to new CONTRIBUTING guideline file.

I copied the [message in Slack](https://etlcpp.slack.com/archives/C7SJ45VFB/p1729596737002559) from @jwellbelove into a new file for [contributing guidelines](https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/setting-guidelines-for-repository-contributors). This way a starting point for potential contributors is delivered next to the source code.

* Added hint for the starting point for contributing commits.

I derived this rule from https://github.com/ETLCPP/etl/issues/802#issuecomment-2323530862

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2024-11-24 16:39:08 +00:00
John Wellbelove
27f200e49d Added CONTRIBUTING.md to the VS2022 project files. 2024-11-24 15:33:21 +00:00
John Wellbelove
c53ef6758a Added string_view API.
Created common implementations for member algorithms.
2024-11-24 15:19:12 +00:00
John Wellbelove
67ed9e8e44 Change internal constants from all-caps snake case to initial-caps snake case 2024-11-24 15:19:11 +00:00
David Hebbeker
4a99ec5d63
Added basic guidelines for contributing code (#976)
* Update README.md

* Apply instructions for pull requests from Slack to new CONTRIBUTING guideline file.

I copied the [message in Slack](https://etlcpp.slack.com/archives/C7SJ45VFB/p1729596737002559) from @jwellbelove into a new file for [contributing guidelines](https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/setting-guidelines-for-repository-contributors). This way a starting point for potential contributors is delivered next to the source code.

* Added hint for the starting point for contributing commits.

I derived this rule from https://github.com/ETLCPP/etl/issues/802#issuecomment-2323530862

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2024-11-24 15:09:57 +00:00
John Wellbelove
705b6b1bae Added contains member function to string_view 2024-11-24 15:01:38 +00:00
John Wellbelove
f566076f42 Added member function resize_and_overwrite 2024-11-24 09:03:48 +00:00
John Wellbelove
89123357a6 Removed remaining std::u8string_view functions 2024-11-24 08:55:22 +00:00
John Wellbelove
75f7292447 Made construction from std::basic_string_view explicit 2024-11-24 08:53:51 +00:00
John Wellbelove
d5cd9567cd Added starts_with and ends_with to basic_string 2024-11-23 12:33:36 +00:00
John Wellbelove
a3b40b667a Removed std::string_view interface
Added contains member functions
2024-11-23 10:47:41 +00:00
John Wellbelove
bc44bf7a46 Fixed C++ standard compatibility issues 2024-11-22 12:25:02 +00:00
John Wellbelove
6559615242 Added string_view API.
For all string types except _ext
2024-11-20 09:51:02 +00:00
John Wellbelove
f5e8a5400e Added construction from std::basic_string_view 2024-11-18 20:20:53 +00:00
John Wellbelove
e8fcace1cb Added string_view API.
Created common implementations for member algorithms.
2024-11-16 14:05:14 +00:00
John Wellbelove
5828ba05c9 Change internal constants from all-caps snake case to initial-caps snake case 2024-11-16 14:05:12 +00:00
mike919192
f5eab49208
Add at method to span (#975)
* Update README.md

* Add at method to span

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2024-11-13 21:26:04 +00:00
John Wellbelove
7f66536183 Fixed syntax issue between GCC and Clang/Visual Studio 2024-11-11 13:24:21 +00:00
John Wellbelove
d3ba653e37 Fixed syntax issue between GCC and Clang/Visual Studio 2024-11-11 13:20:47 +00:00
John Wellbelove
27492b4562 Fixed missing conditional macros around transparent comparator C++11 functions 2024-11-11 13:19:59 +00:00
John Wellbelove
c9180a4b18 Replaced ETL_OR_STD::size with ETL_OR_STD17::size in unit tests 2024-11-10 18:34:18 +00:00
John Wellbelove
80a3ca0bea Updated release notes 2024-11-10 18:00:47 +00:00
John Wellbelove
5b01a4b4e5 Changed comment
Simplified unit test
2024-11-10 18:00:45 +00:00
John Wellbelove
31740b8c8b Updated version and release notes 2024-11-10 18:00:44 +00:00
John Wellbelove
ad69fb256d Added new C++17 function wrappers
etl::function_as_functor
etl::function_ptr_as_functor
etl::functor_as_static
etl::member_function_as_static
etl::member_function_as_functor
2024-11-10 18:00:10 +00:00
John Wellbelove
c954c696bb #957 Support heterogenous lookup for maps 2024-11-10 18:00:08 +00:00
John Wellbelove
bce35c4927 Simplified definition of is_base_of 2024-11-10 18:00:06 +00:00
John Wellbelove
36a5b4ba16 #959 Treat bitset with size_type 2024-11-10 18:00:05 +00:00
John Wellbelove
4b7997ae17 #965 Fix accident creation of a delegate to an rvalue delegate when copying/assigning from delegate with mismatching signature
#966 A constructor for delegate with a freestanding function
2024-11-10 18:00:03 +00:00
John Wellbelove
586ae0cdff Fixed static definition 2024-11-10 18:00:01 +00:00
John Wellbelove
907d38f728 Redefined ETL_DEPRECATED 2024-11-10 18:00:00 +00:00
John Wellbelove
0dbbc4ba57 Updated nth_type to handle a type list of zero length 2024-11-10 17:59:58 +00:00
John Wellbelove
bad4046e91 Updated Github Actions to checkout@v4 2024-11-10 17:59:56 +00:00
John Wellbelove
6461094830 Modified etl::is_delegate to inherit from etl::bool_constant 2024-10-21 09:10:13 +01:00
Vladimir Pinchuk
71b691f7fe
etl/delegate: fix accident creation of a delegate to an rvalue delegate when copying/assigning from delegate with mismatching signature (#965)
* etl/delegate: fix accident creation of a delegate to an rvalue delegate when copying/assigning from delegate with mismatching signature

* etl/type_traits: fix etl::is_base_of for the case when TDerived is final

* add etl::is_delegate

* add changes related to etl::is_delegate to c++03 implementation

* add etl::is_delegate_v<T>
2024-10-21 08:40:59 +01:00
John Wellbelove
a88a48d712
Update README.md 2024-10-20 09:13:02 +01:00
John Wellbelove
4071b17372 Updated release notes and version 2024-09-18 20:37:15 +01:00
ZachOB
484080b88e
Fix build error in icircular_buffer::iterator and icircular_buffer::const_iterator (#956) 2024-09-18 17:36:46 +01:00
John Wellbelove
bec9f4a2df Added etl::ratio tests 2024-09-15 14:12:40 +01:00
John Wellbelove
4741c71e34 etl::ratio work-in-progress 2024-09-14 20:02:25 +01:00
John Wellbelove
0d0b9be310 etl::duration work in progress 2024-09-13 19:55:18 +01:00
John Wellbelove
4942ff840e etl::duration work in progress 2024-09-12 14:03:05 +01:00
John Wellbelove
e6c47a198c Added tests for weekday_indexed and weekday_last 2024-09-08 17:28:52 +01:00
John Wellbelove
d74d8ad3b5 Merge branch 'feature/#757-Add-time-date-classes' of https://github.com/ETLCPP/etl-21 into dual-licence/feature/#757-Add-time-date-classes
# Conflicts:
#	include/etl/chrono.h
#	include/etl/private/chrono/day.h
#	include/etl/private/chrono/duration.h
#	test/CMakeLists.txt
#	test/test_chrono_day.cpp
#	test/vs2022/etl.vcxproj
#	test/vs2022/etl.vcxproj.filters
2024-09-07 21:24:27 +01:00
John Wellbelove
e732f205ac Updates to weekday 2024-09-07 21:19:47 +01:00
John Wellbelove
d15f35c78f Work in progress 2024-09-07 21:16:11 +01:00
John Wellbelove
ae31d581e2 Work in progress 2024-09-07 21:14:46 +01:00
John Wellbelove
bfa5f391fb Fixed value type 2024-09-07 21:13:09 +01:00
John Wellbelove
b532aa685f Work in progress 2024-09-07 21:13:09 +01:00
John Wellbelove
c0d3447818 Merge branch 'feature/#757-Add-time-date-classes' of https://github.com/ETLCPP/etl-21 into dual-licence/feature/#757-Add-time-date-classes 2024-09-07 19:34:51 +01:00
John Wellbelove
081e920302 Updated release notes 2024-09-01 11:49:14 +01:00
John Wellbelove
cb8bb2a35b Merge branch 'development' of https://github.com/ETLCPP/etl into development 2024-08-31 11:56:38 +01:00
schemborerik
77ab40a72f For GCC10, we should check __cplusplus >= 201709L when determining if c++20 is supported (#949) 2024-08-31 11:56:32 +01:00
schemborerik
5bc74d51a4
For GCC10, we should check __cplusplus >= 201709L when determining if c++20 is supported (#949) 2024-08-31 11:19:26 +01:00
John Wellbelove
c54ba6f4c2 Merge branch 'development' of https://github.com/ETLCPP/etl into development 2024-08-31 11:06:53 +01:00
John Wellbelove
f3ad597e75 Merge branch 'development' of https://github.com/ETLCPP/etl into development 2024-08-31 11:06:47 +01:00
John Wellbelove
8e7693d39b Merge branch 'development' of https://github.com/ETLCPP/etl into development 2024-08-31 11:06:10 +01:00
John Wellbelove
b602203e95 C++11 & 14 unit test compatibility 2024-08-31 11:06:03 +01:00
John Wellbelove
0d058f7b07 C++11 & 14 unit test compatibility 2024-08-31 10:54:55 +01:00
John Wellbelove
46012576d1 Merge branch 'hotfix/#948-Bug-in-queue-pop-can-break-queue.empty()' into development 2024-08-31 09:42:44 +01:00
John Wellbelove
3612390888 #948 Bug in queue pop can break queue.empty() 2024-08-31 09:40:46 +01:00
John Wellbelove
10147a1868 Updates to weekday 2024-08-30 19:59:16 +01:00
John Wellbelove
f5d3c4fffa Merge branch 'feature/#757-Add-time-date-classes' of https://github.com/ETLCPP/etl into feature/#757-Add-time-date-classes
# Conflicts:
#	include/etl/chrono.h
#	include/etl/private/chrono/day.h
#	include/etl/private/chrono/duration.h
#	test/CMakeLists.txt
#	test/test_chrono_day.cpp
#	test/vs2022/etl.vcxproj
#	test/vs2022/etl.vcxproj.filters
2024-08-29 09:54:37 +01:00
John Wellbelove
a90d0f4a89 Fixed value type 2024-08-29 09:45:58 +01:00
John Wellbelove
fc0576ad95 Work in progress 2024-08-29 09:13:56 +01:00
John Wellbelove
f77d91d544 Updated syntax checks 2024-08-21 18:48:56 +01:00
John Wellbelove
d564bb501a Merge branch 'master' of https://github.com/ETLCPP/etl 2024-08-20 17:36:00 +01:00
John Wellbelove
48cf2e042c Update README.md 2024-08-20 17:35:50 +01:00
John Wellbelove
6fcd7b8fa1
Update README.md 2024-08-16 14:13:14 +01:00
Joris Putcuyps
5786f2c784
Remove unused git submodule config (#947) 2024-08-15 14:22:27 +01:00
John Wellbelove
af9b3deade Added the option of more logical ordering for template parameters for compile time member functions 2024-08-11 12:13:46 +01:00
John Wellbelove
e6653d3677 Added ETL_CONSTEXPR14 to etl::reverse 2024-08-10 11:12:24 +01:00
John Wellbelove
af03b44d2a Fixed floating point support for etl::unaligned_type 2024-08-09 21:36:58 +01:00
John Wellbelove
344f1b2387 Added Unit test macros
CHECK_FLOAT_SAME
CHECK_FLOAT_DIFFERENT
2024-08-09 21:36:15 +01:00
John Wellbelove
3f018ee1a7 Fixed floating point etl::unaligned_type 2024-08-08 22:58:22 +01:00
John Wellbelove
e6c7e23098 Updated version and release notes 2024-08-08 07:21:15 +01:00
David Hebbeker
527359f535
Make include paths to private files relative (#946)
* Render include paths relative

By removing `etl/` from include paths (in `#include` statements), the path to the directory `include/` doesn't need to be provided to the preprocessor as an include path if the files in `include/etl/` are included by other means.
This has no disadvantages.
Actually the form `#include "..."` is intended to be used for relative paths in the first place.

This is relevant if one wants to include the source files from `include/etl` only indirectly.

For example we use special generated header files which wrap the include statement of the vanilla header files with diagnostic commands.
Those commands allow to disable diagnostic for ETL's files and re-enable them after the file inclusion.
Wrapper files are generated for every non-private header file.
We provide the directory with the wrapper files as include path to the preprocessor instead of the normal `include/` directory.
Thus include statements like `#include "etl/private/..."` are invalid in that case.

* Remove "etl/" from include paths in all files in `include/`.

33 findings in 4 files of 375.

See 936961949172bca5ba1418054a055e05ecb6d1d4 for explanation.
2024-08-08 07:18:17 +01:00
John Wellbelove
16cd116055 Updated version and release notes 2024-08-07 20:42:10 +01:00
John Wellbelove
81751db03e Removed C++11 restriction on etl::observer::notification 2024-08-07 15:45:57 +01:00
John Wellbelove
b38194cec4 Removed EmbeddedTemplateLibrary-20.39.0.tar.gz from project. 2024-08-07 12:25:44 +01:00
John Wellbelove
d68c5e5fde Merge branch 'development' of https://github.com/ETLCPP/etl into development 2024-08-06 19:39:05 +01:00
John Wellbelove
c5a6f9b5b4 #942 Warning on pragma c++20-compat 2024-08-06 19:38:58 +01:00
John Wellbelove
1cbb60347d Added fix number 2024-08-06 19:38:45 +01:00
John Wellbelove
e39f5cb78c #942 Warning on pragma c++20-compat 2024-08-06 18:09:09 +01:00
John Wellbelove
f33b4d716c Updates to constexpr char traits tests 2024-08-06 15:02:13 +01:00
John Wellbelove
bceca90cd9 Updates to constexpr binary tests 2024-08-06 13:40:21 +01:00
John Wellbelove
848ecb0cf6 Updates to constexpr bit tests 2024-08-06 09:55:44 +01:00
John Wellbelove
29b719f5f4 Partial updates to bit tests 2024-08-06 08:37:08 +01:00
John Wellbelove
f7c79526f3 Fix for has_duplicates with one template parameter 2024-08-02 10:43:39 +01:00
John Wellbelove
2f8fb0ff4d Updated release notes 2024-08-02 10:39:22 +01:00
John Wellbelove
73395fe6f4 Updated C++03 observer class to accept void parameter notification types 2024-08-02 10:36:13 +01:00
John Wellbelove
f219e86806 Added etl::count_of, etl::has_duplicates, etl::has_duplicates_of 2024-08-02 10:35:29 +01:00
John Wellbelove
c61f493a01 Added observer<void> as a specialisation for C++03 code 2024-08-01 13:29:52 +01:00
John Wellbelove
a1e1207c0c Updated release notes 2024-07-31 17:23:22 +01:00
John Wellbelove
0627f33f77 Updated release notes 2024-07-31 16:35:22 +01:00
John Wellbelove
99737a97ff Updated release notes 2024-07-31 10:51:41 +01:00
John Wellbelove
405b57191d Fixed suite test name 2024-07-31 10:51:41 +01:00
John Wellbelove
614ed6bf05 Fixed brace syntax 2024-07-31 10:51:41 +01:00
John Wellbelove
b8aa776c59 Updated workflows 2024-07-31 10:51:41 +01:00
Boris Gromov
f01edbc5c4
Fix histogram indexing when accessed via operator [] (#939) 2024-07-31 09:04:45 +01:00
Drew Rife
211b8c2e90
fix: determine legacy variant after determining compiler version (#938) 2024-07-30 19:36:46 +01:00
John Wellbelove
bc6db72dee Updated release notes 2024-07-30 15:16:26 +01:00
John Wellbelove
8b42bb502a Merge branch 'development' 2024-07-30 14:49:04 +01:00
John Wellbelove
b3cba2f256 Merge branch 'pull-request/#935-added-20-bit-integral-limits' into development
# Conflicts:
#	support/Release notes.txt
2024-07-30 14:48:44 +01:00
John Wellbelove
ce50b814dc Merge branch 'development' 2024-07-30 14:47:29 +01:00
John Wellbelove
75f2e7b392 Added support for 20bit types for integral_limits 2024-07-30 14:46:50 +01:00
ReneCanadian
bf56dcf074
added 20 bit integral limits (#935) 2024-07-30 13:54:40 +01:00
John Wellbelove
55493a5739 Coverty shield URLs 2024-07-30 13:36:08 +01:00
John Wellbelove
7d4e4e93fd Fixed unused parameter warning 2024-07-30 13:35:30 +01:00
John Wellbelove
9b8c7780a4 Fixed legacy variant macro 2024-07-30 13:35:08 +01:00
John Wellbelove
b6801b5c0c Added observer specialisation for void notification parameter type 2024-07-30 13:33:58 +01:00
John Wellbelove
87a2e544ad Added 'Syntax Check' to syntax check test runner names. 2024-07-29 10:56:00 +01:00
John Wellbelove
37b46c4f64 Updated release notes and version 2024-07-28 17:57:35 +01:00
John Wellbelove
0b8b057a75 Fixed rebase duplication 2024-07-28 17:04:47 +01:00
John Wellbelove
1d4f400cce changed std::is_same_v to std::is_same for C++11/14 test compatibility 2024-07-28 16:51:02 +01:00
John Wellbelove
cc3d7d120d Split bit tests 2024-07-28 16:51:02 +01:00
John Wellbelove
b85cc276b3 Refactored etl::io_port classes
Added binary operators
Modified the way iterators are handled.
2024-07-28 16:51:02 +01:00
Chiraffollo
083bafa3ce Fix missing partial specialisation equal operators (#927) 2024-07-28 16:49:03 +01:00
John Wellbelove
324f5ebea9 Small format changes 2024-07-28 16:48:45 +01:00
Chiraffollo
83c55ad77e Fix issue #923 equality operator for class expected (#926)
* Add equality operators for class expected

* Add missing unequal operator

---------

Co-authored-by: Oliver Marx <omarx@de.pepperl-fuchs.com>
2024-07-28 16:48:17 +01:00
John Wellbelove
32f5d19792 Added is_active member function to callback_timer classes. 2024-07-28 16:47:13 +01:00
John Wellbelove
3a557c6f1a Removed asserts from etl::unique_ptr 2024-07-28 16:47:13 +01:00
Tigran Khachatryan
c9c01092d6 Add an etl::nullptr_t type to <etl/nullptr.h> (#924)
* Add an etl::nullptr_t type

* etlcpp/etl issue #921 (etl::unique_ptr reset): add etl::unique_ptr(...)::reset(ETL_NULLPTR)

Remove default argument for the normal reset method of etl::unique_ptr (sorry, didn't notice 😬)

Silence the unused argument warning

Fix operator =(nullptr)

Replace the nullptr_t enum with a class which acts more similar to C++11 nullptr

* Add member pointer support and delete the addressof operator

* "Delete" etl::addressof(ETL_NULLPTR)

* Ensure compatibility with C++98

* ACTUALLY ensure compatibility with C++98

I'm stupid :/

* Correct definition according to cppreference
2024-07-28 16:47:13 +01:00
Chiraffollo
aa852a9998 Fix run-tests.sh script (#929)
* Fix run-tests.sh script

- Fix ordering of parameters in help info
- Change spaces to tabs in indentation of methods (unique usage of indentation)
- Fix check for number of parameters to avoid empty string as default parameter value

* Fix incorrect comparison
2024-07-28 16:47:12 +01:00
John Wellbelove
81aae1a962 Changed default action to Linux test script 2024-07-28 16:47:12 +01:00
John Wellbelove
d8faf5655c Add missing swap implementations for expected (#928)
* Fix missing partial specialisation equal operators

* Add missing swap implementations for expected
2024-07-28 16:47:12 +01:00
Chiraffollo
64be8a63d7 Add missing swap implementations for expected (#928)
* Fix missing partial specialisation equal operators

* Add missing swap implementations for expected
2024-07-28 16:47:12 +01:00
Chiraffollo
0c87973061 Fix missing partial specialisation equal operators (#927) 2024-07-28 16:47:12 +01:00
John Wellbelove
24824d2095 Added ETL_USING_LEGACY_VARIANT & ETL_NOT_USING_LEGACY_VARIANT
Added some legacy API member functions to new variant type.
2024-07-28 16:47:12 +01:00
John Wellbelove
6a8d183797 Small format changes 2024-07-28 16:47:12 +01:00
Chiraffollo
752617ab4c Fix issue #923 equality operator for class expected (#926)
* Add equality operators for class expected

* Add missing unequal operator

---------

Co-authored-by: Oliver Marx <omarx@de.pepperl-fuchs.com>
2024-07-28 16:47:12 +01:00
Rafael Laya
02981a5cc2
Fixes compiler detection with Wundef (#934)
* Fix doc comment for pool::allocate() (#914)

* Fixes compiler detection with Wunder

---------

Co-authored-by: Michael K <130953568+kmichaelk@users.noreply.github.com>
Co-authored-by: Rafael Laya <rafaellaya@meta.com>
2024-07-28 16:45:08 +01:00
Chiraffollo
5d97f075a5
Fix issue #931 (#932)
* Fix doc comment for pool::allocate() (#914)

* Fix issue #931

Superfluous curly braces removed

---------

Co-authored-by: Michael K <130953568+kmichaelk@users.noreply.github.com>
2024-07-23 15:41:00 +01:00
Michael K
744d54c1fd
Fix doc comment for pool::allocate() (#914) 2024-07-14 18:42:02 +01:00
John Wellbelove
c959c932a6 Merge branch 'development' of https://github.com/ETLCPP/etl into development 2024-07-02 09:38:19 +01:00
jaskij
64f620c1a8
fix c++20-compat false positive (#909)
* fix c++20-compat false positive

* move the c++20 compat warning suppression to a separate header

* fix GCC/clang in private/diagnostic_cxx_20_compat_push.h

---------

Co-authored-by: Jan Dorniak <jdorniak@ultima-automatyka.pl>
2024-07-02 09:35:24 +01:00
John Wellbelove
87572ec04f Updated release notes 2024-06-27 21:05:52 +01:00
John Wellbelove
ce24b0cc6e Refactored base64 encoder and decoder 2024-06-26 14:56:00 +01:00
John Wellbelove
f22ccc56ab Reenabled address sanitizer for VS2022 2024-06-24 18:20:58 +01:00
John Wellbelove
dcc3e7d938 Added parameter_type_t 2024-06-24 18:20:34 +01:00
John Wellbelove
1c261bf297 Merge branch 'feature/Base64-codec' into development 2024-06-24 17:46:00 +01:00
John Wellbelove
208d8f9642 Implementation of Base64 encoder and decoder 2024-06-24 17:44:53 +01:00
John Wellbelove
aab8630c1a Refactored base64 encoder and decoder 2024-06-22 12:37:58 +01:00
John Wellbelove
96a1105891 Refactored base64 encoder and decoder 2024-06-19 20:22:57 +01:00
John Wellbelove
f7382f4713 Refactored base64 encoder and decoder 2024-06-17 14:23:42 +01:00
John Wellbelove
ab1ea83f77 Refactored base64 encoder and decoder 2024-06-16 13:53:05 +01:00
John Wellbelove
211f872318 Refactored base64 encoder 2024-06-14 20:00:28 +01:00
John Wellbelove
5c2615ac30 Partial refactor into separate encode and decoder headers
Changed to delegate callback based operation
2024-06-14 11:54:23 +01:00
John Wellbelove
e159a6b7ff Merge branch 'pull-request/#905-Add-support-for-type_identity' into development 2024-06-11 13:51:59 +01:00
John Wellbelove
76f2cfb4a2 Minor format change 2024-06-11 13:47:43 +01:00
Tigran Khachatryan
6ced0630a9
etl/type_traits.h: Add support for type_identity (#905)
* etl/type_traits.h: Add support for type_identity

* test/test_type_traits.cpp: Add a test for etl::type_identity (type_identity_test_add(1.5f, 2) == 3.5f)

* Update test_type_traits.cpp

Use CHECK_CLOSE instead of CHECK for equality
2024-06-11 13:43:59 +01:00
John Wellbelove
bb71b60496 Updated version and release 2024-06-05 17:33:16 +01:00
John Wellbelove
9247c14e82 Changed std algorithms to etl 2024-06-05 17:31:01 +01:00
John Wellbelove
a8f59355fe Changed std algorithms to etl 2024-06-05 14:03:37 +01:00
John Wellbelove
2b7e2399fd Added Base64 RFC2152 and RFC3501 2024-06-05 00:29:40 +01:00
Saku Glumoff
496c8a2e7c
Fix doc comment for exception::line_number() (#901)
The documentation comment for `exception::line_number()` in
`include/etl/exception.h` states falsely that the return type for
the function is a `const char*`.

It should state that the return type is `numeric_type`,
which is an `int`.

So change the documentation comment to reflect that the return type is
an `int`.
2024-06-04 18:17:41 +01:00
John Wellbelove
45333cae91 Merge branch 'development' into feature/Base64-codec
# Conflicts:
#	arduino/library-arduino.json
#	arduino/library-arduino.properties
#	include/etl/iterator.h
#	include/etl/version.h
#	library.json
#	library.properties
#	test/CMakeLists.txt
#	test/vs2022/etl.vcxproj.filters
#	version.txt
2024-06-02 10:19:09 +01:00
John Wellbelove
8bf527e087 Updated version and release 2024-05-31 17:16:12 +01:00
John Wellbelove
0d1db08c4a Make conversion operator public 2024-05-31 17:06:48 +01:00
John Wellbelove
b6f67aced2 Updated release notes 2024-05-31 12:01:07 +01:00
John Wellbelove
931a1e6ed5 Added extra tests for as_bytes and as_writable_bytes 2024-05-31 11:59:36 +01:00
John Wellbelove
f5f6bb3305 Revert "Merge"
This reverts commit 57aaa1125b7969f81c2a02fd7e415f0ab21ed58d.
2024-05-28 14:14:44 +01:00
John Wellbelove
57aaa1125b Merge 2024-05-28 14:13:00 +01:00
John Wellbelove
bbfce66abc Added template parameter clamp functions 2024-05-28 11:58:07 +01:00
John Wellbelove
1908ab5b57 Updated release notes 2024-05-25 13:10:43 +01:00
John Wellbelove
e2333886a5 Fixed static & constexpr order 2024-05-25 12:02:20 +01:00
John Wellbelove
e11548fc57 Updated version and release notes 2024-05-15 20:47:11 +01:00
John Wellbelove
1a09998752 Removed ETL_CONSTEXPR from size() 2024-05-15 20:46:49 +01:00
John Wellbelove
e3475be122 Moved project file in VS2022 2024-05-14 08:22:22 +01:00
John Wellbelove
096099d659 Enabled constexpr test for C++14 and above only 2024-05-14 00:06:01 +01:00
John Wellbelove
896bc51f87 Added gcd & lcm constexpr tests 2024-05-13 23:48:55 +01:00
John Wellbelove
38d683bb11 Added gcd & lcm to syntax checks 2024-05-13 23:48:33 +01:00
John Wellbelove
dad86afba6 Merge branch 'development' of https://github.com/ETLCPP/etl into development 2024-05-13 13:45:36 +01:00
John Wellbelove
cdd3bae357 Updated version and release notes 2024-05-13 13:45:28 +01:00
John Wellbelove
d69779a8cf Added GCD and LCM algorithms 2024-05-13 13:45:27 +01:00
John Wellbelove
390afc4d9d Added specialisations of etl::rotate for different iterator types 2024-05-13 13:45:27 +01:00
John Wellbelove
b42af2a829 Added GCD and LCM algorithms 2024-05-13 13:45:27 +01:00
John Wellbelove
f9867c2281 Added specialisations of etl::rotate for different iterator types 2024-05-13 13:45:27 +01:00
John Wellbelove
959b83ec22 Added ETL_NODISCARD, ETL_CONSTEXPR14 and ETL_NOEXCEPT 2024-05-13 13:45:27 +01:00
John Wellbelove
19a7518c2b Full constexpr for etl::array 2024-05-13 13:45:27 +01:00
John Wellbelove
42e6ee2516 Updated version and release notes 2024-05-13 13:28:06 +01:00
John Wellbelove
c6bfa2873d Added GCD and LCM algorithms 2024-05-13 10:57:03 +01:00
John Wellbelove
4f64c83a47 Added specialisations of etl::rotate for different iterator types 2024-05-13 10:56:54 +01:00
John Wellbelove
8528ed2b80 Added GCD and LCM algorithms 2024-05-13 09:08:02 +01:00
John Wellbelove
384c08f25b Added specialisations of etl::rotate for different iterator types 2024-05-13 09:07:30 +01:00
John Wellbelove
17a4e8d934 Added ETL_NODISCARD, ETL_CONSTEXPR14 and ETL_NOEXCEPT 2024-05-13 09:06:35 +01:00
John Wellbelove
6581cd6b07
Update README.md 2024-05-02 08:29:21 +01:00
John Wellbelove
6f3a4cfaf6
Update README.md 2024-05-02 08:28:52 +01:00
John Wellbelove
e380bd624c
Update README.md 2024-05-02 08:27:46 +01:00
John Wellbelove
c6eb003411
Update README.md 2024-05-02 08:26:47 +01:00
John Wellbelove
4bc7853863 Full constexpr for etl::array 2024-04-30 11:58:24 +01:00
John Wellbelove
4b0f9a54fc Updated release notes 2024-04-26 22:16:23 +01:00
John Wellbelove
76699fb27c Revert change #804 to restore value initialisation of type0 for default constructor 2024-04-26 17:48:22 +01:00
John Wellbelove
5ab69e3e97 Updated version and release notes 2024-04-24 13:11:33 +01:00
John Wellbelove
824c173414 Minor code format change 2024-04-24 13:10:26 +01:00
John Wellbelove
1f248ccfc6 Updated version and release notes 2024-04-24 09:46:12 +01:00
John Wellbelove
6c531a637d Modified Unittest++ SUITE macro for better VS2022 intellisence compatibly 2024-04-23 09:57:13 +01:00
John Wellbelove
4ce524e43c #885 Bug: queue move-assignment is not compiling 2024-04-23 09:55:52 +01:00
John Wellbelove
3f9b990a72 #815 etl::remove_if calls predicate twice for first iterator, where predicate returns true. 2024-04-23 09:54:53 +01:00
John Wellbelove
c100cb1b88 Minor format change 2024-04-21 11:32:56 +01:00
John Wellbelove
598027745e
Update README.md 2024-04-20 19:24:16 +01:00
John Wellbelove
760a5082d3
Modified CI badges 2024-04-20 19:19:44 +01:00
John Wellbelove
c0c32f7e28
Update README.md 2024-04-19 22:33:48 +01:00
John Wellbelove
020622ae47
Update README.md 2024-04-19 22:32:36 +01:00
John Wellbelove
456661812e
Update README.md 2024-04-19 22:31:47 +01:00
John Wellbelove
ecb8e87d36 Updated release notes 2024-04-19 14:05:32 +01:00
John Wellbelove
5622b3a0c3 Added assignment test for bitsets 2024-04-19 14:02:35 +01:00
John Wellbelove
3b7b70a95d Merge branch 'development' 2024-04-18 12:40:22 +01:00
John Wellbelove
e2998e4bec Added release notes 2024-04-18 10:58:14 +01:00
John Wellbelove
7932403aba Added C++03 variant of nth_element 2024-04-18 10:57:59 +01:00
John Wellbelove
dd6d2a53a0 Merge branch 'development' 2024-04-17 22:58:12 +01:00
John Wellbelove
800ce90627 Updated release notes 2024-04-17 22:03:01 +01:00
John Wellbelove
4aab807b03 Improvements to Unittest++ macros to fix odd VS2022 syntax colouring 2024-04-17 22:02:33 +01:00
John Wellbelove
a2bd57c89f #806 etl::variant_pool should support C++17 variadic parameters
Added variadic version that supports >=C++11
2024-04-17 16:47:02 +01:00
John Wellbelove
411364f1e7 Merge branch 'development' 2024-04-16 11:02:12 +01:00
John Wellbelove
754eba9aaf Updated generator headers 2024-04-16 09:41:44 +01:00
John Wellbelove
ea9d5b0962 Changes for OSX + C++20 + STL compatibility 2024-04-16 09:02:59 +01:00
John Wellbelove
f12629b9d9 Small format change 2024-04-16 08:08:57 +01:00
John Wellbelove
ae372afe85 Added conditional compilation for C++03 for etl::three_way_compare() 2024-04-16 08:08:35 +01:00
John Wellbelove
55f508b315 Added etl::partition and etl::nth_element 2024-04-16 08:07:33 +01:00
John Wellbelove
676b5f330a Modified tests for <=> operator 2024-04-16 08:06:01 +01:00
John Wellbelove
937ec7189a Make first() and last() static for template based limits specialisation 2024-04-16 08:04:49 +01:00
John Wellbelove
a2f40effa4 Merge branch 'development' of https://github.com/ETLCPP/etl into development 2024-04-11 11:38:58 +01:00
David Hebbeker
749d4a3a03
Render include paths relative. (#879)
By removing `etl/` from include paths (in `#include` statements), the path to the directory `include/` doesn't need to be provided to the preprocessor as an include path if the files in `include/etl/` are included by other means.
This has no disadvantages.
Actually the form `#include "..."` is intended to be used for relative paths in the first place.

This is relevant if one wants to include the source files from `include/etl` only indirectly.

For example we use special generated header files which wrap the include statement of the vanilla header files with diagnostic commands.
Those commands allow to disable diagnostic for ETL's files and re-enable them after the file inclusion.
Wrapper files are generated for every non-private header file.
We provide the directory with the wrapper files as include path to the preprocessor instead of the normal `include/` directory.
Thus include statements like `#include "etl/private/..."` are invalid in that case.
2024-04-11 10:38:16 +01:00
John Wellbelove
ddcabd6514 Disable <=> compare code when not C++20 2024-04-09 14:46:51 +01:00
John Wellbelove
d67a2c63fa Changed unit test checks for C++14 compatibility 2024-04-09 14:46:12 +01:00
John Wellbelove
4f440a429e Optimised string_view::find_first_not_of & string_view::find_last_not_of 2024-04-09 14:45:35 +01:00
John Wellbelove
a5560b2ce1 Added etl::partition 2024-04-09 13:46:33 +01:00
John Wellbelove
52083acff3 Added node erase member functions 2024-04-02 17:12:51 +01:00
John Wellbelove
02a11e943e Moved include for clang compatibility 2024-04-02 17:12:19 +01:00
John Wellbelove
106c4fd540 Added erase(node_type&) member function.
Added node_type typedef to intrusive lists
2024-04-02 11:41:01 +01:00
John Wellbelove
4493c89060 Merge branch 'hotfix/#868-etl-variant-is-missing-comparison-operators' into development 2024-04-01 17:14:03 +01:00
John Wellbelove
3696fa4239 Added more comparison tests 2024-04-01 17:13:45 +01:00
John Wellbelove
19c59feba7 Minor comment change 2024-04-01 17:13:24 +01:00
John Wellbelove
96846f9b57 Removed 'possible nullptr' warning. 2024-04-01 16:57:46 +01:00
John Wellbelove
309154d0ce Added diagnostic_null_dereference_push.h 2024-03-30 08:47:54 +00:00
John Wellbelove
39205e719d Added comparison operators 2024-03-29 16:35:45 +00:00
John Wellbelove
4bc8d00737 Modified return types 2024-03-27 21:01:05 +00:00
John Wellbelove
f1d80ba577 Work in progree 2024-03-23 20:32:26 +00:00
John Wellbelove
b07019dac4 removed generator output files from VS2022 project 2024-03-23 15:08:47 +00:00
John Wellbelove
41a680436c Added etl::mem_fn 2024-03-23 15:08:01 +00:00
John Wellbelove
ac93dc730d Added etl::mem_fn 2024-03-21 14:28:09 +00:00
John Wellbelove
c4f772b509 Added C++14 guard around constexpr type_def tests 2024-03-21 12:23:50 +00:00
John Wellbelove
353419f284 Updated with UnitTest++ macros 2024-03-21 10:26:58 +00:00
John Wellbelove
1474d4add8 Added etl::mem_fn 2024-03-21 10:07:31 +00:00
John Wellbelove
e64b489d5e Fixed dereference of state pointer when null. 2024-03-20 23:33:18 +00:00
John Wellbelove
8710dfc4ff Fixed dereference of state pointer when null. 2024-03-20 23:27:18 +00:00
John Wellbelove
84dd8ceca3 Merge branch 'pull-request/#861-Implement-Constexpr-Strong-Typedef' into development 2024-03-17 13:57:17 +00:00
John Wellbelove
15675f29a6 Updates to constexpr operators 2024-03-17 13:56:56 +00:00
Drew Rife
a8ca216f4e
Update ETL_CONSTEXPR and C++14 desgination from type_def (#862)
* feat: make type_def constexpr

* test: macro constexpr

* test: implicit constexpr

* test: get constexpr

* refactor: remove constexpr from assignment

* test: comparisons constexpr

* fix: cpp11 support for constexpr get method

* fix: c++11 issue with constexpr get reference

* refactor: remove constexpr from the get methods

* refactor: make assignment operators non-constexpr

* refactor: remove constexpr from assignment and get

* refactor: make other methods ETL_CONSTEXPR14

* test: operator preincrement

* test: postincrement

* test: predecrement constexpr

* test: post decrement constexpr

* fix: post decrement test

* test: addition assignment constexpr

* test: subtraction assignment constexpr

* test: multiplication assignment operator

* test: and assignment constexpr

* test: or assignment constexpr

* test: xor assignment constexpr

* tet: left shift assignment constexpr

* test: right shift assignment constexpr

* test: operator modules assignment

* style: revert personal clang-format changes

* refactor: use free functions to test

* refactor: remove constexpr non-constexpr test functions

* style: remove erroneous tab
2024-03-16 12:07:00 +00:00
John Wellbelove
f1133d5bbc
Revert "feature/add utils compare equality operator (#865)" (#866)
This reverts commit d40c5be796f30efd426b83535c078065a62d9bca.
2024-03-16 11:35:08 +00:00
Benzinnos
d40c5be796
feature/add utils compare equality operator (#865)
* Add eq and ne operators

* Add three-way comparison to compare utils.

* Three-way comparison test now using own test data.

* Rename test struct for three-way comparison test.

* Quick fix for pre c++20 aggregate initialization.

---------

Co-authored-by: grigorev <grigorev@protei.ru>
2024-03-16 11:29:49 +00:00
John Wellbelove
7b358dd35a Added constexpr to compare functions 2024-03-16 11:26:15 +00:00
Benzinnos
80af5a4891
Add eq and ne operators for compare utility. (#863)
* Add eq and ne operators

* Add three-way comparison to compare utils.

* Three-way comparison test now using own test data.

* Rename test struct for three-way comparison test.

---------

Co-authored-by: grigorev <grigorev@protei.ru>
2024-03-15 18:15:07 +00:00
John Wellbelove
cb2700e75d Modified accepts() message router functions to interrogate subscribed and successor routers to achieve consistency. 2024-03-15 13:01:59 +00:00
John Wellbelove
80613827c9 Turned etl::send_message into templates so that direct calls to concrete routers are possible 2024-03-15 10:58:11 +00:00
Drew Rife
48c496cd44
Implement Constexpr Strong Typedef (#861)
* feat: make type_def constexpr

* test: macro constexpr

* test: implicit constexpr

* test: get constexpr

* refactor: remove constexpr from assignment

* test: comparisons constexpr

* fix: cpp11 support for constexpr get method
2024-03-13 09:56:47 +00:00
John Wellbelove
b807bad3e3 #847-Add-has_active_timer-to-callback_timer 2024-03-13 09:54:29 +00:00
John Wellbelove
2a5565791c Deleted etl::span fixed extent default constructor 2024-03-11 18:34:51 +00:00
John Wellbelove
833afdbd20 Added optimised and sanitiser build option to Visual Studio project 2024-03-11 18:13:06 +00:00
John Wellbelove
e5523d2d0b Added C++11 conditional compilation around rvalue reference functions 2024-03-11 18:11:44 +00:00
John Wellbelove
881f3d8e62 #841 Change push to push_back on containers, so they can be used with std::back_inserter 2024-03-11 18:10:46 +00:00
John Wellbelove
1cc94b6418 #827 Declaration order for etl::first_set_bit_position in binary.h 2024-03-11 18:09:50 +00:00
John Wellbelove
ce79721a4d #855 Strange expression in volatile atomic operator-- 2024-03-11 18:09:19 +00:00
John Wellbelove
8750e1ce73 Renamed 'test' to 'object' 2024-03-11 08:37:41 +00:00
John Wellbelove
199bb131df Minor fixes 2024-03-11 08:37:13 +00:00
John Wellbelove
4737fd0f03 Removed etl::type_tag and replaced its use with etl::in_place_type_t 2024-03-10 20:23:30 +00:00
John Wellbelove
8826b56493 Fixed existing initializer_list member functions
Added additional initializer_list member functions
2024-03-10 20:22:08 +00:00
John Wellbelove
46b636694d Fixed existing initializer_list member functions
Added additional initializer_list member functions
2024-03-10 20:21:30 +00:00
John Wellbelove
a77e435924 Fixed unsynched generators 2024-03-10 09:33:05 +00:00
John Wellbelove
8593f95208 Merge branch 'pull-request/#858-fix-unique_ptr-assigning-nullptr-to-a-null-unique_ptr-causes-an-assert' into development 2024-03-09 15:25:04 +00:00
John Wellbelove
9a520a37aa Merge branch 'pull-request/#849-fix-string_stream-add-missing-initializations-of-const-format-specifiers' into development
# Conflicts:
#	support/Release notes.txt
2024-03-09 15:23:47 +00:00
Derek Ludwig
abb0494e71
fix(unique_ptr): assigning nullptr to a null unique_ptr causes an assert (#858) 2024-03-09 14:57:15 +00:00
Manuel Knörle
7c24f66ecc
fix(string_stream): add missing initializations of const format specifiers (#849)
The const variables "left" and "right" are const default initialized.
The C++ standard states the following:
"A class type T is const-default-constructible if default-initialization
of T would invoke a user-provided constructor of T."
Since the "left_soec" and "right_spec" structs are PODs they are not
initialized per default. Due to the "constness" the variable can not be
modified later one, therefore the POD is in a state in which it is not
useful at all.
Since the mentioned structs are empty there would be no problem
in this case. This is an issue in the C++ standard (CWG Issue 253).
Some compilers already handle this issue with their own solution
despite the fact, that the standard did not provide a solution yet.
For some exotic compilers  (e.g. Tasking for TriCore) the include of
the "string_stream" header caused compilation errors:
"const variable "etl::left" requires an initializer -- class "etl::private_basic_format_spec::left_spec" has no user-provided default constructor"

References:
https://en.cppreference.com/w/cpp/language/default_initialization
https://cplusplus.github.io/CWG/issues/253.html
https://stackoverflow.com/questions/7411515/why-does-c-require-a-user-provided-default-constructor-to-default-construct-a
https://stackoverflow.com/questions/24943665/why-is-a-constructor-necessary-in-a-const-member-struct
2024-03-09 14:56:06 +00:00
John Wellbelove
b6db4195a3 Refactored etl::is_default_constructible definition 2024-03-09 12:03:52 +00:00
John Wellbelove
40326db14c Added etl::is_default_constructible_v 2024-03-09 10:31:20 +00:00
John Wellbelove
0cf4396fcb #854 in-place construction of shared message 2024-03-09 10:11:00 +00:00
John Wellbelove
71644ef90c Restored files in CMakeLists.txt 2024-03-09 10:04:07 +00:00
John Wellbelove
59178e495a Added etl::type_tag<T> 2024-03-09 10:03:26 +00:00
John Wellbelove
cbf08d1efa Refactored message_packet constructors 2024-03-09 10:03:01 +00:00
John Wellbelove
82b05faa59 Merge branch 'pull-request/#854-in-place-construction-of-shared-message' of https://github.com/ETLCPP/etl into pull-request/#854-in-place-construction-of-shared-message 2024-03-08 12:04:40 +00:00
John Wellbelove
d527816a2d Synchronised CMakeLists compiler options across projects 2024-03-08 12:03:45 +00:00
John Wellbelove
3ca09462a8 Fixed implicitly disabled copy constructor 2024-03-08 12:02:41 +00:00
SanderSmeenkInspiro
268ca4e04b
Add support for in-place instantiation of a shared message in the message pool (#854)
* #850 Fixed names according to Arduino's guidelines

* #850 Fixed names according to Arduino's guidelines

* Add support for in-place instantiation of a shared message in the message pool

---------

Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2024-03-08 10:02:47 +00:00
John Wellbelove
1e1ce38113 #850 Fixed names according to Arduino's guidelines 2024-03-08 09:31:27 +00:00
John Wellbelove
5fe759b44e #850 Fixed names according to Arduino's guidelines 2024-03-08 09:31:02 +00:00
John Wellbelove
e1d563a32f Added etl::is_default_constructible 2024-03-06 19:02:45 +00:00
John Wellbelove
95af36acd3 Refactored message_packet constructors 2024-03-06 19:02:00 +00:00
John Wellbelove
b89f62a789 Changed optional 'simple' types implementation for C++14 constexpr compatibility 2024-03-06 19:00:51 +00:00
John Wellbelove
131ed46598 Changed shadowed variables 2024-03-05 12:17:09 +00:00
John Wellbelove
de6e6ab13c Added tests for message base_type 2024-03-05 09:55:08 +00:00
John Wellbelove
c6dc700cf3 Added message type traits 2024-03-05 09:55:08 +00:00
John Wellbelove
4245e23bee Merge branch 'pull-request/#804-variant-varadic-default-constructed-state' into development 2024-03-04 20:08:24 +00:00
John Wellbelove
37ac046068 Added fixes for deque operator-(). Removed redundant operator that was causing compile errors for C++20
# Conflicts:
#	test/test_deque.cpp
2024-03-04 18:41:33 +00:00
John Wellbelove
7f13eeb06c Added fixes for deque operator-(). Removed redundant operator that was causing compile errors for C++20
# Conflicts:
#	test/test_deque.cpp
2024-03-04 13:10:17 +00:00
John Wellbelove
9689b69d2f Re-committed UML diagrams after HD crash 2024-03-04 12:57:02 +00:00
John Wellbelove
2e6ecf620b Updated initializer_list project file platform toolset 2024-03-04 12:56:14 +00:00
John Wellbelove
9a25ccbbae Removed duplicated include 2024-03-04 12:55:22 +00:00
John Wellbelove
573333586f Comment spelling fix 2024-03-04 12:55:03 +00:00
John Wellbelove
26e346e11e Added fixes for deque operator-(). Removed redundant operator that was causing compile errors for C++20 2024-03-04 12:54:38 +00:00
John Wellbelove
25a095652a Merge branch 'pull-request/#850-Fixed-names-according-to-arduino's-guidlines' into development
# Conflicts:
#	arduino/library-arduino.json
#	arduino/library-arduino.properties
2024-02-24 11:59:28 +00:00
John Wellbelove
a98d387a11 #850 Fixed names according to Arduino's guidelines 2024-02-24 11:49:54 +00:00
John Wellbelove
6d05d79dc2 #850 Fixed names according to Arduino's guidelines 2024-02-24 10:56:14 +00:00
Tom
1fe8fb461e
Fixed names according to arduino's guidlines (#850) 2024-02-24 10:49:06 +00:00
Manuel Seeböck
134f8e4209
variant varadic default constructed state (#804)
* fixed variant varadic default constructed state

* updated testcases to account for default contructor changes
2024-02-22 19:14:37 +00:00
John Wellbelove
f04fe0f383 Merge branch 'hotfix/#818-etl-apply-code-spell-check-across-entire-code-base' into development 2024-02-22 19:07:12 +00:00
Pisit Sawangvonganan
c92d970d09
etl: apply code spell check across entire code base (#818)
Utilized a spell checking tool to identify and correct spelling
throughout all files in the code base.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-02-22 19:06:23 +00:00
John Wellbelove
de3091a6bc Merge branch 'hotfix/#845-message_packet-missing-a-copy-constructor' into development 2024-02-18 12:08:26 +00:00
John Wellbelove
a2b7eb5d5a Added specific copy and move constructors for C++17 and above. 2024-02-18 12:08:11 +00:00
John Wellbelove
0791d39444 Merge branch 'pull-request/#843-In-subspan-function,-add-static-checks-on-extents' into development 2024-02-18 10:48:17 +00:00
John Wellbelove
aad8024ef1 Edited comments 2024-02-18 10:48:01 +00:00
mike919192
4b12e982e6
In subspan function, add static checks on extents (#843)
* In subspan function, add static checks on extents

* Change to ETL_STATIC_ASSERT.  Add static assert for first and last functions

* Add static assert to pre c++11 subspan

* Change extent to Extent to better match existing code
2024-02-16 09:21:25 +00:00
John Wellbelove
89eedd4563 Merge branch 'hotfix/#819-etl-optional-cannot-return-an-optional-object-of-self-from-member-function' into development
# Conflicts:
#	include/etl/optional.h
2024-02-15 11:10:31 +00:00
John Wellbelove
ea74d2f02f etl::optional C++ compatibility updates 2024-02-15 10:50:45 +00:00
John Wellbelove
3cbc73e0c9 Updated unit tests for constexpr optional 2024-02-09 11:04:39 +00:00
John Wellbelove
2619b9e307 Refactored etl::optional implementation 2024-02-02 12:42:07 +00:00
John Wellbelove
c92771088c #834 char_traits.h throws warning for GHS compiler 2024-01-31 09:50:11 +00:00
John Wellbelove
19eff9d69e Merge branch 'master' into development
# Conflicts:
#	include/etl/optional.h
2024-01-28 20:39:28 +00:00
John Wellbelove
3caffa148f Merge branch 'hotfix/#829-Possible-bug-on-assign-of-etl-array' into development 2024-01-28 20:35:22 +00:00
John Wellbelove
ad33083543 Added safe copy to etl::array::assign
etl::array::assign now returns an iterator
2024-01-28 20:35:07 +00:00
John Wellbelove
9ed453e7ef Merge branch 'hotfix/#827-Declaration-order-for-etl--first_set_bit_position-in-binary_h' into development 2024-01-28 09:20:49 +00:00
John Wellbelove
c0f2bec6ae Comment fix 2024-01-28 09:20:15 +00:00
Chiraffollo
84031659fa
Fix #832: Only copy/move storage value when optional is valid (#833) 2024-01-27 00:55:51 +00:00
John Wellbelove
1d6a068e0a Merge branch 'hotfix/#803-etl-unordered_map-buffer-overflow' into development 2024-01-25 16:35:56 +00:00
John Wellbelove
749396669b Added -Wnull-dereference flags to GCC and Clang unit test configurations 2024-01-25 16:33:56 +00:00
John Wellbelove
77513730e0 Fixed shadow warnings in all files
#823 Multiple variable shadowing warnings in private/bitset_new.h
2024-01-25 14:22:26 +00:00
John Wellbelove
d2c7a206e7 Removed AVR STL implementation from support 2024-01-23 13:43:57 +00:00
John Wellbelove
1a0036366d Added test for #819 2024-01-21 15:41:50 +00:00
John Wellbelove
664bdac4bd Initial refactor 2024-01-21 15:02:01 +00:00
John Wellbelove
51b10c498c Added to_ulong() and to_ullong() 2024-01-20 21:03:17 +00:00
John Wellbelove
5e78b48b6c #815 etl::remove_if calls predicate twice for first iterator, where predicate returns true. 2024-01-20 18:35:20 +00:00
John Wellbelove
816e87ae00 Merge branch 'feature/#774-Truncating-access-for-etl-bitset' into development
# Conflicts:
#	test/vs2022/etl.vcxproj.filters
2024-01-20 18:32:59 +00:00
John Wellbelove
5bc4160945 Merge branch 'feature/#774-Truncating-access-for-etl-bitset' of https://github.com/ETLCPP/etl into feature/#774-Truncating-access-for-etl-bitset 2024-01-20 18:10:40 +00:00
John Wellbelove
94ee20e2fd Fix C++ standard syntax compatibility for repair() 2024-01-20 18:10:34 +00:00
John Wellbelove
db878c54c5 Fix C++ standard syntax compatibility for repair() 2024-01-20 10:10:55 +00:00
John Wellbelove
83e23b9adf Fix C++ standard syntax compatibility for repair() 2024-01-20 10:08:15 +00:00
John Wellbelove
1825c54570 Minor C++ standards compatibility tweaks 2024-01-20 09:44:51 +00:00
John Wellbelove
47d3d67a14 Modified definition of bitset::Storage_Type for compatibility with C++03 2024-01-18 09:54:07 +00:00
John Wellbelove
bb1df0839b Merge branch 'development' of https://github.com/ETLCPP/etl into development 2024-01-18 09:30:16 +00:00
John Wellbelove
0770e76d42 Merge branch 'pull-request/#812-Implement-SAE-J1850-CRC8' into development 2024-01-18 09:30:11 +00:00
John Wellbelove
4b39d012be Merge branch 'pull-request/#812-Implement-SAE-J1850-CRC8' into development 2024-01-18 08:58:15 +00:00
John Wellbelove
279a59fa59 Added syntax checks for crc8_j1850 & crc8_j1850_zero 2024-01-18 08:57:50 +00:00
Drew Rife
ac4c3e67e6
Implement SAE J1850 CRC8 and "Zero" version (#812)
* feat: added 8bit j1850 crc parameters

* feat: add crc8 j1850 header

* feat: add crc j1850 zero header

* feat: add the crc j1850 headers to crc.h

* test: j1850 4 constructor

* build: crc8 j1850 tests

* test: crc8 j1850 4 add values

* test: crc8 j1850 4 add range

* test: crc8 j1850 4 add range via iterator

* test: crc8 j1850 4 add range endian

* test: crc8 j1850 16 constructor

* test: crc8 j1850 16 add values

* test: crc8 j1850 16 add range

* test: crc8 j1850 16 add range via iterator

* test: crc8 j1850 16 add range endian

* test: crc8 j1850 156 constructor

* test: crc8 j1850 256 add values

* test: crc8 j1850 256 add range

* test: crc8 j1850 add range via iterator

* test: crc8 j1850 256 add range endian

* test: initial commit of crc j1850 zero tests

* build: crc8 j1850 zero tests

* test: crc8 j1850 zero 4 add values

* test: crc8 j1850 zero 4 add range

* test: crc8 j1850 zero 4 add range via iterator

* test: crc8 j1850 zero 4 add range endian

* test: crc8 j1850 zero 16 constructor

* test: crc8 j1850 zero 16 add values

* test: crc8 j1850 zero 16 add range

* test: crc8 j1850 zero 16 add range via iterator

* test: crc8 j1850 zero 16 add range endian

* test: crc8 j1850 zero 256 constructor

* test: crc8 j1850 zero 256 add values

* test: crc8 j1850 zero 256 add range

* test: crc8 j1850 zero 256 add range via iterator

* test: crc8 j1850 zero 256 add range endian

* fix: header include guards
2024-01-13 11:48:55 +00:00
John Wellbelove
3d3dad8499 Work in progress 2024-01-13 11:45:57 +00:00
John Wellbelove
3ca624efb0 Changed case of template constants 2024-01-13 11:45:38 +00:00
John Wellbelove
8f6055e99b Removed ETL_STATIC_CONSTANT 2024-01-13 11:44:59 +00:00
John Wellbelove
ce7ce3bb72 Make binary functor operator() const 2024-01-13 11:44:40 +00:00
John Wellbelove
0f1840a70d
Update LICENSE 2024-01-10 08:51:03 +00:00
John Wellbelove
9bf8da3d26 Updated Arduino library files 2024-01-04 00:12:36 +00:00
John Wellbelove
a7271e470a Work in progress
Comprehensive bitset type comparisons
2024-01-04 00:11:54 +00:00
John Wellbelove
78d2ccf55e Work in progress
Finished updating explicit single element tests for bitset_ext
2023-12-29 16:00:10 +00:00
John Wellbelove
58f469ebd4 Work in progress
Finished updating explicit single element tests
2023-12-29 09:33:20 +00:00
John Wellbelove
c20e3dee3f Merge branch 'feature/#774-Truncating-access-for-etl-bitset' of https://github.com/ETLCPP/etl into feature/#774-Truncating-access-for-etl-bitset
# Conflicts:
#	include/etl/binary.h
#	test/run-syntax-checks.sh
#	test/run-tests.sh
#	test/test_binary.cpp
2023-12-18 15:45:41 +00:00
John Wellbelove
c5c88ae010 Work in progress 2023-12-18 15:28:32 +00:00
John Wellbelove
aa4b27b6e6 Work in progress for etl::bitset::extract 2023-12-18 15:21:05 +00:00
John Wellbelove
236af6190a Work in progress for etl::bitset::extract 2023-12-18 15:21:05 +00:00
John Wellbelove
2c8aafedcd Work in progress for etl::bitset::extract 2023-12-18 15:21:05 +00:00
John Wellbelove
a5b425f03e Work in progress for etl::bitset::extract 2023-12-18 15:21:04 +00:00
John Wellbelove
6d941298ea Improved display of CHECK_EQUAL_HEX in unittest++ 2023-12-18 15:15:09 +00:00
John Wellbelove
d3b3fdbd40 Fixed 'nodiscard' keyword errors 2023-12-18 11:28:12 +00:00
John Wellbelove
c75617c2b6 #805 legacy etl::bitset set/reset does not work if the element type is greater than 8 bit 2023-12-18 11:07:42 +00:00
John Wellbelove
d17f422dac Added binary functors for ~ & | ^ 2023-12-18 11:02:54 +00:00
John Wellbelove
480363a4e7 Added etl::generate algorithm 2023-12-18 10:52:40 +00:00
John Wellbelove
7bb125a360 Added etl::generate algorithm 2023-12-17 12:54:01 +00:00
John Wellbelove
59cd9e66d7 #807 Change in legacy etl::bitset with nullptr construction + error handling
Harmonised operation of legacy and new etl::bitset
Added ETL_ASSERT checks for nullptr buffer pointers for etl::bitset_ext
2023-12-16 12:57:36 +00:00
John Wellbelove
8f88aa0141 Fixed etl::optional operator =() for invalid values with non-pod types 2023-12-15 10:06:21 +00:00
John Wellbelove
489429bd7c Fixed operator == implementations 2023-12-13 09:58:44 +00:00
John Wellbelove
dd060d5013 Updated version and release 2023-12-10 16:25:45 +00:00
John Wellbelove
f500cd29a8 Prioritize ETL_TARGET_OS_* for mutex selection 2023-12-10 12:57:39 +00:00
John Wellbelove
783be74dd3 Updated version and release notes 2023-12-08 09:26:23 +00:00
John Wellbelove
eba9c5797d Added CRC1 (AKA Parity)
Modified test suit names
2023-12-08 09:03:17 +00:00
John Wellbelove
9161413337 Merge branch 'hotfix/#799-Iterator-returned-by-crc.input()-does-not-satisfy-std--output_iterator' into development 2023-12-08 08:46:34 +00:00
John Wellbelove
6775dba40d Fixed output iterator for frame_check_sequence and pseudo_moving_average 2023-12-08 08:46:16 +00:00
John Wellbelove
4b97e82876 Added CRC1 (AKA Parity)
Modified test suit names
2023-12-07 16:19:46 +00:00
John Wellbelove
6a48eef934 Merge branch 'master' of https://github.com/ETLCPP/etl 2023-12-05 14:29:56 +00:00
John Wellbelove
9492ca101c Corrected clang version name detection 2023-12-05 14:29:44 +00:00
John Wellbelove
0ded4390dc Merge branch 'development' of https://github.com/ETLCPP/etl into development
# Conflicts:
#	support/Release notes.txt
2023-12-05 14:29:27 +00:00
John Wellbelove
bd4db45a9b Updated release notes 2023-12-05 14:29:01 +00:00
John Wellbelove
390111f3f7 Merge branch 'master' of https://github.com/ETLCPP/etl 2023-12-05 14:26:52 +00:00
John Wellbelove
9cb646a286 Corrected clang version name detection 2023-12-05 14:26:45 +00:00
John Wellbelove
ddaa3d55be Updated release notes 2023-12-05 14:26:16 +00:00
John Wellbelove
1027e66279 #795 etl::private_variant doesn't fully respect the chosen error reporting. 2023-12-05 14:24:32 +00:00
John Wellbelove
e5db17f0c9 Merge branch 'master' of https://github.com/ETLCPP/etl 2023-12-05 13:57:10 +00:00
John Wellbelove
8521eea25e Corrected clang version name detection 2023-12-05 13:57:04 +00:00
John Wellbelove
82482a43a4 Updated release notes 2023-12-05 13:56:49 +00:00
John Wellbelove
76f8664ed6 Corrected clang version name detection 2023-12-05 11:27:06 +00:00
John Wellbelove
bdba48016b typo 2023-12-05 09:59:44 +00:00
John Wellbelove
5c3341ea93 Updated release notes 2023-12-05 09:55:51 +00:00
John Wellbelove
8aa799a3cb Added check for NAN definitions for C++11 FP functions 2023-12-05 09:53:47 +00:00
John Wellbelove
305f34fbed Work in progress for etl::bitset::extract 2023-12-04 08:37:59 +00:00
John Wellbelove
1149133384 Updated script text 2023-12-04 08:37:42 +00:00
John Wellbelove
5b4e991ee8 Added additional etl::make_lsb_mask and etl::make_msb_mask binary functions 2023-12-04 08:37:10 +00:00
John Wellbelove
48bbfa0c53 Merge branch 'feature/#774-Truncating-access-for-etl-bitset' of https://github.com/ETLCPP/etl into feature/#774-Truncating-access-for-etl-bitset 2023-12-02 17:47:25 +00:00
John Wellbelove
18a1c76ec6 Work in progress for etl::bitset::extract 2023-12-02 17:47:20 +00:00
John Wellbelove
9064eecee2 Work in progress for etl::bitset::extract 2023-12-02 17:46:38 +00:00
John Wellbelove
3d3f87564d Work in progress for etl::bitset::extract 2023-12-01 17:21:48 +00:00
John Wellbelove
863dd24cc4 Work in progress for etl::bitset::extract 2023-11-29 18:22:34 +00:00
John Wellbelove
c3603c4d7e Improved display of CHECK_EQUAL_HEX in unittest++ 2023-11-29 18:21:47 +00:00
John Wellbelove
5622a98571 Refactoring 2023-10-31 11:12:07 +01:00
John Wellbelove
feb7c60609 Merge branch 'feature/Base64-codec' of https://github.com/ETLCPP/etl into feature/Base64-codec
# Conflicts:
#	test/test_base64_RFC4648_with_padding.cpp
2023-10-29 09:01:33 +01:00
John Wellbelove
23a76d2371 Refactored back_inserter support 2023-10-29 09:01:08 +01:00
John Wellbelove
9a5ed96f8e Renamed test file 2023-10-29 09:00:49 +01:00
John Wellbelove
02e69f5757 Added padding flag 2023-10-29 09:00:49 +01:00
John Wellbelove
b1a042385f Removed static from encode and decode functions 2023-10-29 09:00:49 +01:00
John Wellbelove
0523fc869a Static version of Base64 - RFC-6848 - No optional padding 2023-10-29 09:00:49 +01:00
John Wellbelove
58c55a8bb6 Updates 2023-10-29 08:59:11 +01:00
John Wellbelove
f9233f99ab Refactor to support multiple RFCs 2023-10-29 08:58:11 +01:00
John Wellbelove
8db9613320 Renamed test file 2023-10-29 08:58:11 +01:00
John Wellbelove
5016d4033f Added padding flag 2023-10-29 08:58:10 +01:00
John Wellbelove
456a56e7aa Removed static from encode and decode functions 2023-10-29 08:58:10 +01:00
John Wellbelove
25338fb0d1 Static version of Base64 - RFC-6848 - No optional padding 2023-10-29 08:58:10 +01:00
John Wellbelove
91a150e37b Updates 2023-10-29 08:58:10 +01:00
John Wellbelove
b4ea535fc5 Refactored back_inserter support 2023-10-23 19:33:37 +01:00
John Wellbelove
804651f3eb Merge branch 'feature/Base64-codec' of https://github.com/ETLCPP/etl into feature/Base64-codec
# Conflicts:
#	include/etl/base64.h
#	include/etl/version.h
#	library.json
#	library.properties
#	test/test_base64_RFC4648_with_padding.cpp
#	version.txt
2023-10-23 10:05:27 +01:00
John Wellbelove
b99fa790c2 Refactor to support multiple RFCs 2023-10-23 10:01:33 +01:00
John Wellbelove
a92b28fdea Renamed test file 2023-10-23 10:01:33 +01:00
John Wellbelove
5dad4402c6 Added padding flag 2023-10-23 10:01:33 +01:00
John Wellbelove
702b0ef3a2 Removed static from encode and decode functions 2023-10-23 10:01:33 +01:00
John Wellbelove
5ad7fd2f90 Static version of Base64 - RFC-6848 - No optional padding 2023-10-23 10:01:32 +01:00
John Wellbelove
fd67662a8e Updates 2023-10-23 10:00:49 +01:00
John Wellbelove
d9e672d066 Renamed test file 2023-10-21 18:18:26 +01:00
John Wellbelove
ab1c3db7d9 Added padding flag 2023-10-21 11:41:35 +01:00
John Wellbelove
531cdbc872 Removed static from encode and decode functions 2023-10-21 10:41:06 +01:00
John Wellbelove
2ea76c99af Static version of Base64 - RFC-6848 - No optional padding 2023-10-21 10:27:42 +01:00
John Wellbelove
a1e5f1c7c9 Updates 2023-10-15 11:45:44 +01:00
John Wellbelove
c07d8551fc Merge branch 'feature/#757-Add-time-date-classes' of https://github.com/ETLCPP/etl into feature/#757-Add-time-date-classes 2023-09-20 21:29:22 +01:00
John Wellbelove
b6e75065f4 Merge branch 'feature/#757-Add-time-date-classes' of https://github.com/ETLCPP/etl into feature/#757-Add-time-date-classes 2023-09-20 21:29:16 +01:00
John Wellbelove
09d7849a9e Merge branch 'feature/#757-Add-time-date-classes' of https://github.com/ETLCPP/etl into feature/#757-Add-time-date-classes 2023-09-17 20:09:11 +01:00
John Wellbelove
501a73a9b7 Merge branch 'feature/#757-Add-time-date-classes' of https://github.com/ETLCPP/etl into feature/#757-Add-time-date-classes 2023-09-17 20:09:03 +01:00
John Wellbelove
bc6da1eb48 Merge branch 'feature/#757-Add-time-date-classes' of https://github.com/ETLCPP/etl into feature/#757-Add-time-date-classes 2023-09-17 19:49:56 +01:00
John Wellbelove
c509333c1f Merge branch 'feature/#757-Add-time-date-classes' of https://github.com/ETLCPP/etl into feature/#757-Add-time-date-classes 2023-09-17 19:49:49 +01:00
John Wellbelove
20abdadeb1 Merge branch 'feature/#757-Add-time-date-classes' of https://github.com/ETLCPP/etl into feature/#757-Add-time-date-classes 2023-09-16 19:26:49 +01:00
John Wellbelove
5c6d32df51 Merge branch 'feature/#757-Add-time-date-classes' of https://github.com/ETLCPP/etl into feature/#757-Add-time-date-classes 2023-09-16 19:26:44 +01:00
John Wellbelove
4affd4f9d8 Merge branch 'feature/#757-Add-time-date-classes' of https://github.com/ETLCPP/etl into feature/#757-Add-time-date-classes 2023-09-14 18:49:52 +01:00
John Wellbelove
f9d27d93ba Merge branch 'feature/#757-Add-time-date-classes' of https://github.com/ETLCPP/etl into feature/#757-Add-time-date-classes 2023-09-14 18:49:45 +01:00
John Wellbelove
479fd098af Merge branch 'feature/#757-Add-time-date-classes' of https://github.com/ETLCPP/etl into feature/#757-Add-time-date-classes 2023-09-12 10:32:32 +01:00
John Wellbelove
9a49f01a3b Merge branch 'feature/#757-Add-time-date-classes' of https://github.com/ETLCPP/etl into feature/#757-Add-time-date-classes
# Conflicts:
#	include/etl/private/chrono/day.h
#	test/test_chrono_day.cpp
2023-09-12 10:32:26 +01:00
John Wellbelove
a44a77c550 Merge branch 'feature/#757-Add-time-date-classes' of https://github.com/ETLCPP/etl into feature/#757-Add-time-date-classes
# Conflicts:
#	include/etl/private/chrono/day.h
#	test/test_chrono_day.cpp
2023-09-12 10:32:00 +01:00
John Wellbelove
8c78fdab04 Work in progress 2023-09-12 09:53:18 +01:00
John Wellbelove
3f1aa09454 Work in progress 2023-09-11 11:15:49 +01:00
995 changed files with 241080 additions and 91876 deletions

View File

@ -1,51 +1,184 @@
---
#------------------------------------
# Configuration for clang-format v12
#------------------------------------
BasedOnStyle: LLVM
Standard: Auto # let the formatter accept any C++ standard
Language: Cpp
# =============================================================================
# Indentation
# =============================================================================
TabWidth: 2
ContinuationIndentWidth: 2
ConstructorInitializerIndentWidth: 2
NamespaceIndentation: All # everything inside namespace is indented
IndentCaseLabels: true # case labels at switch-body indent level
IndentCaseBlocks: true # indent block inside case label
IndentExternBlock: Indent
IndentWrappedFunctionNames: true # keep function name at same indent as return type
IndentPPDirectives: BeforeHash # nested #if / #include get indented before the #
PPIndentWidth: 2
SortIncludes: true
# =============================================================================
# Braces & line-break style
# =============================================================================
BreakBeforeBraces: Allman
BreakConstructorInitializers: BeforeComma # colon on new line, commas lead
BreakInheritanceList: BeforeComma
BreakBeforeBinaryOperators: NonAssignment
BreakStringLiterals: false
AlwaysBreakTemplateDeclarations: Yes # template <…> always on its own line
BreakAfterAttributes: Always
BasedOnStyle: Chromium
# =============================================================================
# Short statements
# =============================================================================
AllowShortBlocksOnASingleLine: Empty
AllowShortFunctionsOnASingleLine: Empty # only empty bodies: void f() {}
AllowShortCaseLabelsOnASingleLine: true # case X: stmt; break; on one line
AllowShortLoopsOnASingleLine: true
AllowShortLambdasOnASingleLine: Inline
BinPackParameters: false
BitFieldColonSpacing: Both
# =============================================================================
# Empty lines
# =============================================================================
KeepEmptyLinesAtTheStartOfBlocks: false
EmptyLineBeforeAccessModifier: Always # blank line before public:/private:/protected:
EmptyLineAfterAccessModifier: Always # blank line after public:/private:/protected:
InsertNewlineAtEOF: true
BreakBeforeBraces: Allman
BreakConstructorInitializers: BeforeComma
# =============================================================================
# Spacing
# =============================================================================
SpacesInAngles: Leave # preserve C++03 "> >" vs C++11 ">>"
SpacesInContainerLiterals: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
ConstructorInitializerAllOnOneLineOrOnePerLine: 'true'
ConstructorInitializerIndentWidth: '2'
NamespaceIndentation: All
IndentPPDirectives: BeforeHash
PointerAlignment: Left
ColumnLimit: '0'
ContinuationIndentWidth: '2'
UseTab: Never
TabWidth: '2'
IndentWidth: '2'
AccessModifierOffset : '-2'
IndentCaseLabels: false
Cpp11BracedListStyle: 'true'
AlignAfterOpenBracket: Align
# =============================================================================
# Alignment
# =============================================================================
PointerAlignment: Left # T* ptr, const T& ref
ReferenceAlignment: Left
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignConsecutiveBitFields: true
AlignConsecutiveMacros: true # align macro bodies
#------------------------------------
# Configurations not supported by clang-format v12
#------------------------------------
# BreakInheritanceList: AfterComma
# EmptyLineBeforeAccessModifier: Always
# EmptyLineAfterAccessModifier: Always
# ReferenceAlignment: Left
# =============================================================================
# Line length and wrapping
# =============================================================================
ColumnLimit: 150
ReflowComments: true # preserve hand-formatted comment rulers
AlignEscapedNewlines: Left
...
# =============================================================================
# Includes
# =============================================================================
IncludeCategories:
- Regex: '^(<|")(.*/)?platform\.h(>|")$'
Priority: -1
- Regex: 'private'
Priority: 1
- Regex: '.*'
Priority: 0
# =============================================================================
# Arguments, parameters and constructor initialisers
# =============================================================================
PackConstructorInitializers: Never # each initialiser on its own line
# =============================================================================
# Namespaces and using declarations
# =============================================================================
SortUsingDeclarations: Lexicographic
# =============================================================================
# Macro-aware formatting
# =============================================================================
# ETL-specific macros that should be treated as statement-level constructs
StatementMacros:
- ETL_DECLARE_DEBUG_COUNT
- ETL_INCREMENT_DEBUG_COUNT
- ETL_DECREMENT_DEBUG_COUNT
- ETL_ADD_DEBUG_COUNT
- ETL_STATIC_ASSERT
- ETL_ASSERT
- ETL_ASSERT_OR_RETURN
- ETL_ASSERT_OR_RETURN_VALUE
- ETL_ASSERT_FAIL
- ETL_ASSERT_FAIL_AND_RETURN
- ETL_ASSERT_FAIL_AND_RETURN_VALUE
- ETL_MOVE
- ETL_ENUM_CLASS
- ETL_ENUM_CLASS_TYPE
- ETL_IF_CONSTEXPR
# Macros that behave like attributes or specifiers.
AttributeMacros:
- ETL_NORETURN
- ETL_FINAL
- ETL_OVERRIDE
- ETL_EXPLICIT
- ETL_DELETE
- ETL_CONSTANT
- ETL_CONSTEXPR
- ETL_CONSTEXPR11
- ETL_CONSTEXPR14
- ETL_CONSTEXPR17
- ETL_CONSTEXPR20
- ETL_CONSTEXPR23
- ETL_CONSTEVAL
- ETL_NODISCARD
- ETL_NORETURN
- ETL_DEPRECATED
- ETL_DEPRECATED_REASON
- ETL_LIKELY
- ETL_UNLIKELY
- ETL_FALLTHROUGH
- ETL_MAYBE_UNUSED
- ETL_INLINE_VAR
- ETL_ASSUME
- ETL_LVALUE_REF_QUALIFIER
- ETL_RVALUE_REF_QUALIFIER
- ETL_NOEXCEPT
- ETL_NOEXCEPT_EXPR
- ETL_NOEXCEPT_IF
- ETL_NOEXCEPT_FROM
Macros:
- ETL_NORETURN=[[noreturn]]
- ETL_FINAL=final
- ETL_OVERRIDE=override
- ETL_EXPLICIT=explicit
- ETL_DELETE=delete
- ETL_CONSTANT=const
- ETL_CONSTEXPR=constexpr
- ETL_CONSTEXPR11=constexpr
- ETL_CONSTEXPR14=constexpr
- ETL_CONSTEXPR17=constexpr
- ETL_CONSTEXPR20=constexpr
- ETL_CONSTEXPR23=constexpr
- ETL_CONSTEVAL=consteval
- ETL_NODISCARD=[[nodiscard]]
- ETL_NORETURN=[[noreturn]]
- ETL_DEPRECATED=[[deprecated]]
# - ETL_DEPRECATED_REASON=[[deprecated(%0)]] # Hangs with clang-format 18
- ETL_LIKELY=[[likely]]
- ETL_UNLIKELY=[[unlikely]]
- ETL_FALLTHROUGH=[[fallthrough]]
- ETL_MAYBE_UNUSED=[[maybe_unused]]
- ETL_INLINE_VAR=inline
- ETL_ASSUME=[[assume(&0)]]
- ETL_LVALUE_REF_QUALIFIER=&
- ETL_RVALUE_REF_QUALIFIER=&&
- ETL_NOEXCEPT=noexcept
# - ETL_NOEXCEPT_EXPR=noexcept(&0)) # Hangs with clang-format 18
# - ETL_NOEXCEPT_IF=noexcept(&0) # Hangs with clang-format 18
# - ETL_NOEXCEPT_FROM=noexcept(&0) # Hangs with clang-format 18
# Macros that behave like type names
TypenameMacros:
- ETL_OR_STD
# Do not reformat these macros — they contain DSL-like content
WhitespaceSensitiveMacros:
- ETL_ERROR_TEXT
- ETL_DECLARE_ENUM_TYPE
- ETL_ENUM_TYPE
- ETL_END_ENUM_TYPE

200
.coderabbit.yaml Normal file
View File

@ -0,0 +1,200 @@
language: "en-GB"
early_access: false
reviews:
profile: "chill"
request_changes_workflow: false
high_level_summary: false
high_level_summary_in_walkthrough: false
poem: false
review_status: false
collapse_walkthrough: false
changed_files_summary: false
sequence_diagrams: false
estimate_code_review_effort: false
assess_linked_issues: false
related_issues: false
related_prs: false
suggested_labels: false
suggested_reviewers: false
auto_review:
enabled: true
drafts: false
path_instructions:
- path: "include/etl/*.h"
instructions: |
Review the C++ code in these directories. The code must not use
STL containers but must instead rely on Embedded Template Library
(ETL) for data structures and algorithms.
When answering questions, provide accurate and concise information based on the ETL documentation and codebase. If you don't know the answer, just say "I don't know". Do not make up answers.
When providing code examples, ensure they are relevant to the ETL and follow its conventions.
Always be polite and professional in your responses.
Header files should start with the ETL's standard MIT comment block.
Header files should have include guards in the format '#ifndef ETL_<FILENAME>>_INCLUDED #define ETL_<FILENAME>_INCLUDED #endif'
Headers should be organized in the following order
- The first header include should be '#include "platform.h"'
- Headers from the ETL
- Headers from the path 'private/**'
- C++ standard library headers
- C standard library headers
Pay extra attention to the following
- Buffer overflows
- Memory leaks
- Undefined behavior
Check that the following conventions are used
- Variable names should be in `snake_case`
- Macro constants should be `ALL_CAPS_WITH_UNDERSCORES`
- Macro constants should be prefixed with 'ETL_'
- Function, class, and type names should be `snake_case`
- enum members should be `Caps_Snake_Case`
Please keep your outputs short and to the point, unless otherwise asked
- Keep your responses short, describe small issues in a few sentences
- Don't output tips, analysis chains or anything else with a collapsible view
- Don't output `comment summaries` or `fix prompts for AIs`
- If the highlighted issue is complex, don't suggest a solution
- Don't use emojis
- path: "include/etl/atomic/*.h"
instructions: |
Review the C++ code in these directories. The code must not use
STL containers but must instead rely on Embedded Template Library
(ETL) for data structures and algorithms.
When answering questions, provide accurate and concise information based on the ETL documentation and codebase. If you don't know the answer, just say "I don't know". Do not make up answers.
When providing code examples, ensure they are relevant to the ETL and follow its conventions.
Always be polite and professional in your responses.
Header files should start with the ETL's standard MIT comment block.
Header files are allowed to not have include guards
Headers should be organized in the following order
- Headers from the ETL
- Headers from the path 'private/**'
- C++ standard library headers
- C standard library headers
Pay extra attention to the following
- Buffer overflows
- Memory leaks
- Undefined behavior
Check that the following conventions are used
- Variable names should be in `snake_case`
- Macro constants should be `ALL_CAPS_WITH_UNDERSCORES`
- Macro constants should be prefixed with 'ETL_'
- Function, class, and type names should be `snake_case`
- enum members should be `Caps_Snake_Case`
Please keep your outputs short and to the point, unless otherwise asked
- Keep your responses short, describe small issues in a few sentences
- Don't output tips, analysis chains or anything else with a collapsible view
- Don't output `comment summaries` or `fix prompts for AIs`
- If the highlighted issue is complex, don't suggest a solution
- Don't use emojis
- path: "include/etl/atomic/*.h"
instructions: |
Review the C++ code in these directories. The code must not use
STL containers but must instead rely on Embedded Template Library
(ETL) for data structures and algorithms.
When answering questions, provide accurate and concise information based on the ETL documentation and codebase. If you don't know the answer, just say "I don't know". Do not make up answers.
When providing code examples, ensure they are relevant to the ETL and follow its conventions.
Always be polite and professional in your responses.
Header files should start with the ETL's standard MIT comment block.
Header files are allowed to not have include guards
Headers should be organized in the following order
- Headers from the ETL
- Headers from the path 'private/**'
- C++ standard library headers
- C standard library headers
Pay extra attention to the following
- Buffer overflows
- Memory leaks
- Undefined behavior
Check that the following conventions are used
- Variable names should be in `snake_case`
- Macro constants should be `ALL_CAPS_WITH_UNDERSCORES`
- Macro constants should be prefixed with 'ETL_'
- Function, class, and type names should be `snake_case`
- enum members should be `Caps_Snake_Case`
Please keep your outputs short and to the point, unless otherwise asked
- Keep your responses short, describe small issues in a few sentences
- Don't output tips, analysis chains or anything else with a collapsible view
- Don't output `comment summaries` or `fix prompts for AIs`
- If the highlighted issue is complex, don't suggest a solution
- Don't use emojis
- path: "include/etl/mutex/*.h"
instructions: |
Review the C++ code in these directories. The code must not use
STL containers but must instead rely on Embedded Template Library
(ETL) for data structures and algorithms.
When answering questions, provide accurate and concise information based on the ETL documentation and codebase. If you don't know the answer, just say "I don't know". Do not make up answers.
When providing code examples, ensure they are relevant to the ETL and follow its conventions.
Always be polite and professional in your responses.
Header files should start with the ETL's standard MIT comment block.
Header files are allowed to not have include guards
Headers should be organized in the following order
- Headers from the ETL
- Headers from the path 'private/**'
- C++ standard library headers
- C standard library headers
Pay extra attention to the following
- Buffer overflows
- Memory leaks
- Undefined behavior
Check that the following conventions are used
- Variable names should be in `snake_case`
- Macro constants should be `ALL_CAPS_WITH_UNDERSCORES`
- Macro constants should be prefixed with 'ETL_'
- Function, class, and type names should be `snake_case`
- enum members should be `Caps_Snake_Case`
Please keep your outputs short and to the point, unless otherwise asked
- Keep your responses short, describe small issues in a few sentences
- Don't output tips, analysis chains or anything else with a collapsible view
- Don't output `comment summaries` or `fix prompts for AIs`
- If the highlighted issue is complex, don't suggest a solution
- Don't use emojis
- path: "include/etl/deprecated/*.h"
instructions: |
Ingnore files in this directory
- path: "include/etl/experimental/*.h"
instructions: |
Ingnore files in this directory
- path: "include/etl/generators/*.h"
instructions: |
Ingnore files in this directory
- path: "include/etl/profiles/*.h"
instructions: |
Ingnore files in this directory
chat:
art: false
auto_reply: true

61
.devcontainer/Dockerfile Normal file
View File

@ -0,0 +1,61 @@
ARG BASE_IMAGE_NAME="mcr.microsoft.com/devcontainers/cpp:2@sha256:a5eb5a1e9109af88bf82ebb0f71903608a68144851ed1e4b852e31b251ac59c6"
FROM ${BASE_IMAGE_NAME}
ARG DEBIAN_SNAPSHOT="20260223T000000Z"
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ENV LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
TZ=UTC
RUN set -eux \
&& export DEBIAN_FRONTEND=noninteractive \
&& if [[ "${DEBIAN_SNAPSHOT}" != "none" ]]; then \
snapshot_main="http://snapshot.debian.org/archive/debian/${DEBIAN_SNAPSHOT}"; \
snapshot_security="http://snapshot.debian.org/archive/debian-security/${DEBIAN_SNAPSHOT}"; \
if [[ -f /etc/apt/sources.list.d/debian.sources ]]; then \
sed -ri "s|^URIs: https?://deb.debian.org/debian$|URIs: ${snapshot_main}|g" /etc/apt/sources.list.d/debian.sources; \
sed -ri "s|^URIs: https?://deb.debian.org/debian-security$|URIs: ${snapshot_security}|g" /etc/apt/sources.list.d/debian.sources; \
elif [[ -f /etc/apt/sources.list ]] || compgen -G "/etc/apt/sources.list.d/*.list" > /dev/null; then \
for list_file in /etc/apt/sources.list /etc/apt/sources.list.d/*.list; do \
[[ -f "${list_file}" ]] || continue; \
sed -ri "s|https?://deb.debian.org/debian|${snapshot_main}|g" "${list_file}"; \
sed -ri "s|https?://security.debian.org/debian-security|${snapshot_security}|g" "${list_file}"; \
sed -ri "s|https?://deb.debian.org/debian-security|${snapshot_security}|g" "${list_file}"; \
done; \
else \
echo "ERROR: DEBIAN_SNAPSHOT='${DEBIAN_SNAPSHOT}' is set, but no supported apt source files were found."; \
echo "Expected /etc/apt/sources.list.d/debian.sources or one or more .list files under /etc/apt/."; \
exit 1; \
fi; \
printf 'Acquire::Check-Valid-Until "false";\n' > /etc/apt/apt.conf.d/99snapshot; \
fi \
&& apt-get update \
&& apt-get -y install --no-install-recommends \
python3-full \
python3-pip \
git \
wget \
cmake \
&& rm -rf /var/lib/apt/lists/* \
&& if pip help install | grep -q '\-\-break-system-packages'; then \
pip install --no-cache-dir --break-system-packages cogapp; \
else \
pip install --no-cache-dir cogapp; \
fi
RUN set -eux \
&& echo "Pip version: " \
&& pip --version \
&& echo "Cogapp version: " \
&& pip show cogapp \
&& echo "Git version: " \
&& git --version \
&& echo "Wget version: " \
&& wget --version \
&& echo "Cmake version: " \
&& cmake --version \
&& echo "Make version: " \
&& make --version

View File

@ -0,0 +1,13 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "Clang 10",
"build": {
"dockerfile": "../Dockerfile",
"args": {
"BASE_IMAGE_NAME": "silkeh/clang:10",
"DEBIAN_SNAPSHOT": "none"
},
"context": "../context"
}
}

View File

@ -0,0 +1,13 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "Clang 11",
"build": {
"dockerfile": "../Dockerfile",
"args": {
"BASE_IMAGE_NAME": "silkeh/clang:11",
"DEBIAN_SNAPSHOT": "none"
},
"context": "../context"
}
}

View File

@ -0,0 +1,13 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "Clang 12",
"build": {
"dockerfile": "../Dockerfile",
"args": {
"BASE_IMAGE_NAME": "silkeh/clang:12",
"DEBIAN_SNAPSHOT": "none"
},
"context": "../context"
}
}

View File

@ -0,0 +1,13 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "Clang 13",
"build": {
"dockerfile": "../Dockerfile",
"args": {
"BASE_IMAGE_NAME": "silkeh/clang:13",
"DEBIAN_SNAPSHOT": "none"
},
"context": "../context"
}
}

View File

@ -0,0 +1,13 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "Clang 14",
"build": {
"dockerfile": "../Dockerfile",
"args": {
"BASE_IMAGE_NAME": "silkeh/clang:14",
"DEBIAN_SNAPSHOT": "none"
},
"context": "../context"
}
}

View File

@ -0,0 +1,13 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "Clang 15",
"build": {
"dockerfile": "../Dockerfile",
"args": {
"BASE_IMAGE_NAME": "silkeh/clang:15",
"DEBIAN_SNAPSHOT": "none"
},
"context": "../context"
}
}

View File

@ -0,0 +1,13 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "Clang 16",
"build": {
"dockerfile": "../Dockerfile",
"args": {
"BASE_IMAGE_NAME": "silkeh/clang:16",
"DEBIAN_SNAPSHOT": "none"
},
"context": "../context"
}
}

View File

@ -0,0 +1,13 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "Clang 17",
"build": {
"dockerfile": "../Dockerfile",
"args": {
"BASE_IMAGE_NAME": "silkeh/clang:17",
"DEBIAN_SNAPSHOT": "none"
},
"context": "../context"
}
}

View File

@ -0,0 +1,13 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "Clang 18",
"build": {
"dockerfile": "../Dockerfile",
"args": {
"BASE_IMAGE_NAME": "silkeh/clang:18-bullseye",
"DEBIAN_SNAPSHOT": "none"
},
"context": "../context"
}
}

View File

@ -0,0 +1,13 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "Clang 19",
"build": {
"dockerfile": "../Dockerfile",
"args": {
"BASE_IMAGE_NAME": "silkeh/clang:19-bullseye",
"DEBIAN_SNAPSHOT": "none"
},
"context": "../context"
}
}

View File

@ -0,0 +1,13 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "Clang 20",
"build": {
"dockerfile": "../Dockerfile",
"args": {
"BASE_IMAGE_NAME": "silkeh/clang:20-bullseye",
"DEBIAN_SNAPSHOT": "none"
},
"context": "../context"
}
}

View File

@ -0,0 +1,13 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "Clang 21",
"build": {
"dockerfile": "../Dockerfile",
"args": {
"BASE_IMAGE_NAME": "silkeh/clang:21-bullseye",
"DEBIAN_SNAPSHOT": "none"
},
"context": "../context"
}
}

View File

@ -0,0 +1,13 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "Clang 07",
"build": {
"dockerfile": "../Dockerfile",
"args": {
"BASE_IMAGE_NAME": "silkeh/clang:7",
"DEBIAN_SNAPSHOT": "none"
},
"context": "../context"
}
}

View File

@ -0,0 +1,13 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "Clang 08",
"build": {
"dockerfile": "../Dockerfile",
"args": {
"BASE_IMAGE_NAME": "silkeh/clang:8",
"DEBIAN_SNAPSHOT": "none"
},
"context": "../context"
}
}

View File

@ -0,0 +1,13 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "Clang 09",
"build": {
"dockerfile": "../Dockerfile",
"args": {
"BASE_IMAGE_NAME": "silkeh/clang:9",
"DEBIAN_SNAPSHOT": "none"
},
"context": "../context"
}
}

View File

@ -0,0 +1,291 @@
#!/usr/bin/env bash
# For more detailed debugging, uncomment the next line
# set -x
# Explicitly set CMAKE_VERSION from first argument, default to "none"
CMAKE_VERSION=${1:-"none"}
# --- Configuration ---
DOWNLOAD_ATTEMPTS=3
DOWNLOAD_RETRY_DELAY=5 # seconds
# --- Global Variables ---
TMP_DIR="" # Initialize TMP_DIR, will be set by mktemp
# Filenames used within TMP_DIR
CMAKE_INSTALLER_SCRIPT_LOCAL_NAME="cmake-installer.sh"
CMAKE_CHECKSUM_FILE_LOCAL_NAME="cmake-checksums.txt"
# This will be the actual name of the CMake binary, derived from version and arch
# It's important for matching against the checksum file.
DERIVED_CMAKE_BINARY_FILENAME=""
# --- Cleanup Function ---
# This trap will execute on EXIT, ERR, SIGINT, SIGTERM
# It's crucial for debugging to see the state of TMP_DIR if things go wrong.
cleanup() {
# $? is the exit code of the last command before the trap was triggered
# or the argument to exit if the script called exit explicitly.
LAST_EXIT_CODE=$?
echo # Newline for readability
# Only proceed with detailed cleanup if TMP_DIR was actually created
if [[ -n "${TMP_DIR}" && -d "${TMP_DIR}" ]]; then
echo "--- Cleanup: Temporary Directory Inspector (${TMP_DIR}) ---"
echo "Listing contents of TMP_DIR:"
ls -la "${TMP_DIR}"
# Check and display checksum file content
if [[ -f "${TMP_DIR}/${CMAKE_CHECKSUM_FILE_LOCAL_NAME}" ]]; then
echo "--- Content of downloaded checksum file (${CMAKE_CHECKSUM_FILE_LOCAL_NAME}) ---"
cat "${TMP_DIR}/${CMAKE_CHECKSUM_FILE_LOCAL_NAME}"
echo "--- End of checksum file ---"
else
echo "Checksum file (${CMAKE_CHECKSUM_FILE_LOCAL_NAME}) not found in TMP_DIR."
fi
# Check and display head of (potentially) installer script
# Useful to see if it's an HTML error page
if [[ -f "${TMP_DIR}/${CMAKE_INSTALLER_SCRIPT_LOCAL_NAME}" ]]; then
echo "--- First 10 lines of downloaded installer script (${CMAKE_INSTALLER_SCRIPT_LOCAL_NAME}) ---"
head -n 10 "${TMP_DIR}/${CMAKE_INSTALLER_SCRIPT_LOCAL_NAME}"
echo "--- End of installer script head ---"
elif [[ -f "${TMP_DIR}/${DERIVED_CMAKE_BINARY_FILENAME}" ]]; then
# If it was renamed
echo "--- First 10 lines of downloaded installer script (${DERIVED_CMAKE_BINARY_FILENAME}) ---"
head -n 10 "${TMP_DIR}/${DERIVED_CMAKE_BINARY_FILENAME}"
echo "--- End of installer script head ---"
else
echo "Installer script not found in TMP_DIR (checked for ${CMAKE_INSTALLER_SCRIPT_LOCAL_NAME} and ${DERIVED_CMAKE_BINARY_FILENAME})."
fi
echo "Attempting to remove temporary directory: ${TMP_DIR}"
rm -Rf "${TMP_DIR}"
echo "Temporary directory removed."
echo "--- End of Cleanup ---"
else
echo "--- Cleanup: TMP_DIR was not set or not a directory, no temp files to inspect or clean. ---"
fi
# Ensure the script exits with the LAST_EXIT_CODE observed by the trap
# unless it was 0 and the script is exiting due to an explicit non-zero exit.
# The 'exit' command within the trap will override the script's natural exit code.
# So, if the script was going to exit 0, but cleanup had an issue, this could change it.
# However, for debugging an exit code 8, we want to preserve the code that *caused* the trap.
echo "Script finished with exit code: ${LAST_EXIT_CODE}."
exit "${LAST_EXIT_CODE}"
}
trap cleanup EXIT ERR SIGINT SIGTERM
# Immediately turn on `set -e` after trap setup
set -e
# --- Helper Functions ---
# Function to download a file with retries and basic validation
download_file() {
local url="$1"
local output_filename="$2"
local attempts_left=$DOWNLOAD_ATTEMPTS
local wget_exit_code=0
while [ $attempts_left -gt 0 ]; do
echo "Downloading: ${url}"
echo "Saving to: ${TMP_DIR}/${output_filename}"
echo "Attempt $((DOWNLOAD_ATTEMPTS - attempts_left + 1)) of ${DOWNLOAD_ATTEMPTS}..."
# Use wget with:
# -O: specify output file
# --timeout: connection/read timeout
# --tries: number of retries (wget's own retry, distinct from this loop)
# --quiet: suppress normal output, but errors still go to stderr
# --show-progress: if not quiet, shows a progress bar (optional)
# Using -q for less verbose logs, but on failure, we need to know.
wget -O "${TMP_DIR}/${output_filename}" --timeout=30 --tries=1 "${url}"
wget_exit_code=$?
if [ ${wget_exit_code} -eq 0 ]; then
echo "Download command successful for ${output_filename}."
if [ -s "${TMP_DIR}/${output_filename}" ]; then # -s: file exists and has a size greater than 0
# Basic check for common HTML error page indicators
# This is a heuristic and might not catch all error pages.
if head -n 5 "${TMP_DIR}/${output_filename}" | grep -Eiq '<html|<head|<!doctype html|404 Not Found|Error'; then
echo "WARNING: Downloaded file '${output_filename}' might be an HTML error page."
echo "First 5 lines of ${output_filename}:"
head -n 5 "${TMP_DIR}/${output_filename}"
# Consider this a failure for critical files
return 1 # Treat as failure
fi
echo "File ${output_filename} downloaded and is not empty."
return 0 # Success
else
echo "ERROR: Downloaded file ${output_filename} is empty."
# No need to rm here, loop will retry or fail
fi
else
echo "ERROR: wget failed to download ${url} with exit code ${wget_exit_code}."
fi
attempts_left=$((attempts_left - 1))
if [ $attempts_left -gt 0 ]; then
echo "Retrying in ${DOWNLOAD_RETRY_DELAY} seconds..."
sleep $DOWNLOAD_RETRY_DELAY
else
echo "ERROR: Failed to download ${url} after ${DOWNLOAD_ATTEMPTS} attempts."
return 1 # Explicit failure
fi
done
return 1 # Should be unreachable if loop logic is correct, but as a fallback
}
# --- Main Script Logic ---
if [ "${CMAKE_VERSION}" = "none" ]; then
echo "No CMake version specified by argument, skipping CMake reinstallation."
exit 0
fi
echo "CMake version to install: ${CMAKE_VERSION}"
# 1. Ensure wget is available
echo "Checking for wget..."
if ! command -v wget > /dev/null; then
echo "wget not found. Attempting to install wget via apt-get..."
if command -v apt-get > /dev/null; then
apt-get update -y
apt-get install -y --no-install-recommends wget
echo "wget installed."
else
echo "ERROR: apt-get not found. Cannot install wget. Please install wget manually."
exit 1
fi
else
echo "wget is available."
fi
# 2. (Optional) Remove existing CMake installed via apt
echo "Attempting to remove any existing CMake installed via apt..."
if command -v apt-get > /dev/null; then
if dpkg -s cmake &> /dev/null; then # Check if cmake package is actually installed
apt-get -y purge --auto-remove cmake
echo "cmake package purged."
else
echo "cmake package not found via dpkg, skipping purge."
fi
else
echo "apt-get not found, skipping removal of CMake via apt."
fi
# 3. Create installation and temporary directories
echo "Creating CMake installation directory /opt/cmake..."
mkdir -p /opt/cmake
TMP_DIR=$(mktemp -d -t cmake-install-XXXXXXXXXX)
echo "Temporary directory created: ${TMP_DIR}"
# Crucial: subsequent operations needing temp files should happen in or relative to TMP_DIR
# We will cd into TMP_DIR later, or use full paths like ${TMP_DIR}/filename
# 4. Determine system architecture
echo "Determining system architecture..."
architecture=$(dpkg --print-architecture)
case "${architecture}" in
arm64) ARCH="aarch64" ;;
amd64) ARCH="x86_64" ;;
*)
echo "ERROR: Unsupported architecture '${architecture}' reported by dpkg."
exit 1
;;
esac
echo "Detected architecture: ${architecture} (mapped to CMake arch: ${ARCH})"
# 5. Define CMake download URLs and the filename expected by checksum
DERIVED_CMAKE_BINARY_FILENAME="cmake-${CMAKE_VERSION}-linux-${ARCH}.sh"
CMAKE_BINARY_URL="https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${DERIVED_CMAKE_BINARY_FILENAME}"
CMAKE_CHECKSUM_FILE_URL="https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-SHA-256.txt"
# 6. Download CMake binary and checksum file
echo "--- Downloading Files ---"
if ! download_file "${CMAKE_BINARY_URL}" "${CMAKE_INSTALLER_SCRIPT_LOCAL_NAME}"; then
echo "ERROR: Failed to download CMake binary installer. See messages above."
exit 1
fi
if ! download_file "${CMAKE_CHECKSUM_FILE_URL}" "${CMAKE_CHECKSUM_FILE_LOCAL_NAME}"; then
echo "ERROR: Failed to download CMake checksum file. See messages above."
exit 1
fi
echo "Downloads complete."
echo "--- End of Downloading Files ---"
echo # Newline for readability
# Before checksum, rename the downloaded installer to its derived name,
# as the checksum file refers to this specific name.
echo "Renaming downloaded installer from '${CMAKE_INSTALLER_SCRIPT_LOCAL_NAME}' to '${DERIVED_CMAKE_BINARY_FILENAME}' for checksum verification."
mv "${TMP_DIR}/${CMAKE_INSTALLER_SCRIPT_LOCAL_NAME}" "${TMP_DIR}/${DERIVED_CMAKE_BINARY_FILENAME}"
if [ ! -f "${TMP_DIR}/${DERIVED_CMAKE_BINARY_FILENAME}" ]; then
echo "ERROR: Failed to rename installer script for checksum. File '${TMP_DIR}/${DERIVED_CMAKE_BINARY_FILENAME}' does not exist after move."
exit 1
fi
# 7. Verify checksum
echo "--- Verifying Checksum ---"
echo "Checksum file is: ${TMP_DIR}/${CMAKE_CHECKSUM_FILE_LOCAL_NAME}"
echo "Binary file to check is: ${TMP_DIR}/${DERIVED_CMAKE_BINARY_FILENAME}"
# Ensure the checksum file actually contains an entry for our binary
# This is important because the SHA-256.txt file contains checksums for *all* release assets
echo "Checking if checksum file contains entry for '${DERIVED_CMAKE_BINARY_FILENAME}'..."
if ! grep -q "${DERIVED_CMAKE_BINARY_FILENAME}" "${TMP_DIR}/${CMAKE_CHECKSUM_FILE_LOCAL_NAME}"; then
echo "ERROR: The downloaded checksum file '${CMAKE_CHECKSUM_FILE_LOCAL_NAME}' does NOT contain an entry for '${DERIVED_CMAKE_BINARY_FILENAME}'."
echo "This strongly suggests that the CMAKE_VERSION ('${CMAKE_VERSION}') or ARCH ('${ARCH}') is incorrect, or the specified version does not provide a .sh installer for this architecture."
echo "Please verify the version and available files at https://github.com/Kitware/CMake/releases/tag/v${CMAKE_VERSION}"
exit 1
fi
echo "Checksum file contains an entry for '${DERIVED_CMAKE_BINARY_FILENAME}'."
# Perform the checksum. We need to be in the directory where the files are.
echo "Changing directory to ${TMP_DIR} for checksum verification."
cd "${TMP_DIR}" # <<<<<<< IMPORTANT: sha256sum -c needs to find files
echo "Verifying checksum of '${DERIVED_CMAKE_BINARY_FILENAME}' using '${CMAKE_CHECKSUM_FILE_LOCAL_NAME}'..."
# The --ignore-missing flag is good, as the .txt file has many checksums.
# The --strict flag would cause it to error if there are improperly formatted lines.
# We rely on the grep check above to ensure our specific file is mentioned.
if sha256sum -c --ignore-missing "${CMAKE_CHECKSUM_FILE_LOCAL_NAME}"; then
echo "Checksum verification successful for '${DERIVED_CMAKE_BINARY_FILENAME}'."
else
SHA_EXIT_CODE=$?
echo "ERROR: Checksum verification FAILED for '${DERIVED_CMAKE_BINARY_FILENAME}' with exit code ${SHA_EXIT_CODE}."
# Cleanup trap will show file contents.
exit 1 # Critical failure
fi
echo "--- End of Verifying Checksum ---"
echo # Newline for readability
# 8. Install CMake
echo "--- Installing CMake ---"
echo "Making the CMake installer script '${DERIVED_CMAKE_BINARY_FILENAME}' executable..."
chmod +x "${DERIVED_CMAKE_BINARY_FILENAME}" # Still in TMP_DIR
echo "Executing CMake installer script: ./${DERIVED_CMAKE_BINARY_FILENAME} --prefix=/opt/cmake --skip-license"
# Execute the script. If this script exits with 8, this is our culprit.
if ./"${DERIVED_CMAKE_BINARY_FILENAME}" --prefix=/opt/cmake --skip-license; then
echo "CMake installer script executed successfully."
else
INSTALLER_EXIT_CODE=$?
echo "ERROR: CMake installer script FAILED with exit code ${INSTALLER_EXIT_CODE}."
# This is the most likely place for an exit code 8 if downloads and checksums were okay.
# The trap will handle cleanup. The script will exit with INSTALLER_EXIT_CODE due to the trap.
exit ${INSTALLER_EXIT_CODE} # Explicitly exit with the installer's code
fi
echo "--- End of Installing CMake ---"
echo # Newline for readability
# 9. Create symlinks
echo "Creating symbolic links for cmake and ctest in /usr/local/bin/..."
ln -sf /opt/cmake/bin/cmake /usr/local/bin/cmake
ln -sf /opt/cmake/bin/ctest /usr/local/bin/ctest
echo "Symbolic links created."
echo # Newline for readability
echo "SUCCESS: CMake ${CMAKE_VERSION} installation and setup complete."
# The script will exit with 0 here. The trap will run, see $? is 0, and then exit 0.
exit 0

View File

@ -0,0 +1,13 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "Default",
"build": {
"dockerfile": "./Dockerfile",
"args": {
"BASE_IMAGE_NAME": "mcr.microsoft.com/devcontainers/cpp:2@sha256:a5eb5a1e9109af88bf82ebb0f71903608a68144851ed1e4b852e31b251ac59c6",
"DEBIAN_SNAPSHOT": "20260223T000000Z"
},
"context": "./context"
}
}

View File

@ -0,0 +1,13 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "Gcc 09",
"build": {
"dockerfile": "../Dockerfile",
"args": {
"BASE_IMAGE_NAME": "gcc:9",
"DEBIAN_SNAPSHOT": "none"
},
"context": "../context"
}
}

View File

@ -0,0 +1,13 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "Gcc 10",
"build": {
"dockerfile": "../Dockerfile",
"args": {
"BASE_IMAGE_NAME": "gcc:10",
"DEBIAN_SNAPSHOT": "none"
},
"context": "../context"
}
}

View File

@ -0,0 +1,13 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "Gcc 11",
"build": {
"dockerfile": "../Dockerfile",
"args": {
"BASE_IMAGE_NAME": "gcc:11",
"DEBIAN_SNAPSHOT": "none"
},
"context": "../context"
}
}

View File

@ -0,0 +1,13 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "Gcc 12",
"build": {
"dockerfile": "../Dockerfile",
"args": {
"BASE_IMAGE_NAME": "gcc:12",
"DEBIAN_SNAPSHOT": "none"
},
"context": "../context"
}
}

View File

@ -0,0 +1,13 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "Gcc 13",
"build": {
"dockerfile": "../Dockerfile",
"args": {
"BASE_IMAGE_NAME": "gcc:13",
"DEBIAN_SNAPSHOT": "none"
},
"context": "../context"
}
}

View File

@ -0,0 +1,13 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "Gcc 14",
"build": {
"dockerfile": "../Dockerfile",
"args": {
"BASE_IMAGE_NAME": "gcc:14",
"DEBIAN_SNAPSHOT": "none"
},
"context": "../context"
}
}

View File

@ -0,0 +1,13 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "Gcc 15",
"build": {
"dockerfile": "../Dockerfile",
"args": {
"BASE_IMAGE_NAME": "gcc:15",
"DEBIAN_SNAPSHOT": "none"
},
"context": "../context"
}
}

View File

@ -0,0 +1,40 @@
# s390x Big-Endian Test Environment for ETL
# Uses QEMU user-mode emulation to run s390x binaries on x64 host
FROM debian:trixie
# Avoid prompts from apt
ENV DEBIAN_FRONTEND=noninteractive
# Install QEMU user-mode emulation and s390x cross-compilation tools
RUN dpkg --add-architecture s390x && \
apt-get update && apt-get install -y --no-install-recommends\
qemu-user-static \
qemu-user \
binfmt-support \
gcc-s390x-linux-gnu \
g++-s390x-linux-gnu \
cmake \
make \
ninja-build \
git \
wget \
file \
libc6:s390x \
libstdc++6:s390x \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /workspaces/etl
# Verify QEMU and cross-compilation setup
RUN echo "=== Host Architecture ===" && \
uname -m && \
echo "" && \
echo "=== s390x Cross Compiler ===" && \
s390x-linux-gnu-gcc --version && \
echo "" && \
echo "=== QEMU s390x ===" && \
qemu-s390x-static --version | head -n1
# Default command
CMD ["/bin/bash"]

View File

@ -0,0 +1,29 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
{
"name": "s390x Big Endian (Debian)",
"build": {
"dockerfile": "./Dockerfile",
"context": "."
},
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools",
"ms-vscode.cmake-tools"
],
"settings": {
"cmake.sourceDirectory": "${workspaceFolder}/test",
"cmake.configureArgs": [
"-DCMAKE_TOOLCHAIN_FILE=${workspaceFolder}/.devcontainer/s390x/toolchain-s390x.cmake",
"-DBUILD_TESTS=ON",
"-DNO_STL=OFF",
"-DETL_CXX_STANDARD=17"
],
"cmake.buildDirectory": "${workspaceFolder}/build-s390x",
"cmake.generator": "Ninja"
}
}
},
"remoteUser": "root"
}

View File

@ -0,0 +1,21 @@
# CMake toolchain file for s390x cross-compilation
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR s390x)
# Specify the cross compiler
set(CMAKE_C_COMPILER s390x-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER s390x-linux-gnu-g++)
set(CMAKE_AR s390x-linux-gnu-ar)
set(CMAKE_RANLIB s390x-linux-gnu-ranlib)
set(CMAKE_STRIP s390x-linux-gnu-strip)
# Search for programs in the build host directories
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# For libraries and headers in the target directories
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
# Set QEMU for running tests
set(CMAKE_CROSSCOMPILING_EMULATOR /usr/bin/qemu-s390x-static CACHE FILEPATH "Path to the emulator for cross-compiled binaries")

View File

@ -3,7 +3,8 @@ on:
push:
branches: [ master, development, pull-request/* ]
pull_request:
branches: [ master, pull-request/* ]
branches: [ master, development, pull-request/* ]
types: [opened, synchronize, reopened]
jobs:
@ -15,19 +16,19 @@ jobs:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=11 ./
cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=11 ./
clang --version
make
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests
run: ./test/etl_tests -v
build-clang-cpp11-linux-no-stl:
name: Clang C++11 Linux - No STL
@ -37,16 +38,16 @@ jobs:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=11 ./
cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=11 ./
clang --version
make
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests
run: ./test/etl_tests -v

View File

@ -3,7 +3,8 @@ on:
push:
branches: [ master, development, pull-request/* ]
pull_request:
branches: [ master, pull-request/* ]
branches: [ master, development, pull-request/* ]
types: [opened, synchronize, reopened]
jobs:
@ -15,19 +16,19 @@ jobs:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=14 ./
cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=14 ./
clang --version
make
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests
run: ./test/etl_tests -v
build-clang-cpp14-linux-no-stl:
name: Clang C++14 Linux - No STL
@ -37,16 +38,16 @@ jobs:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=14 ./
cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=14 ./
clang --version
make
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests
run: ./test/etl_tests -v

View File

@ -3,7 +3,8 @@ on:
push:
branches: [ master, development, pull-request/* ]
pull_request:
branches: [ master, pull-request/* ]
branches: [ master, development, pull-request/* ]
types: [opened, synchronize, reopened]
jobs:
@ -15,19 +16,19 @@ jobs:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=17 ./
cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=17 ./
clang --version
make
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests
run: ./test/etl_tests -v
build-clang-cpp17-linux-no-stl:
name: Clang C++17 Linux - No STL
@ -37,16 +38,16 @@ jobs:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=17 ./
cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=17 ./
clang --version
make
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests
run: ./test/etl_tests -v

View File

@ -3,7 +3,8 @@ on:
push:
branches: [ master, development, pull-request/* ]
pull_request:
branches: [ master, pull-request/* ]
branches: [ master, development, pull-request/* ]
types: [opened, synchronize, reopened]
jobs:
@ -15,7 +16,7 @@ jobs:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
# Temporary fix. See https://github.com/actions/runner-images/issues/8659
- name: Install newer Clang
@ -29,12 +30,12 @@ jobs:
export CC=clang-17
export CXX=clang++-17
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
cmake -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=20 ./
cmake -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=20 ./
clang-17 --version
make
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests
run: ./test/etl_tests -v
build-clang-cpp20-linux-stl-force-cpp03:
name: Clang C++20 Linux - STL - Force C++03
@ -44,7 +45,7 @@ jobs:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
# Temporary fix. See https://github.com/actions/runner-images/issues/8659
- name: Install newer Clang
@ -58,12 +59,12 @@ jobs:
export CC=clang-17
export CXX=clang++-17
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=ON -DETL_CXX_STANDARD=20 ./
cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=20 ./
clang-17 --version
make
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests
run: ./test/etl_tests -v
build-clang-cpp20-linux-no-stl-force-cpp03:
name: Clang C++20 Linux - No STL - Force C++03
@ -73,7 +74,7 @@ jobs:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
# Temporary fix. See https://github.com/actions/runner-images/issues/8659
- name: Install newer Clang
@ -87,98 +88,98 @@ jobs:
export CC=clang-17
export CXX=clang++-17
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=ON -DETL_CXX_STANDARD=20 ./
cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=20 ./
clang-17 --version
make
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests
run: ./test/etl_tests -v
build-clang-cpp20-osx-stl:
name: Clang C++20 OSX - STL
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-12]
os: [macos-15]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=20 ./
cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=20 ./
clang --version
make
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests
run: ./test/etl_tests -v
build-clang-cpp20-osx-no-stl:
name: Clang C++20 OSX - No STL
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-12]
os: [macos-15]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=20 ./
cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=20 ./
clang --version
make
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests
run: ./test/etl_tests -v
build-clang-cpp20-osx-stl-force-cpp03:
name: Clang C++20 OSX - STL - Force C++03
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-12]
os: [macos-15]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=ON -DETL_CXX_STANDARD=20 ./
cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=20 ./
clang --version
make
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests
run: ./test/etl_tests -v
build-clang-cpp20-osx-no-stl-force-cpp03:
name: Clang C++20 OSX - No STL - Force C++03
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-12]
os: [macos-15]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=ON -DETL_CXX_STANDARD=20 ./
cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=20 ./
clang --version
make
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests
run: ./test/etl_tests -v

185
.github/workflows/clang-c++23.yml vendored Normal file
View File

@ -0,0 +1,185 @@
name: clang-c++23
on:
push:
branches: [ master, development, pull-request/* ]
pull_request:
branches: [ master, development, pull-request/* ]
types: [opened, synchronize, reopened]
jobs:
build-clang-cpp23-linux-no-stl:
name: Clang C++23 Linux - No STL
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
# Temporary fix. See https://github.com/actions/runner-images/issues/8659
- name: Install newer Clang
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x ./llvm.sh
sudo ./llvm.sh 17
- name: Build
run: |
export CC=clang-17
export CXX=clang++-17
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
cmake -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=23 ./
clang-17 --version
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests -v
build-clang-cpp23-linux-stl-force-cpp03:
name: Clang C++23 Linux - STL - Force C++03
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
# Temporary fix. See https://github.com/actions/runner-images/issues/8659
- name: Install newer Clang
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x ./llvm.sh
sudo ./llvm.sh 17
- name: Build
run: |
export CC=clang-17
export CXX=clang++-17
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=ON -DETL_CXX_STANDARD=23 ./
clang-17 --version
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests -v
build-clang-cpp2-linux-no-stl-force-cpp03:
name: Clang C++23 Linux - No STL - Force C++03
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
# Temporary fix. See https://github.com/actions/runner-images/issues/8659
- name: Install newer Clang
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x ./llvm.sh
sudo ./llvm.sh 17
- name: Build
run: |
export CC=clang-17
export CXX=clang++-17
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=ON -DETL_CXX_STANDARD=23 ./
clang-17 --version
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests -v
build-clang-cpp23-osx-stl:
name: Clang C++23 OSX - STL
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-15]
steps:
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=23 ./
clang --version
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests -v
build-clang-cpp23-osx-no-stl:
name: Clang C++23 OSX - No STL
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-15]
steps:
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=23 ./
clang --version
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests -v
build-clang-cpp23-osx-stl-force-cpp03:
name: Clang C++23 OSX - STL - Force C++03
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-15]
steps:
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=ON -DETL_CXX_STANDARD=23 ./
clang --version
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests -v
build-clang-cpp23-osx-no-stl-force-cpp03:
name: Clang C++23 OSX - No STL - Force C++03
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-15]
steps:
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=ON -DETL_CXX_STANDARD=23 ./
clang --version
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests -v

43
.github/workflows/clang-format.yaml vendored Normal file
View File

@ -0,0 +1,43 @@
name: clang-format
on:
push:
branches: [ master, development, pull-request/* ]
pull_request:
branches: [ master, development, pull-request/* ]
types: [opened, synchronize, reopened]
jobs:
clang-format:
name: clang-format
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install clang-format and git
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends git clang-format
clang-format --version
- name: Run clang-format on added/changed files
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
BEFORE="origin/${{ github.base_ref }}"
elif [ "${{ github.event_name }}" = "push" ]; then
BEFORE="${{ github.event.before }}"
else
echo "Unsupported event: ${{ github.event_name }}"
echo "This is likely a bug in the workflow configuration. Please report it to the maintainers."
exit 1
fi
git diff --name-only -z --diff-filter=AMCR "$BEFORE"..HEAD -- \
'*.c' '*.cc' '*.cxx' '*.cpp' \
'*.h' '*.hh' '*.hpp' '*.hxx' \
'*.ipp' '*.inl' \
':(exclude)include/etl/generators/*' \
':(exclude)include/etl/private/*_cpp03.h' \
| xargs -0 --no-run-if-empty clang-format --Werror -n --style=file

View File

@ -0,0 +1,21 @@
name: clang-format-update
on:
workflow_dispatch:
jobs:
clang-format:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install clang-format
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends clang-format
clang-format --version
- name: Run clang-format
run: |
find . \( -name '*.cpp' -o -name '*.h' -o -name '*.c' \) | xargs clang-format --dry-run --Werror

View File

@ -3,329 +3,402 @@ on:
push:
branches: [ master, development, pull-request/* ]
pull_request:
branches: [ master, pull-request/* ]
branches: [ master, development, pull-request/* ]
types: [opened, synchronize, reopened]
jobs:
build-clang-cpp03-linux-STL:
name: Clang C++03 Linux STL
name: Syntax Check - Clang C++03 Linux STL
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check/c++03
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=03 ./test/syntax_check
clang --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-clang-cpp03-linux-No-STL:
name: Clang C++03 Linux No STL
name: Syntax Check - Clang C++03 Linux No STL
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check/c++03
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=03 ./test/syntax_check
clang --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-clang-cpp11-linux-STL:
name: Clang C++11 Linux STL
name: Syntax Check - Clang C++11 Linux STL
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check/c++11
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=11 ./test/syntax_check
clang --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-clang-cpp11-linux-No-STL:
name: Clang C++11 Linux No STL
name: Syntax Check - Clang C++11 Linux No STL
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check/c++11
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=11 ./test/syntax_check
clang --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-clang-cpp11-linux-STL-Force-CPP03:
name: Clang C++11 Linux STL Force C++03
name: Syntax Check - Clang C++11 Linux STL Force C++03
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check/c++11
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=11 ./test/syntax_check
clang --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-clang-cpp11-linux-No-STL-Force-CPP03:
name: Clang C++11 Linux No STL Force C++03
name: Syntax Check - Clang C++11 Linux No STL Force C++03
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check/c++11
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=11 ./test/syntax_check
clang --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-clang-cpp14-linux-STL:
name: Clang C++14 Linux STL
name: Syntax Check - Clang C++14 Linux STL
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check/c++14
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=14 ./test/syntax_check
clang --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-clang-cpp14-linux-No-STL:
name: Clang C++14 Linux No STL
name: Syntax Check - Clang C++14 Linux No STL
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check/c++14
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=14 ./test/syntax_check
clang --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-clang-cpp14-linux-STL-Force-CPP03:
name: Clang C++14 Linux STL Force C++03
name: Syntax Check - Clang C++14 Linux STL Force C++03
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check/c++14
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=14 ./test/syntax_check
clang --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-clang-cpp14-linux-No-STL-Force-CPP03:
name: Clang C++14 Linux No STL Force C++03
name: Syntax Check - Clang C++14 Linux No STL Force C++03
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check/c++14
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=14 ./test/syntax_check
clang --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-clang-cpp17-linux-STL:
name: Clang C++17 Linux STL
name: Syntax Check - Clang C++17 Linux STL
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check/c++17
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=17 ./test/syntax_check
clang --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-clang-cpp17-linux-No-STL:
name: Clang C++17 Linux No STL
name: Syntax Check - Clang C++17 Linux No STL
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check/c++17
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=17 ./test/syntax_check
clang --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-clang-cpp17-linux-STL-Force-CPP03:
name: Clang C++17 Linux STL Force C++03
name: Syntax Check - Clang C++17 Linux STL Force C++03
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check/c++17
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=17 ./test/syntax_check
clang --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-clang-cpp17-linux-No-STL-Force-CPP03:
name: Clang C++17 Linux No STL Force C++03
name: Syntax Check - Clang C++17 Linux No STL Force C++03
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check/c++17
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=17 ./test/syntax_check
clang --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-clang-cpp20-linux-STL:
name: Clang C++20 Linux STL
name: Syntax Check - Clang C++20 Linux STL
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check/c++20
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=20 ./test/syntax_check
clang --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-clang-cpp20-linux-No-STL:
name: Clang C++20 Linux No STL
name: Syntax Check - Clang C++20 Linux No STL
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check/c++20
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=20 ./test/syntax_check
clang --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-clang-cpp20-linux-STL-Force-CPP03:
name: Clang C++20 Linux STL Force C++03
name: Syntax Check - Clang C++20 Linux STL Force C++03
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check/c++20
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=20 ./test/syntax_check
clang --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-clang-cpp20-linux-No-STL-Force-CPP03:
name: Clang C++20 Linux No STL Force C++03
name: Syntax Check - Clang C++20 Linux No STL Force C++03
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check/c++20
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=20 ./test/syntax_check
clang --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-clang-cpp23-linux-STL:
name: Syntax Check - Clang C++23 Linux STL
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=23 ./test/syntax_check
clang --version
make -j $(getconf _NPROCESSORS_ONLN)
build-clang-cpp23-linux-No-STL:
name: Syntax Check - Clang C++23 Linux No STL
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=23 ./test/syntax_check
clang --version
make -j $(getconf _NPROCESSORS_ONLN)
build-clang-cpp23-linux-STL-Force-CPP03:
name: Syntax Check - Clang C++23 Linux STL Force C++03
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=23 ./test/syntax_check
clang --version
make -j $(getconf _NPROCESSORS_ONLN)
build-clang-cpp23-linux-No-STL-Force-CPP03:
name: Syntax Check - Clang C++23 Linux No STL Force C++03
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
- name: Build
run: |
export CC=clang
export CXX=clang++
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=23 ./test/syntax_check
clang --version
make -j $(getconf _NPROCESSORS_ONLN)

72
.github/workflows/coverage.yml vendored Normal file
View File

@ -0,0 +1,72 @@
name: coverage
on:
push:
branches: [ master, pull-request/* ]
pull_request:
branches: [ master, pull-request/* ]
types: [opened, synchronize, reopened]
# Allow only one concurrent deployment to GitHub Pages
concurrency:
group: coverage-${{ github.ref }}
cancel-in-progress: true
# Grant GITHUB_TOKEN the minimum permissions needed at the workflow level
permissions:
contents: read
jobs:
coverage:
name: Generate Coverage Report
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y lcov llvm gcc g++ clang cmake
- name: Build, test, and collect coverage
run: |
cd test
./run-coverage.sh
- name: Upload coverage report artifact
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: test/build-coverage/coverage/
retention-days: 30
- name: Upload Pages artifact
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: actions/upload-pages-artifact@v3
with:
path: test/build-coverage/coverage/
deploy-pages:
name: Deploy to GitHub Pages
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs: coverage
runs-on: ubuntu-22.04
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
# GitHub Repository settings
# -> Settings -> Pages
# -> Source: gh actions

View File

@ -3,7 +3,8 @@ on:
push:
branches: [ master, development, pull-request/* ]
pull_request:
branches: [ master, pull-request/* ]
branches: [ master, development, pull-request/* ]
types: [opened, synchronize, reopened]
jobs:
@ -15,7 +16,7 @@ jobs:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
@ -23,12 +24,12 @@ jobs:
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
export CC=gcc
export CXX=g++
cmake -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=11 ./
cmake -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=11 ./
gcc --version
make
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests
run: ./test/etl_tests -v
build-gcc-cpp11-linux-no-stl:
name: GCC C++11 Linux - No STL
@ -38,7 +39,7 @@ jobs:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
@ -46,9 +47,9 @@ jobs:
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
export CC=gcc
export CXX=g++
cmake -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=11 ./
cmake -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=11 ./
gcc --version
make
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests
run: ./test/etl_tests -v

View File

@ -3,7 +3,8 @@ on:
push:
branches: [ master, development, pull-request/* ]
pull_request:
branches: [ master, pull-request/* ]
branches: [ master, development, pull-request/* ]
types: [opened, synchronize, reopened]
jobs:
@ -15,19 +16,19 @@ jobs:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
export CC=gcc
export CXX=g++
cmake -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=14 ./
cmake -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=14 ./
gcc --version
make
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests
run: ./test/etl_tests -v
build-gcc-cpp14-linux-no-stl:
name: GCC C++14 Linux - No STL
@ -37,16 +38,16 @@ jobs:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
export CC=gcc
export CXX=g++
cmake -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=14 ./
cmake -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=14 ./
gcc --version
make
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests
run: ./test/etl_tests -v

View File

@ -3,7 +3,8 @@ on:
push:
branches: [ master, development, pull-request/* ]
pull_request:
branches: [ master, pull-request/* ]
branches: [ master, development, pull-request/* ]
types: [opened, synchronize, reopened]
jobs:
@ -15,19 +16,19 @@ jobs:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
export CC=gcc
export CXX=g++
cmake -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=17 ./
cmake -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=17 ./
gcc --version
make
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests
run: ./test/etl_tests -v
build-gcc-cpp17-linux-no-stl:
name: GCC C++17 Linux - No STL
@ -37,16 +38,16 @@ jobs:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
export CC=gcc
export CXX=g++
cmake -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=17 ./
cmake -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=17 ./
gcc --version
make
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests
run: ./test/etl_tests -v

View File

@ -3,7 +3,8 @@ on:
push:
branches: [ master, development, pull-request/* ]
pull_request:
branches: [ master, pull-request/* ]
branches: [ master, development, pull-request/* ]
types: [opened, synchronize, reopened]
jobs:
@ -15,19 +16,19 @@ jobs:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
export CC=gcc
export CXX=g++
cmake -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=20 ./
cmake -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=20 ./
gcc --version
make
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests
run: ./test/etl_tests -v
build-gcc-cpp20-linux-no-stl:
name: GCC C++20 Linux - No STL
@ -37,19 +38,19 @@ jobs:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
export CC=gcc
export CXX=g++
cmake -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=20 ./
cmake -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=20 ./
gcc --version
make
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests
run: ./test/etl_tests -v
build-gcc-cpp20-linux-stl-force-cpp03:
name: GCC C++20 Linux - STL - Force C++03
@ -59,19 +60,19 @@ jobs:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
export CC=gcc
export CXX=g++
cmake -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=ON -DETL_CXX_STANDARD=20 ./
cmake -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=20 ./
gcc --version
make
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests
run: ./test/etl_tests -v
build-gcc-cpp20-linux-no-stl-force-cpp03:
name: GCC C++20 Linux - No STL - Force C++03
@ -81,16 +82,16 @@ jobs:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
export CC=gcc
export CXX=g++
cmake -DBUILD_TESTS=ON -DNO_STL=OON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=ON -DETL_CXX_STANDARD=20 ./
cmake -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=20 ./
gcc --version
make
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests
run: ./test/etl_tests -v

97
.github/workflows/gcc-c++23.yml vendored Normal file
View File

@ -0,0 +1,97 @@
name: gcc-c++23
on:
push:
branches: [ master, development, pull-request/* ]
pull_request:
branches: [ master, development, pull-request/* ]
types: [opened, synchronize, reopened]
jobs:
build-gcc-cpp23-linux-stl:
name: GCC C++23 Linux - STL
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
- name: Build
run: |
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
export CC=gcc
export CXX=g++
cmake -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=23 ./
gcc --version
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests -v
build-gcc-cpp23-linux-no-stl:
name: GCC C++23 Linux - No STL
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
- name: Build
run: |
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
export CC=gcc
export CXX=g++
cmake -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=23 ./
gcc --version
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests -v
build-gcc-cpp23-linux-stl-force-cpp03:
name: GCC C++23 Linux - STL - Force C++03
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
- name: Build
run: |
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
export CC=gcc
export CXX=g++
cmake -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=ON -DETL_CXX_STANDARD=23 ./
gcc --version
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests -v
build-gcc-cpp23-linux-no-stl-force-cpp03:
name: GCC C++23 Linux - No STL - Force C++03
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
- name: Build
run: |
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
export CC=gcc
export CXX=g++
cmake -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=ON -DETL_CXX_STANDARD=23 ./
gcc --version
make -j $(getconf _NPROCESSORS_ONLN)
- name: Run tests
run: ./test/etl_tests -v

View File

@ -3,329 +3,402 @@ on:
push:
branches: [ master, development, pull-request/* ]
pull_request:
branches: [ master, pull-request/* ]
branches: [ master, development, pull-request/* ]
types: [opened, synchronize, reopened]
jobs:
build-gcc-cpp03-linux-STL:
name: GCC C++03 Linux STL
name: Syntax Check - GCC C++03 Linux STL
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=gcc
export CXX=g++
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check/c++03
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=03 ./test/syntax_check
gcc --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-gcc-cpp03-linux-No-STL:
name: GCC C++03 Linux No STL
name: Syntax Check - GCC C++03 Linux No STL
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=gcc
export CXX=g++
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check/c++03
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=03 ./test/syntax_check
gcc --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-gcc-cpp11-linux-STL:
name: GCC C++11 Linux STL
name: Syntax Check - GCC C++11 Linux STL
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=gcc
export CXX=g++
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check/c++11
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=11 ./test/syntax_check
gcc --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-gcc-cpp11-linux-No-STL:
name: GCC C++11 Linux No STL
name: Syntax Check - GCC C++11 Linux No STL
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=gcc
export CXX=g++
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check/c++11
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=11 ./test/syntax_check
gcc --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-gcc-cpp11-linux-STL-Force-CPP03:
name: GCC C++11 Linux STL Force C++03
name: Syntax Check - GCC C++11 Linux STL Force C++03
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=gcc
export CXX=g++
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check/c++11
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=11 ./test/syntax_check
gcc --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-gcc-cpp11-linux-No-STL-Force-CPP03:
name: GCC C++11 Linux No STL Force C++03
name: Syntax Check - GCC C++11 Linux No STL Force C++03
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=gcc
export CXX=g++
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check/c++11
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=11 ./test/syntax_check
gcc --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-gcc-cpp14-linux-STL:
name: GCC C++14 Linux STL
name: Syntax Check - GCC C++14 Linux STL
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=gcc
export CXX=g++
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check/c++14
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=14 ./test/syntax_check
gcc --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-gcc-cpp14-linux-No-STL:
name: GCC C++14 Linux No STL
name: Syntax Check - GCC C++14 Linux No STL
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=gcc
export CXX=g++
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check/c++14
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=14 ./test/syntax_check
gcc --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-gcc-cpp14-linux-STL-Force-CPP03:
name: GCC C++14 Linux STL Force C++03
name: Syntax Check - GCC C++14 Linux STL Force C++03
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=gcc
export CXX=g++
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check/c++14
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=14 ./test/syntax_check
gcc --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-gcc-cpp14-linux-No-STL-Force-CPP03:
name: GCC C++14 Linux No STL Force C++03
name: Syntax Check - GCC C++14 Linux No STL Force C++03
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=gcc
export CXX=g++
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check/c++14
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=14 ./test/syntax_check
gcc --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-gcc-cpp17-linux-STL:
name: GCC C++17 Linux STL
name: Syntax Check - GCC C++17 Linux STL
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=gcc
export CXX=g++
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check/c++17
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=17 ./test/syntax_check
gcc --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-gcc-cpp17-linux-No-STL:
name: GCC C++17 Linux No STL
name: Syntax Check - GCC C++17 Linux No STL
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=gcc
export CXX=g++
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check/c++17
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=17 ./test/syntax_check
gcc --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-gcc-cpp17-linux-STL-Force-CPP03:
name: GCC C++17 Linux STL Force C++03
name: Syntax Check - GCC C++17 Linux STL Force C++03
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=gcc
export CXX=g++
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check/c++17
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=17 ./test/syntax_check
gcc --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-gcc-cpp17-linux-No-STL-Force-CPP03:
name: GCC C++17 Linux No STL Force C++03
name: Syntax Check - GCC C++17 Linux No STL Force C++03
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=gcc
export CXX=g++
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check/c++17
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=17 ./test/syntax_check
gcc --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-gcc-cpp20-linux-STL:
name: GCC C++20 Linux STL
name: Syntax Check - GCC C++20 Linux STL
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=gcc
export CXX=g++
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check/c++20
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=20 ./test/syntax_check
gcc --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-gcc-cpp20-linux-No-STL:
name: GCC C++20 Linux No STL
name: Syntax Check - GCC C++20 Linux No STL
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=gcc
export CXX=g++
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check/c++20
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=20 ./test/syntax_check
gcc --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-gcc-cpp20-linux-STL-Force-CPP03:
name: GCC C++20 Linux STL Force C++03
name: Syntax Check - GCC C++20 Linux STL Force C++03
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=gcc
export CXX=g++
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check/c++20
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=20 ./test/syntax_check
gcc --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-gcc-cpp20-linux-No-STL-Force-CPP03:
name: GCC C++20 Linux No STL Force C++03
name: Syntax Check - GCC C++20 Linux No STL Force C++03
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: |
export CC=gcc
export CXX=g++
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check/c++20
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=20 ./test/syntax_check
gcc --version
make
make -j $(getconf _NPROCESSORS_ONLN)
build-gcc-cpp23-linux-STL:
name: Syntax Check - GCC C++23 Linux STL
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
- name: Build
run: |
export CC=gcc
export CXX=g++
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=23 ./test/syntax_check
gcc --version
make -j $(getconf _NPROCESSORS_ONLN)
build-gcc-cpp23-linux-No-STL:
name: Syntax Check - GCC C++23 Linux No STL
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
- name: Build
run: |
export CC=gcc
export CXX=g++
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=23 ./test/syntax_check
gcc --version
make -j $(getconf _NPROCESSORS_ONLN)
build-gcc-cpp23-linux-STL-Force-CPP03:
name: Syntax Check - GCC C++23 Linux STL Force C++03
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
- name: Build
run: |
export CC=gcc
export CXX=g++
cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=23 ./test/syntax_check
gcc --version
make -j $(getconf _NPROCESSORS_ONLN)
build-gcc-cpp23-linux-No-STL-Force-CPP03:
name: Syntax Check - GCC C++23 Linux No STL Force C++03
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
- name: Build
run: |
export CC=gcc
export CXX=g++
cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=23 ./test/syntax_check
gcc --version
make -j $(getconf _NPROCESSORS_ONLN)

25
.github/workflows/generator.yml vendored Normal file
View File

@ -0,0 +1,25 @@
name: generator checks
on:
push:
branches: [ master, development, pull-request/* ]
pull_request:
branches: [ master, pull-request/* ]
types: [opened, synchronize, reopened]
jobs:
generator-run:
name: Header Generator
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Generate
run: |
sudo apt-get update
sudo apt-get install -y python3-cogapp
cd include/etl/generators && bash generate.bat
- name: Check Generated Headers For Changes
run: |
git diff --exit-code

View File

@ -3,7 +3,8 @@ on:
push:
branches: [ master, development, pull-request/* ]
pull_request:
branches: [ master, pull-request/* ]
branches: [ master, development, pull-request/* ]
types: [opened, synchronize, reopened]
jobs:
build-windows-msvc-stl:
@ -12,7 +13,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive
@ -21,19 +22,19 @@ jobs:
- name: Build
run: |
cmake -G "Visual Studio 17 2022" -AWin32 -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=20 ./
cmake -G "Visual Studio 17 2022" -AWin32 -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=17 ./
MSBuild.exe -version
MSBuild.exe .\etl.sln
- name: Run tests
run: test/Debug/etl_tests.exe
run: test/Debug/etl_tests.exe -v
build-windows-msvc-no-stl:
name: Windows - No STL
runs-on: [windows-2022]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive
@ -42,12 +43,12 @@ jobs:
- name: Build
run: |
cmake -G "Visual Studio 17 2022" -AWin32 -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=17 ./
cmake -G "Visual Studio 17 2022" -AWin32 -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=17 ./
MSBuild.exe -version
MSBuild.exe .\etl.sln
- name: Run tests
run: test/Debug/etl_tests.exe
run: test/Debug/etl_tests.exe -v
build-windows-msvc-stl-force-cpp03:
name: Windows - STL - Force C++03
@ -55,7 +56,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive
@ -64,12 +65,12 @@ jobs:
- name: Build
run: |
cmake -G "Visual Studio 17 2022" -AWin32 -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=ON -DETL_CXX_STANDARD=17 ./
cmake -G "Visual Studio 17 2022" -AWin32 -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=17 ./
MSBuild.exe -version
MSBuild.exe .\etl.sln
- name: Run tests
run: test/Debug/etl_tests.exe
run: test/Debug/etl_tests.exe -v
build-windows-msvc-no-stl-force-cpp03:
name: Windows - No STL - Force C++03
@ -77,7 +78,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive
@ -86,10 +87,10 @@ jobs:
- name: Build
run: |
cmake -G "Visual Studio 17 2022" -AWin32 -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=ON -DETL_CXX_STANDARD=17 ./
cmake -G "Visual Studio 17 2022" -AWin32 -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=17 ./
MSBuild.exe -version
MSBuild.exe .\etl.sln
- name: Run tests
run: test/Debug/etl_tests.exe
run: test/Debug/etl_tests.exe -v

26
.github/workflows/platformio-update.yml vendored Normal file
View File

@ -0,0 +1,26 @@
name: Publish ETL to PlatformIO
on:
release:
types: [published] # Trigger only when a GitHub release is published
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install PlatformIO
run: pip install platformio
- name: Publish to PlatformIO Registry
run: pio package publish --owner etlcpp --non-interactive
env:
PLATFORMIO_AUTH_TOKEN: ${{ secrets.PLATFORMIO_TOKEN }}

33
.gitignore vendored
View File

@ -3,6 +3,8 @@
## Personal
#################
docs/html
hugo/public
hugo/.hugo_build.lock
include/etl/html/
include/etl/latex/
test/vs2013/Debug
@ -386,3 +388,34 @@ test/vs2022/Debug MSVC C++20 - No virtual messages
examples/MutexMessageRouter/.vs
support/time remaining test.xlsx
test/vs2022/Debug MSVC C++20 - Force C++03
test/vs2022/Release MSVC C++20 - No STL - Optimised -O2 - Sanitiser
test/test_file_list.txt
examples/QueuedMessageRouter/vs2022/.vs/QueuedMessageRouter/CopilotIndices
examples/QueuedMessageRouter/vs2022/.vs/QueuedMessageRouter/FileContentIndex
examples/QueuedMessageRouter/vs2022/.vs/QueuedMessageRouter/v17
test/etl_error_handler/assert_errors/build-make
test/etl_error_handler/assert_function/build-make
test/syntax_check/bgcc
test/syntax_check/bclang
test/vs2022/Debug Clang C++20
test/vs2022/Debug MSVC C++20 - Forve C++03 - No virtual messages
test/reflog.txt
test/etl_error_handler/assert_function/build-make
test/syntax_check/bgcc
test/vs2022/Debug MSVC C++23
test/vs2022/Debug MSVC C++23 - No STL
.vs
examples/UniquePtrWithPool/CMakeFiles
examples/UniquePtrWithPool/cmake_install.cmake
examples/UniquePtrWithPool/Makefile
examples/UniquePtrWithPool/CMakeCache.txt
examples/UniquePtrWithPool/UniquePtrWithPool
test/vs2022/Debug Clang C++20 - Optimised -O2
include/etl/header_file_list.txt
temp
test/syntax_check/build-make
hugo/public
hugo/resources
hugo/.hugo_build.lock
docs/*.html
test/build-coverage

0
.gitmodules vendored
View File

45
.treefmt.toml Normal file
View File

@ -0,0 +1,45 @@
[global]
excludes = [
"**/Doxyfile",
"**/Makefile",
"*.*-format",
"*.S",
"*.cmm",
"*.css",
"*.dld",
"*.gdb",
"*.gif",
"*.gitignore",
"*.html",
"*.ini",
"*.josh",
"*.json",
"*.md",
"*.png",
"*.puml",
"*.py",
"*.rb",
"*.rst",
"*.s",
"*.sh",
"*.spec",
"*.toml",
"*.txt",
"*.yaml",
"*.yml",
"docker/**",
"temp/**",
"scripts/clang-format-wrapper",
"include/etl/generators/**",
"include/etl/private/*_cpp03.h",
"subprojects/**",
"test/UnitTest++/**",
"test/Deprecated/**",
"test/Performance/**",
"test/temp/**"
]
[formatter.cpp]
command = "scripts/clang-format-wrapper"
options = [ "-i", "--style=file" ]
includes = [ "*.c", "*.cc", "*.cpp", "*.h", "*.hh", "*.hpp" ]

View File

@ -1,14 +1,14 @@
#######################################################################
# The Embedded Template Library (https://www.etlcpp.com/)
#######################################################################
cmake_minimum_required(VERSION 3.5.0)
cmake_minimum_required(VERSION 3.10)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/helpers.cmake)
set(MSG_PREFIX "etl |")
determine_version_with_git(${GIT_DIR_LOOKUP_POLICY})
etl_determine_version_with_git(${GIT_DIR_LOOKUP_POLICY})
if(NOT ETL_VERSION)
determine_version_with_file("version.txt")
etl_determine_version_with_file("version.txt")
endif()
project(etl VERSION ${ETL_VERSION} LANGUAGES CXX)
@ -52,11 +52,24 @@ if(${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
)
if(ETL_VERSION)
# Generate the package configuration files using CMake provided macros
write_basic_package_version_file(
"${PROJECT_NAME}ConfigVersion.cmake"
COMPATIBILITY SameMajorVersion
ARCH_INDEPENDENT
)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.14)
# Generate the package configuration files using CMake provided macros
write_basic_package_version_file(
"${PROJECT_NAME}ConfigVersion.cmake"
COMPATIBILITY SameMajorVersion
ARCH_INDEPENDENT
)
else()
# This is needed for CMake < 3.14
# because the ARCH_INDEPENDENT option is not available
# in CMake < 3.14
# See https://cmake.org/cmake/help/latest/module/CMakePackageConfigHelpers.html
# for more information
write_basic_package_version_file(
"${PROJECT_NAME}ConfigVersion.cmake"
COMPATIBILITY SameMajorVersion
)
endif()
endif()
configure_package_config_file(
"${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in"

17
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,17 @@
# How to contribute
Thanks for considering a contribution! Heres what you need to know before opening a pull request:
- If you are adding or modifying a feature, add *new* unit tests that test that feature.
- If you are fixing a bug, add a unit test that *fails* before the bug fix is implemented.
- Do not initiate a pull request until all of the units tests pass. See below for information on project files and test scripts.
- Branches should be based on the branch `master`. If `development` has pending updates, Ill rebase the PR against it before pulling..
- For formatting help, you can use clang-format, or the convenience wrapper treefmt. See also [docs/source-formatting.md](docs/source-formatting.md)
There is a project file for VS2022 for C++14, 17, 20, 23, and bash scripts that run the tests for C++11, 14, 17, 20, 23 under Linux with GCC and Clang.
There are syntax-only check bash scripts that cover C++03, 11, 14, 17, 20, 23 under Linux with GCC and Clang.
If you are thinking of adding a new feature then raise this on the GitHub Issues page for discussion as the maintainers and user of the ETL may have questions or suggestions.
It is possible that the maintainer of the ETL or another contributor is already working on the same or a related feature.
Take a look through our current issues and see if anything sparks your interest!

View File

@ -0,0 +1,12 @@
How to convert the ETL header beween #include guards and #pragma once.
Install
python3 -m pip install guardonce
Navigate to etl/scripts
Change from #include guard to #pragma once
./convert_headers_to_use_once.bat
Change from #pragma once to #include guard
./convert_headers_to_use_guards.bat

View File

@ -1,7 +1,5 @@
The MIT License (MIT)
Copyright (c) 2016 jwellbelove, https://github.com/ETLCPP/etl, http://www.etlcpp.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights

217
README.md
View File

@ -1,65 +1,118 @@
Embedded Template Library (ETL)
-------------------------
# ![alt text](https://github.com/ETLCPP/etl/blob/master/images/etl64.png?raw=true) Embedded Template Library (ETL)
[![Release date](https://img.shields.io/github/release-date/jwellbelove/etl?color=%231182c3)](https://img.shields.io/github/release-date/jwellbelove/etl?color=%231182c3)
![GitHub release (latest by date)](https://img.shields.io/github/v/release/jwellbelove/etl)
[![Standard](https://img.shields.io/badge/c%2B%2B-98/03/11/14/17-blue.svg)](https://en.wikipedia.org/wiki/C%2B%2B#Standardization)
[![Release date](https://img.shields.io/github/release-date/jwellbelove/etl?color=%231182c3)](https://img.shields.io/github/release-date/jwellbelove/etl?color=%231182c3)
[![Standard](https://img.shields.io/badge/c%2B%2B-98/03/11/14/17/20/23-blue.svg)](https://en.wikipedia.org/wiki/C%2B%2B#Standardization)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)
![GitHub contributors](https://img.shields.io/github/contributors-anon/ETLCPP/etl)
![GitHub forks](https://img.shields.io/github/forks/ETLCPP/etl?style=flat)
![GitHub Repo stars](https://img.shields.io/github/stars/ETLCPP/etl?style=flat)
![CI](https://github.com/ETLCPP/etl/actions/workflows/msvc.yml/badge.svg?branch=master)
![CI](https://github.com/ETLCPP/etl/actions/workflows/gcc-c++11.yml/badge.svg?branch=master)
![CI](https://github.com/ETLCPP/etl/actions/workflows/gcc-c++14.yml/badge.svg?branch=master)
![CI](https://github.com/ETLCPP/etl/actions/workflows/gcc-c++17.yml/badge.svg?branch=master)
![CI](https://github.com/ETLCPP/etl/actions/workflows/gcc-c++20.yml/badge.svg?branch=master)
![CI](https://github.com/ETLCPP/etl/actions/workflows/gcc-c++23.yml/badge.svg?branch=master)
![CI](https://github.com/ETLCPP/etl/actions/workflows/gcc-syntax-checks.yml/badge.svg?branch=master)
![CI](https://github.com/ETLCPP/etl/actions/workflows/clang-c++11.yml/badge.svg?branch=master)
![CI](https://github.com/ETLCPP/etl/actions/workflows/clang-c++14.yml/badge.svg?branch=master)
![CI](https://github.com/ETLCPP/etl/actions/workflows/clang-c++17.yml/badge.svg?branch=master)
![CI](https://github.com/ETLCPP/etl/actions/workflows/clang-c++20.yml/badge.svg?branch=master)
![CI](https://github.com/ETLCPP/etl/actions/workflows/clang-c++23.yml/badge.svg?branch=master)
![CI](https://github.com/ETLCPP/etl/actions/workflows/clang-syntax-checks.yml/badge.svg?branch=master)
![CI](https://github.com/ETLCPP/etl/workflows/msvc/badge.svg?branch=master)
![CI](https://github.com/ETLCPP/etl/workflows/gcc/badge.svg?branch=master)
![CI](https://github.com/ETLCPP/etl/workflows/clang/badge.svg?branch=master)
[![Build status](https://ci.appveyor.com/api/projects/status/b7jgecv7unqjw4u0/branch/master?svg=true)](https://ci.appveyor.com/project/jwellbelove/etl/branch/master)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/3c14cd918ccf40008d0bcd7b083d5946)](https://www.codacy.com/manual/jwellbelove/etl?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=ETLCPP/etl&amp;utm_campaign=Badge_Grade)
![GitHub contributors](https://img.shields.io/github/contributors-anon/ETLCPP/etl)
[![](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https://github.com/sponsors/ETLCPP)
[![](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https://www.etlcpp.com/sponsor.html)
[Project documentation](https://www.etlcpp.com/)
## Motivation
C++ is a great language to use for embedded applications and templates are a powerful aspect. The standard library can offer a great deal of well tested functionality, but there are some parts of the standard library that do not fit well with deterministic behaviour and limited resource requirements. These limitations usually preclude the use of dynamically allocated memory and containers with open ended sizes.
C++ is a powerful language for embedded systems development, with templates offering a great deal of flexibility and type safety. While the C++ Standard Library provides a wealth of well-tested functionality, its often not well suited to environments with strict deterministic behavior and limited resources.
What is needed is a template library where the user can declare the size, or maximum size of any object upfront. Most embedded compilers do not currently support the standard beyond C++ 03, therefore excluding the programmer from using the enhanced features of the later library.
In many embedded applications, dynamic memory allocation is discouraged or outright prohibited, making standard STL containers and many other components impractical or unusable.
This is what the ETL attempts to achieve.
Whats needed is a template library specifically designed for embedded systems — one that allows developers to define fixed or maximum sizes for containers and other objects at compile time. Additionally, since many embedded toolchains still lack full support for standards beyond C++03, it's valuable to have access to a library that backports select features from later versions of the C++ Standard Library.
## Summary
## About the ETL
The ETL is not designed to completely replace the STL, but complement it.
Its design objective covers three areas.
The Embedded Template Library (ETL) is not intended as a full replacement for the C++ Standard Template Library (STL), but rather as a complementary solution tailored specifically for embedded systems.
- Create a set of containers where the size or maximum size is determined at compile time. These containers are direct equivalents of those supplied in the STL.
- Be compatible with C++ 03 but implement as many of the C++ 11/14/17/20 additions as possible.
- Add other useful components that are not present in the standard library.
Its design goals include:
The embedded template library has been designed for lower resource embedded applications.
It contains a set of containers, algorithms and utilities, some of which emulate parts of the STL.
There is no dynamic memory allocation. The library makes no use of the heap. All of the containers have a fixed capacity allowing all memory allocation to be determined at compile time.
The library is intended for any compiler that supports C++98/03/11/14/17/20.
- Providing a set of containers with fixed or maximum sizes defined at compile-time.
## Main features
- Offering APIs that closely resemble those of the STL, enabling familiar and consistent usage.
- Cross platform. This library is not specific to any processor type.
- No dynamic memory allocation
- No RTTI required
- Very little use of virtual functions. They are used only when they are absolutely necessary for the required functionality
- A set of fixed capacity containers. (array, bitset, deque, forward_list, list, queue, stack, vector, map, set, etc.)
- As the storage for all of the container types is allocated as a contiguous block, they are extremely cache friendly
- Templated compile time constants
- Templated design pattern base classes (Visitor, Observer)
- Reverse engineered C++ 0x11 features (type traits, algorithms, containers etc.)
- Type-safe enumerations
- Type-safe typedefs
- 8, 16, 32 & 64 bit CRC calculations
- Checksums & hash functions
- Variants (a type that can store many types in a type-safe interface)
- Choice of asserts, exceptions, error handler or no checks on errors
- Unit tested (currently over 6480 tests), using VS2019, GCC 8.1.0, , GCC 9.3.0, Clang 9.0.0 & 10.0.0
- Many utilities for template support.
- Easy to read and documented source.
- Free email support
- Maintaining compatibility with C++98 while implementing many features introduced in later standards
(C++11/14/17/20/23) where possible.
- Ensuring deterministic behavior, which is critical in real-time and resource-constrained environments.
- Introducing additional components and utilities useful in embedded contexts but absent from the STL.
The ETL avoids dynamic memory allocation entirely; the heap is never used. All non-intrusive containers have a fixed capacity, allowing memory requirements to be fully determined at compile-time. This makes the ETL ideal for lower-resource embedded applications where predictability, performance, and memory control are essential.
The library is compatible with any compiler that supports C++03 or later.
Help on integrating the ETL with your project may be found here.
## Key features of the ETL
- Actively Maintained: Developed and maintained on GitHub since 2014.
- Open Source: MIT licensed.
- No STL Dependency: Designed to operate independently of the C++ Standard Template Library.
- No Dynamic Memory Allocation: All storage is allocated either at compile-time or on the stack; heap usage is entirely avoided.
- RTTI and Virtual Functions: No runtime type information (RTTI) is required. Virtual functions are used sparingly and only when strictly necessary.
- Header-Only Library: All functionality is provided via header files; No separate compilation needed.
- Fixed-Capacity Containers: Offers STL-like containers with fixed or maximum capacity, plus additional non-standard container types.
- Cache Efficiency: Containers use contiguous memory layouts for optimal cache performance.
- Compact Codebase: Shared base classes (based on type) help reduce overall container code size.
- Compile-Time Features:
- Templated compile-time constants
- Template-based design pattern base classes (e.g., Visitor, Observer)
- Type-safe smart enumerations
- Type-safe typedefs and constants
- Embedded System Frameworks:
- Message routing
- Finite state machines
- Task scheduling
- C++11 Backports: Implements many C++11 features (type traits, algorithms, containers) for use in C++03 environments.
- Utilities:
- CRC calculations (8, 16, 32 & 64-bit)
- Checksums and hash functions
- Variants (type-safe unions)
- Extensive template support utilities
- Robust Error Handling: Configurable error checking using asserts, exceptions, error handlers, or no checks; users choice.
- Thoroughly Tested:
- Over 10,000 unit tests
- Tested with Visual Studio 2022, GCC 12, and Clang 14
- Continuous integration via GitHub Actions.
- Readable and Well-Documented: Clean, maintainable source code with clear documentation.
- Support: Free email support available. A Slack group is available. Paid support on request.
- Archived: A snapshot of the ETL is preserved in the Arctic Code Vault for long-term digital preservation.
Any help porting the library to work under different platforms and compilers would be gratefully received.
I am especially interested in people who are using Keil, IAR, Green Hills, TI Code Composer etc, bare metal or RTOS, and DSPs.
@ -129,6 +182,84 @@ add_executable(foo main.cpp)
target_link_libraries(foo PRIVATE etl::etl)
```
## Profile definition
When using ETL in a project, there is typically an `etl_profile.h` defined to
adjust ETL to the project needs. ETL will automatically find `etl_profile.h`
if it is available in the include path(s). If it's not available, ETL will
work with default values.
### Example
```
#ifndef __ETL_PROFILE_H__
#define __ETL_PROFILE_H__
#define ETL_TARGET_DEVICE_GENERIC
#define ETL_TARGET_OS_NONE
#define ETL_NO_STL
#endif
```
## Platform specific implementation
Although ETL is generally a self-contained header-only library, some interfaces need to be
implemented in every project or platform, at least if those interfaces are actually being
used, due to project specifics:
| ETL header | Platform specific API to be implemented | Needed when using |
|------------|-----------------------------------------|-------------------------------------|
| `chrono.h` | `etl_get_high_resolution_clock()` | `etl::high_resolution_clock::now()` |
| | `etl_get_system_clock()` | `etl::system_clock::now()` |
| | `etl_get_steady_clock()` | `etl::steady_clock::now()` |
| `print.h` | `etl_putchar()` | `etl::print()` |
| | | `etl::println()` |
### Example
```
#include <etl/chrono.h>
#include <etl/print.h>
extern "C"
{
etl::chrono::high_resolution_clock::rep etl_get_high_resolution_clock()
{
return etl::chrono::high_resolution_clock::rep(static_cast<int64_t>(getSystemTimeNs()));
}
etl::chrono::system_clock::rep etl_get_system_clock()
{
return etl::chrono::system_clock::rep(static_cast<int64_t>(getSystemTimeNs()));
}
etl::chrono::system_clock::rep etl_get_steady_clock()
{
return etl::chrono::system_clock::rep(static_cast<int64_t>(getSystemTimeNs()));
}
void etl_putchar(int c)
{
putByteToStdout(static_cast<uint8_t>(c));
}
}
```
The following default values apply if the respective macros are not defined
(e.g. in `etl_profile.h`):
| Macro | Default |
|-----------------------------------------------|----------------------------|
| `ETL_CHRONO_SYSTEM_CLOCK_DURATION` | `etl::chrono::nanoseconds` |
| `ETL_CHRONO_SYSTEM_CLOCK_IS_STEADY` | `true` |
| `ETL_CHRONO_HIGH_RESOLUTION_CLOCK_DURATION` | `etl::chrono::nanoseconds` |
| `ETL_CHRONO_HIGH_RESOLUTION_CLOCK_IS_STEADY` | `true` |
| `ETL_CHRONO_STEADY_CLOCK_DURATION` | `etl::chrono::nanoseconds` |
## Arduino library
The content of this repo is available as a library in the Arduino IDE (search for the "Embedded Template Library" in the IDE library manager). The Arduino library repository is available at ```https://github.com/ETLCPP/etl-arduino```, see there for more details.

View File

@ -16,11 +16,5 @@ install:
build:
project: test/vs2022/etl.vcxproj
verbosity: minimal
notifications:
- provider: Webhook
url: https://hooks.slack.com/services/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
method: POST
on_build_success: true
on_build_failure: true
on_build_status_changed: true

View File

@ -2,79 +2,79 @@
#ifndef ETL_EMBEDDED_TEMPLATE_LIBRARY_INCLUDED
#define ETL_EMBEDDED_TEMPLATE_LIBRARY_INCLUDED
#if defined(TEENSYDUINO)
#if defined(TEENSYDUINO)
#if defined(__AVR_ATmega32U4__)
#define ARDUINO_BOARD "Teensy 2.0"
#elif defined(__AVR_AT90USB1286__)
#define ARDUINO_BOARD "Teensy++ 2.0"
#elif defined(__MK20DX128__)
#define ARDUINO_BOARD "Teensy 3.0"
#elif defined(__MK20DX256__)
#define ARDUINO_BOARD "Teensy 3.2" // and Teensy 3.1
#elif defined(__MKL26Z64__)
#define ARDUINO_BOARD "Teensy LC"
#elif defined(__MK64FX512__)
#define ARDUINO_BOARD "Teensy 3.5"
#elif defined(__MK66FX1M0__)
#define ARDUINO_BOARD "Teensy 3.6"
#else
#define ARDUINO_BOARD "Unknown"
#endif
#if defined(__AVR_ATmega32U4__)
#define ARDUINO_BOARD "Teensy 2.0"
#elif defined(__AVR_AT90USB1286__)
#define ARDUINO_BOARD "Teensy++ 2.0"
#elif defined(__MK20DX128__)
#define ARDUINO_BOARD "Teensy 3.0"
#elif defined(__MK20DX256__)
#define ARDUINO_BOARD "Teensy 3.2" // and Teensy 3.1
#elif defined(__MKL26Z64__)
#define ARDUINO_BOARD "Teensy LC"
#elif defined(__MK64FX512__)
#define ARDUINO_BOARD "Teensy 3.5"
#elif defined(__MK66FX1M0__)
#define ARDUINO_BOARD "Teensy 3.6"
#else
#define ARDUINO_BOARD "Unknown"
#endif
#else // --------------- Arduino ------------------
#if defined(ARDUINO_AVR_ADK)
#define ARDUINO_BOARD "Mega Adk"
#elif defined(ARDUINO_AVR_BT)
#define ARDUINO_BOARD "Bt"
#elif defined(ARDUINO_AVR_DUEMILANOVE)
#define ARDUINO_BOARD "Duemilanove"
#elif defined(ARDUINO_AVR_ESPLORA)
#define ARDUINO_BOARD "Esplora"
#elif defined(ARDUINO_AVR_ETHERNET)
#define ARDUINO_BOARD "Ethernet"
#elif defined(ARDUINO_AVR_FIO)
#define ARDUINO_BOARD "Fio"
#elif defined(ARDUINO_AVR_GEMMA)
#define ARDUINO_BOARD "Gemma"
#elif defined(ARDUINO_AVR_LEONARDO)
#define ARDUINO_BOARD "Leonardo"
#elif defined(ARDUINO_AVR_LILYPAD)
#define ARDUINO_BOARD "Lilypad"
#elif defined(ARDUINO_AVR_LILYPAD_USB)
#define ARDUINO_BOARD "Lilypad Usb"
#elif defined(ARDUINO_AVR_MEGA)
#define ARDUINO_BOARD "Mega"
#elif defined(ARDUINO_AVR_MEGA2560)
#define ARDUINO_BOARD "Mega 2560"
#elif defined(ARDUINO_AVR_MICRO)
#define ARDUINO_BOARD "Micro"
#elif defined(ARDUINO_AVR_MINI)
#define ARDUINO_BOARD "Mini"
#elif defined(ARDUINO_AVR_NANO)
#define ARDUINO_BOARD "Nano"
#elif defined(ARDUINO_AVR_NG)
#define ARDUINO_BOARD "NG"
#elif defined(ARDUINO_AVR_PRO)
#define ARDUINO_BOARD "Pro"
#elif defined(ARDUINO_AVR_ROBOT_CONTROL)
#define ARDUINO_BOARD "Robot Ctrl"
#elif defined(ARDUINO_AVR_ROBOT_MOTOR)
#define ARDUINO_BOARD "Robot Motor"
#elif defined(ARDUINO_AVR_UNO)
#define ARDUINO_BOARD "Uno"
#elif defined(ARDUINO_AVR_YUN)
#define ARDUINO_BOARD "Yun"
#elif defined(ARDUINO_SAM_DUE)
#define ARDUINO_BOARD "Due"
#elif defined(ARDUINO_SAMD_ZERO)
#define ARDUINO_BOARD "Zero"
#elif defined(ARDUINO_ARC32_TOOLS)
#define ARDUINO_BOARD "101"
#else
#define ARDUINO_BOARD "Unknown"
#endif
#if defined(ARDUINO_AVR_ADK)
#define ARDUINO_BOARD "Mega Adk"
#elif defined(ARDUINO_AVR_BT)
#define ARDUINO_BOARD "Bt"
#elif defined(ARDUINO_AVR_DUEMILANOVE)
#define ARDUINO_BOARD "Duemilanove"
#elif defined(ARDUINO_AVR_ESPLORA)
#define ARDUINO_BOARD "Esplora"
#elif defined(ARDUINO_AVR_ETHERNET)
#define ARDUINO_BOARD "Ethernet"
#elif defined(ARDUINO_AVR_FIO)
#define ARDUINO_BOARD "Fio"
#elif defined(ARDUINO_AVR_GEMMA)
#define ARDUINO_BOARD "Gemma"
#elif defined(ARDUINO_AVR_LEONARDO)
#define ARDUINO_BOARD "Leonardo"
#elif defined(ARDUINO_AVR_LILYPAD)
#define ARDUINO_BOARD "Lilypad"
#elif defined(ARDUINO_AVR_LILYPAD_USB)
#define ARDUINO_BOARD "Lilypad Usb"
#elif defined(ARDUINO_AVR_MEGA)
#define ARDUINO_BOARD "Mega"
#elif defined(ARDUINO_AVR_MEGA2560)
#define ARDUINO_BOARD "Mega 2560"
#elif defined(ARDUINO_AVR_MICRO)
#define ARDUINO_BOARD "Micro"
#elif defined(ARDUINO_AVR_MINI)
#define ARDUINO_BOARD "Mini"
#elif defined(ARDUINO_AVR_NANO)
#define ARDUINO_BOARD "Nano"
#elif defined(ARDUINO_AVR_NG)
#define ARDUINO_BOARD "NG"
#elif defined(ARDUINO_AVR_PRO)
#define ARDUINO_BOARD "Pro"
#elif defined(ARDUINO_AVR_ROBOT_CONTROL)
#define ARDUINO_BOARD "Robot Ctrl"
#elif defined(ARDUINO_AVR_ROBOT_MOTOR)
#define ARDUINO_BOARD "Robot Motor"
#elif defined(ARDUINO_AVR_UNO)
#define ARDUINO_BOARD "Uno"
#elif defined(ARDUINO_AVR_YUN)
#define ARDUINO_BOARD "Yun"
#elif defined(ARDUINO_SAM_DUE)
#define ARDUINO_BOARD "Due"
#elif defined(ARDUINO_SAMD_ZERO)
#define ARDUINO_BOARD "Zero"
#elif defined(ARDUINO_ARC32_TOOLS)
#define ARDUINO_BOARD "101"
#else
#define ARDUINO_BOARD "Unknown"
#endif
#endif
#endif

View File

@ -1,6 +1,6 @@
{
"name": "Embedded Template Library - Arduino",
"version": "20.38.4",
"name": "Embedded Template Library ETL",
"version": "20.47.1",
"authors": {
"name": "John Wellbelove",
"email": "john.wellbelove@etlcpp.com"
@ -11,7 +11,7 @@
"keywords": "c-plus-plus, cpp, algorithms, containers, templates",
"repository": {
"type": "git",
"url": "https://github.com/ETLCPP/etl.git"
"url": "https://github.com/ETLCPP/etl-arduino.git"
},
"build": {
"includeDir": "include"

View File

@ -1,5 +1,5 @@
name=Embedded Template Library - Arduino
version=20.38.4
name=Embedded Template Library ETL
version=20.47.1
author= John Wellbelove <john.wellbelove@etlcpp.com>
maintainer=John Wellbelove <john.wellbelove@etlcpp.com>
license=MIT

View File

@ -12,23 +12,6 @@
# Returns the results of git describe on the source tree, and adjusting
# the output so that it tests false if an error occurs.
#
# git_describe_working_tree(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe on the working tree (--dirty option),
# and adjusting the output so that it tests false if an error occurs.
#
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe --exact-match on the source tree,
# and adjusting the output so that it tests false if there was no exact
# matching tag.
#
# git_local_changes(<var>)
#
# Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes.
# Uses the return code of "git diff-index --quiet HEAD --".
# Does not regard untracked files.
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
@ -43,10 +26,10 @@
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(__get_git_revision_description)
if(__etl_get_git_revision_description)
return()
endif()
set(__get_git_revision_description YES)
set(__etl_get_git_revision_description YES)
# We must run the following at "include" time, not at function call time,
# to find the path to this module rather than the path to a calling list file
@ -59,10 +42,10 @@ get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
# function returns an empty string via _git_dir_var.
#
# Example: Given a path C:/bla/foo/bar and assuming C:/bla/.git exists and
# neither foo nor bar contain a file/directory .git. This wil return
# neither foo nor bar contain a file/directory .git. This will return
# C:/bla/.git
#
function(_git_find_closest_git_dir _start_dir _git_dir_var)
function(_etl_git_find_closest_git_dir _start_dir _git_dir_var)
set(cur_dir "${_start_dir}")
set(git_dir "${_start_dir}/.git")
while(NOT EXISTS "${git_dir}")
@ -83,8 +66,8 @@ function(_git_find_closest_git_dir _start_dir _git_dir_var)
PARENT_SCOPE)
endfunction()
function(get_git_head_revision _refspecvar _hashvar)
_git_find_closest_git_dir("${CMAKE_CURRENT_SOURCE_DIR}" GIT_DIR)
function(etl_get_git_head_revision _refspecvar _hashvar)
_etl_git_find_closest_git_dir("${CMAKE_CURRENT_SOURCE_DIR}" GIT_DIR)
if("${ARGN}" STREQUAL "ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR")
set(ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR TRUE)
@ -143,7 +126,7 @@ function(get_git_head_revision _refspecvar _hashvar)
string(REGEX REPLACE "gitdir: (.*)$" "\\1" git_worktree_dir
${worktree_ref})
string(STRIP ${git_worktree_dir} git_worktree_dir)
_git_find_closest_git_dir("${git_worktree_dir}" GIT_DIR)
_etl_git_find_closest_git_dir("${git_worktree_dir}" GIT_DIR)
set(HEAD_SOURCE_FILE "${git_worktree_dir}/HEAD")
endif()
else()
@ -172,11 +155,11 @@ function(get_git_head_revision _refspecvar _hashvar)
PARENT_SCOPE)
endfunction()
function(git_describe _var)
function(etl_git_describe _var)
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
get_git_head_revision(refspec hash ${ARGN})
etl_get_git_head_revision(refspec hash ${ARGN})
if(NOT GIT_FOUND)
set(${_var}
"GIT-NOTFOUND"
@ -214,71 +197,3 @@ function(git_describe _var)
"${out}"
PARENT_SCOPE)
endfunction()
function(git_describe_working_tree _var)
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
if(NOT GIT_FOUND)
set(${_var}
"GIT-NOTFOUND"
PARENT_SCOPE)
return()
endif()
execute_process(
COMMAND "${GIT_EXECUTABLE}" describe --dirty ${ARGN}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE res
OUTPUT_VARIABLE out
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT res EQUAL 0)
set(out "${out}-${res}-NOTFOUND")
endif()
set(${_var}
"${out}"
PARENT_SCOPE)
endfunction()
function(git_get_exact_tag _var)
git_describe(out --exact-match ${ARGN})
set(${_var}
"${out}"
PARENT_SCOPE)
endfunction()
function(git_local_changes _var)
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
get_git_head_revision(refspec hash)
if(NOT GIT_FOUND)
set(${_var}
"GIT-NOTFOUND"
PARENT_SCOPE)
return()
endif()
if(NOT hash)
set(${_var}
"HEAD-HASH-NOTFOUND"
PARENT_SCOPE)
return()
endif()
execute_process(
COMMAND "${GIT_EXECUTABLE}" diff-index --quiet HEAD --
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE res
OUTPUT_VARIABLE out
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if(res EQUAL 0)
set(${_var}
"CLEAN"
PARENT_SCOPE)
else()
set(${_var}
"DIRTY"
PARENT_SCOPE)
endif()
endfunction()

View File

@ -1,4 +1,4 @@
function(determine_version_with_file VER_FILE_NAME)
function(etl_determine_version_with_file VER_FILE_NAME)
file(READ ${VER_FILE_NAME} ETL_VERSION_RAW)
# Remove trailing whitespaces and/or newline
string(STRIP ${ETL_VERSION_RAW} ETL_VERSION)
@ -8,12 +8,12 @@ function(determine_version_with_file VER_FILE_NAME)
message(STATUS "${MSG_PREFIX} Determined ETL version ${ETL_VERSION} from version.txt file")
endfunction()
function(determine_version_with_git)
function(etl_determine_version_with_git)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/GetGitRevisionDescription.cmake)
git_describe(VERSION ${ARGN})
etl_git_describe(VERSION ${ARGN})
string(FIND ${VERSION} "." VALID_VERSION)
if(VALID_VERSION EQUAL -1)
if(PROJECT_IS_TOP_LEVEL)
if(CMAKE_CURRENT_LIST_DIR STREQUAL PROJECT_SOURCE_DIR)
# only warn if this is the top-level project, since we may be
# building from a tarball as a subproject
message(WARNING "Version string ${VERSION} retrieved with git describe is invalid")

6
docs/_config.yml Normal file
View File

@ -0,0 +1,6 @@
plugins:
- jekyll-relative-links
relative_links:
enabled: true
include:
- manchester.md

7
docs/index.md Normal file
View File

@ -0,0 +1,7 @@
---
title: ETL documentation
---
## Pages
* [Manchester](manchester.md)

259
docs/manchester.md Normal file
View File

@ -0,0 +1,259 @@
---
title: Manchester encoding and decoding
---
Efficient Manchester encoding and decoding of data. The Manchester code represents a data bit as a sequence of a 'high' and a 'low' value. In software this translates to a conversion from one to two bits, or in a practical situation, from `n` bytes to `n*2` bytes.
## See also
[Manchester code](https://en.wikipedia.org/wiki/Manchester_code)
## Features
- Normal and inverted Manchester encoding
- Support for multiple encoding chunk sizes: 8-bit, 16-bit and 32-bit
- Span-based operations or chunk-based operations
- Constexpr functions for compile-time encoding/decoding
- Validation of encoded data
- Chunked span I/O uses little-endian byte order for multi-byte chunks, independent of host platform endianness
## Algorithm background
To encode the value `0b11001100` we must first duplicate all bits to create the value `0b1111000011110000`. We then perform an XOR of this value with the constant `0b1010101010101010` (`0xAAAA`) to obtain the Manchester coded value of `0b1010010110100101`. We have now replaced each `1` bit with the sequence `10` and each `0` bit with the sequence `01`.
### 2. Bit duplication
Bit duplication is achieved with the following steps. This is also called binary interleaving. The example shows encoding of an 8-bit value.
| Step | High Byte | Low Byte | Operation |
|------|--------------------|--------------------|----------------------------|
| 0 | `_ _ _ _ _ _ _ _` | `A B C D E F G H` | input value (i) |
| 1 | `_ _ _ _ A B C D` | `_ _ _ _ E F G H` | `(i \| (i << 4)) & 0x0F0F` |
| 2 | `_ _ A B _ _ C D` | `_ _ E F _ _ G H` | `(i \| (i << 2)) & 0x3333` |
| 3 | `_ A _ B _ C _ D` | `_ E _ F _ G _ H` | `(i \| (i << 1)) & 0x5555` |
| 4 | `A A B B C C D D` | `E E F F G G H H` | `(i \| (i << 1))` |
This process can be easily extended to 16-bit or 32-bit values by adding additional steps to the bit duplication.
### 3. Manchester Decoding
Manchester decoding is done in a similar, but reversed way.
### 4. Error Detection
Error detection in Manchester coded data is done by comparing 2 neighboring bits. If they are
equal, then there is an error in the encoded input data.
Comparing all 8 bit pairs in a 16-bit word is done as follows.
| Step | Binary Value | Operation | Description |
|------|--------------|-------------------|-----------------------------------------------------------------------------------------------|
| 1 | `11011000` | Original | First bit pair (lsb, 00) is invalid. Last bit pair is also invalid. Other bit pairs are valid |
| 2 | `01101100` | Shift right by 1 | Shift the original value right by one bit |
| 3 | `10110100` | XOR | XOR the original with the shifted value |
| 4 | `01010101` | Mask with 0x55 | Apply mask to isolate bit pairs |
| 5 | `00010100` | Result | If result is not equal to 0x55, there was an error in the input |
## Analysis
Most traditional ways to Manchester encode data consist of a loop over all bits and a nested if-statement to check the value of the current bit. This approach does not scale well to increasing number of bits. The algorithm implemented here contains no conditional code and scales well. Doubling the number of processed bits per step (the chunk size) adds a single row to the bit duplication table. Because of the lack of loops and conditional code, this algorithm is likely to perform better than traditional ones on simple processors or when compiler optimization is disabled. On modern, powerful processors with caches and advanced optimization possibilities this algorithm may not show much benefit. In any case, the performance of the algorithm depends heavily on the processor type, compiler and compiler (optimization) settings.
## API Reference
### Classes
Classes `etl::manchester` and `etl::manchester_inverted` contain static functions for encoding, decoding and validity checking. It is not necessary to instantiate objects of these classes.
#### etl::manchester
```cpp
typedef manchester_base<private_manchester::manchester_type_normal> manchester;
```
Manchester encoder using normal encoding (no inversion).
#### etl::manchester_inverted
```cpp
typedef manchester_base<private_manchester::manchester_type_inverted> manchester_inverted;
```
Manchester encoder using inverted encoding.
### Encoding Functions
#### Encode single value
```cpp
template <typename TDecoded>
static ETL_CONSTEXPR14 typename encoded<TDecoded>::type encode(TDecoded decoded)
```
Encodes a single value using Manchester encoding.
**Parameters:**
- `decoded`: The value to encode (`uint8_t`, `uint16_t`, or `uint32_t`)
**Returns:**
- The Manchester encoded value (twice the bit width of input)
**Example:**
```cpp
uint16_t encoded = etl::manchester::encode(0x55);
```
#### Encode range
```cpp
template <typename TChunk = uint_least8_t>
static ETL_CONSTEXPR14 void encode(etl::span<const uint_least8_t> decoded,
etl::span<uint_least8_t> encoded)
```
Encodes a span of data using the specified chunk size.
**Parameters:**
- `decoded`: Source data to encode
- `encoded`: Destination for encoded data (must be twice the size of `decoded`)
**Template Parameters:**
- `TChunk`: Chunk size for encoding (`uint8_t`, `uint16_t` or `uint32_t`)
**Example:**
```cpp
std::array<uint8_t, 4> data = {0x12, 0x34, 0x56, 0x78};
std::array<uint8_t, 8> encoded_data1{};
std::array<uint8_t, 8> encoded_data2{};
// Encode with TChunk == uint8_t
etl::manchester::encode(data, encoded_data1);
// Encode with TChunk == uint32_t
etl::manchester::encode<uint32_t>(data, encoded_data2);
```
### Decoding Functions
#### Decode single value
```cpp
template <typename TEncoded>
static ETL_CONSTEXPR14 typename decoded<TEncoded>::type decode(TEncoded encoded)
```
Decodes a single Manchester encoded value.
**Parameters:**
- `encoded`: The encoded value to decode (`uint16_t`, `uint32_t`, or `uint64_t`)
**Returns:**
- The Manchester decoded value (half the bit width of input)
**Example:**
```cpp
uint8_t decoded = etl::manchester::decode(0x5A5A);
```
#### Decode range
```cpp
template <typename TChunk = typename private_manchester::encoded<uint_least8_t>::type>
static ETL_CONSTEXPR14 void decode(etl::span<const uint_least8_t> encoded,
etl::span<uint_least8_t> decoded)
```
Decodes a span of Manchester encoded data.
**Parameters:**
- `encoded`: Source data to decode
- `decoded`: Destination for decoded data (must be half the size of `encoded`)
**Template Parameters:**
- `TChunk`: Chunk type for decoding (`uint16_t`, `uint32_t`, or `uint64_t`)
**Example:**
```cpp
std::array<uint8_t, 8> encoded = {/* ... */};
std::array<uint8_t, 4> decoded1 {};
std::array<uint8_t, 4> decoded2 {};
// Decode with TChunk == uint16_t
etl::manchester::decode(encoded, decoded1);
// Decode with TChunk == uint64_t
etl::manchester::decode<uint64_t>(encoded, decoded2);
```
### Validation Functions
#### Single value
```cpp
template <typename TChunk>
static ETL_CONSTEXPR14 bool is_valid(TChunk encoded)
```
Validates that a single value contains valid Manchester encoded data.
**Parameters:**
- `encoded`: The encoded value to validate
**Returns:**
- `true` if the value contains valid Manchester encoded data, `false` otherwise
**Example:**
```cpp
bool valid = etl::manchester::is_valid(0x5A5A);
```
#### Range
```cpp
static ETL_CONSTEXPR14 bool is_valid(etl::span<const uint_least8_t> encoded)
```
Validates that a range contains valid Manchester encoded data.
**Parameters:**
- `encoded`: The range of encoded data to validate
**Returns:**
- `true` if all data is valid Manchester encoding, `false` otherwise
**Example:**
```cpp
std::array<uint8_t, 8> encoded_data = {/* ... */};
bool valid = etl::manchester::is_valid(encoded_data);
```
## Supported Types
### Input/chunk types for encoding
- `uint8_t``uint16_t` (if 8-bit types are supported)
- `uint16_t``uint32_t`
- `uint32_t``uint64_t` (if 64-bit types are supported)
### Input/chunk types for decoding
- `uint16_t``uint8_t` (if 8-bit types are supported)
- `uint32_t``uint16_t`
- `uint64_t``uint32_t` (if 64-bit types are supported)

328
docs/ranges.md Normal file
View File

@ -0,0 +1,328 @@
# ETL C++17 Ranges Implementation
## Overview
The Embedded Template Library provides a C++17-compatible implementation of ranges, inspired by the C++20 ranges library. This implementation enables range-based algorithms and views for embedded and resource-constrained environments where full C++20 support may not be available.
## Features
- **Ranges**: Provides range types and iterator wrappers for composing operations over sequences.
- **Views**: Includes lightweight, composable views such as `filter_view`, `transform_view`, and `subrange`.
- **Algorithms**: Supports range-based algorithms compatible with ETL containers and standard containers.
- **Compatibility**: Designed for C++17, with minimal dependencies and no reliance on C++20 features.
## Getting Started
Include the main header in your project:
```cpp
#include <etl/ranges.h>
```
### Example Usage
#### Using Ranges
```cpp
#include <etl/print.h>
#include <etl/ranges.h>
#include <etl/vector.h>
...
etl::vector<int, 10> data = {6, 1, 3, 3, 2};
etl::ranges::sort(data);
etl::ranges::for_each(data, [](const int& i){etl::print(" {}", i);});
```
Output:
```text
1 2 3 3 6
```
#### Using Views
```cpp
#include <etl/print.h>
#include <etl/ranges.h>
#include <etl/vector.h>
...
etl::vector<int, 10> data = {1, 2, 3, 4, 5};
auto even = [](int v) { return v % 2 == 0; };
auto filtered = etl::ranges::filter_view(data, even);
etl::ranges::for_each(filtered, [](const int& i){etl::print(" {}", i);});
```
Output:
```text
2 4
```
#### Transforming Elements
```cpp
#include <etl/print.h>
#include <etl/ranges.h>
#include <etl/vector.h>
...
etl::vector<int, 10> data = {1, 2, 3, 4, 5};
auto squared = etl::ranges::transform_view(data, [](int v) { return v * v; });
etl::ranges::for_each(squared, [](const int& i){etl::print(" {}", i);});
```
Output:
```text
1 4 9 16 25
```
#### Composition
Views can be composed using the pipe (`|`) operator, allowing you to chain multiple transformations in a readable, left-to-right style:
```cpp
#include <etl/print.h>
#include <etl/ranges.h>
#include <etl/vector.h>
namespace views = etl::ranges::views;
...
etl::vector<int, 10> data = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
auto result = data
| views::filter([](const int& v) { return v % 2 == 0; })
| views::transform([](const int& v) { return v * v; });
etl::ranges::for_each(result, [](const int& i){ etl::print(" {}", i); });
```
Output:
```text
4 16 36 64 100
```
This first filters the even numbers and then squares them. Each `|` passes the result of the previous stage as input to the next view adaptor.
## Supported Views
All views are in the `etl::ranges` namespace. Corresponding range adaptor objects are available in `etl::ranges::views`.
### Range Factories
| View | `views::` adaptor | Description |
|---|---|---|
| `empty_view<T>` | `views::empty<T>` | A view with no elements. |
| `single_view` | `views::single` | A view containing exactly one element. |
| `iota_view` | `views::iota` | A view of sequentially increasing values. |
| `repeat_view` | `views::repeat` | A view that repeats a value a given number of times. |
### Range Adaptors
| View | `views::` adaptor | Description |
|---|---|---|
| `ref_view` | `views::ref` | A non-owning view that wraps a reference to a range. |
| `owning_view` | `views::owning` | A view that takes ownership of a range via move. |
| — | `views::all` | Returns the range itself (if already a view), a `ref_view`, or an `owning_view`. |
| `filter_view` | `views::filter` | Filters elements based on a predicate. |
| `transform_view` | `views::transform` | Applies a transformation to each element. |
| `as_rvalue_view` | `views::as_rvalue` | Casts each element to an rvalue reference. |
| `as_const_view` | `views::as_const` | Provides a const view of the elements. |
| `cache_latest_view` | `views::cache_latest` | Caches the most recently accessed element (avoids recomputation). |
| `reverse_view` | `views::reverse` | Reverses the order of elements. |
| `drop_view` | `views::drop` | Skips the first *n* elements. |
| `drop_while_view` | `views::drop_while` | Skips leading elements while a predicate is true. |
| `take_view` | `views::take` | Takes the first *n* elements. |
| `take_while_view` | `views::take_while` | Takes leading elements while a predicate is true. |
| `join_view` | `views::join` | Flattens a range of ranges into a single range. |
| `join_with_view` | `views::join_with` | Flattens a range of ranges, inserting a delimiter between each. |
| `split_view` | `views::split` | Splits a range into subranges around a delimiter pattern. |
| `lazy_split_view` | `views::lazy_split` | Lazily splits a range by a pattern (inner ranges discovered on iteration). |
| — | `views::counted` | Creates a view of *n* elements starting from an iterator. |
| `concat_view` | `views::concat` | Concatenates multiple ranges into a single view. |
| `zip_view` | `views::zip` | Zips multiple ranges into a view of tuples (length of shortest range). |
| `zip_transform_view` | `views::zip_transform` | Zips multiple ranges and applies a function to each tuple of elements. |
| `common_view` | `views::common` | Adapts a view so that its iterator and sentinel types are the same. |
| `enumerate_view` | `views::enumerate` | Pairs each element with its index, producing tuples of (index, value). |
| `elements_view` | `views::elements` | Extracts the *N*-th element from each tuple-like value. |
| `keys_view` | `views::keys` | Alias for `elements_view` with *N*=0 (extracts first element of pairs/tuples). |
| `values_view` | `views::values` | Alias for `elements_view` with *N*=1 (extracts second element of pairs/tuples). |
| `adjacent_view` | `views::adjacent` | Produces a view of tuples of *N* adjacent elements (sliding window of tuples). |
| — | `views::pairwise` | Alias for `views::adjacent<2>`. |
| `adjacent_transform_view` | `views::adjacent_transform` | Applies a function to each group of *N* adjacent elements. |
| — | `views::pairwise_transform` | Alias for `views::adjacent_transform<2>`. |
| `chunk_view` | `views::chunk` | Splits a range into non-overlapping chunks of a given size. |
| `slide_view` | `views::slide` | Produces overlapping subranges (sliding windows) of a given size. |
| `chunk_by_view` | `views::chunk_by` | Splits a range into subranges between adjacent elements where a predicate is false. |
| `stride_view` | `views::stride` | Yields every *N*-th element from the underlying range. |
| `cartesian_product_view` | `views::cartesian_product` | Produces the Cartesian product of multiple ranges as a view of tuples. |
| `to_input_view` | `views::to_input` | Downgrades iterator category to input iterator while preserving elements and order. |
| `subrange` | — | Represents a sub-range defined by an iteratorsentinel pair. |
All views support range-based for-loop iteration and can be composed with the pipe (`|`) operator.
## Supported Algorithms
All algorithms are callable objects in the `etl::ranges` namespace. Each supports both an iterator-pair overload and a range overload (where applicable), and most accept optional projection and comparator arguments.
### Non-modifying Sequence Operations
| Algorithm | Description |
|---|---|
| `for_each` | Applies a function to each element in a range. |
| `for_each_n` | Applies a function to the first *n* elements. |
| `find` | Finds the first element equal to a value. |
| `find_if` | Finds the first element satisfying a predicate. |
| `find_if_not` | Finds the first element not satisfying a predicate. |
| `find_end` | Finds the last occurrence of a subsequence. |
| `find_first_of` | Finds the first element matching any in a second range. |
| `adjacent_find` | Finds the first pair of adjacent equal elements. |
| `count` | Counts elements equal to a value. |
| `count_if` | Counts elements satisfying a predicate. |
| `all_of` | Checks if all elements satisfy a predicate. |
| `any_of` | Checks if any element satisfies a predicate. |
| `none_of` | Checks if no elements satisfy a predicate. |
| `mismatch` | Finds the first position where two ranges differ. |
| `equal` | Checks if two ranges are equal. |
| `is_permutation` | Checks if one range is a permutation of another. |
| `search` | Searches for the first occurrence of a subsequence. |
| `search_n` | Searches for *n* consecutive copies of a value. |
| `starts_with` | Checks if a range starts with another range. |
| `ends_with` | Checks if a range ends with another range. |
| `lexicographical_compare` | Compares two ranges lexicographically. |
### Fold Operations
| Algorithm | Description |
|---|---|
| `fold_left` | Left-folds elements with a binary operation. |
| `fold_left_with_iter` | Left-folds, returning both the result and an iterator. |
| `fold_left_first` | Left-folds using the first element as the initial value. |
| `fold_left_first_with_iter` | Like `fold_left_first`, also returning an iterator. |
| `fold_right` | Right-folds elements with a binary operation. |
| `fold_right_last` | Right-folds using the last element as the initial value. |
### Modifying Sequence Operations
| Algorithm | Description |
|---|---|
| `copy` | Copies elements to a destination range. |
| `copy_n` | Copies *n* elements to a destination range. |
| `copy_if` | Copies elements satisfying a predicate. |
| `copy_backward` | Copies elements backwards to a destination range. |
| `move` | Moves elements to a destination range. |
| `move_backward` | Moves elements backwards to a destination range. |
| `swap_ranges` | Swaps elements between two ranges. |
| `replace` | Replaces elements equal to a value. |
| `replace_if` | Replaces elements satisfying a predicate. |
| `replace_copy` | Copies, replacing elements equal to a value. |
| `replace_copy_if` | Copies, replacing elements satisfying a predicate. |
| `remove` | Removes elements equal to a value. |
| `remove_if` | Removes elements satisfying a predicate. |
| `remove_copy` | Copies, omitting elements equal to a value. |
| `fill` | Fills a range with a value. |
| `fill_n` | Fills *n* elements with a value. |
| `generate` | Assigns each element the result of a generator function. |
| `generate_n` | Assigns *n* elements the result of a generator function. |
| `iota` | Fills a range with sequentially increasing values. |
| `unique` | Removes consecutive duplicate elements. |
| `unique_copy` | Copies, removing consecutive duplicates. |
| `transform` | Applies a transformation to each element. |
| `reverse` | Reverses the order of elements. |
| `reverse_copy` | Copies elements in reverse order. |
| `rotate` | Rotates elements in a range. |
| `rotate_copy` | Copies elements with rotation. |
| `shift_left` | Shifts elements to the left. |
| `shift_right` | Shifts elements to the right. |
| `shuffle` | Randomly reorders elements. |
| `sample` | Selects *n* random elements from a range. |
### Sorting Operations
| Algorithm | Description |
|---|---|
| `sort` | Sorts elements in a range. |
| `stable_sort` | Sorts elements preserving relative order of equivalent elements. |
| `partial_sort` | Partially sorts a range so that the first *n* elements are sorted. |
| `partial_sort_copy` | Copies and partially sorts elements. |
| `nth_element` | Partially sorts so that the *n*-th element is in its sorted position. |
| `is_sorted` | Checks if a range is sorted. |
| `is_sorted_until` | Finds the first unsorted element. |
### Partitioning Operations
| Algorithm | Description |
|---|---|
| `partition` | Partitions elements by a predicate. |
| `stable_partition` | Partitions elements, preserving relative order. |
| `is_partitioned` | Checks if a range is partitioned. |
| `partition_copy` | Copies elements into two ranges based on a predicate. |
| `partition_point` | Finds the partition point. |
### Binary Search (on sorted ranges)
| Algorithm | Description |
|---|---|
| `lower_bound` | Finds the first element not less than a value. |
| `upper_bound` | Finds the first element greater than a value. |
| `equal_range` | Returns the range of elements equal to a value. |
| `binary_search` | Checks if a sorted range contains a value. |
### Set Operations (on sorted ranges)
| Algorithm | Description |
|---|---|
| `includes` | Checks if one sorted range includes another. |
| `merge` | Merges two sorted ranges. |
| `inplace_merge` | Merges two consecutive sorted sub-ranges in place. |
| `set_union` | Computes the union of two sorted ranges. |
| `set_intersection` | Computes the intersection of two sorted ranges. |
| `set_difference` | Computes the difference of two sorted ranges. |
| `set_symmetric_difference` | Computes the symmetric difference of two sorted ranges. |
### Heap Operations
| Algorithm | Description |
|---|---|
| `make_heap` | Creates a heap from a range. |
| `push_heap` | Pushes an element onto a heap. |
| `pop_heap` | Pops the top element from a heap. |
| `sort_heap` | Sorts a heap into a sorted range. |
| `is_heap` | Checks if a range is a heap. |
| `is_heap_until` | Finds the first element that breaks the heap property. |
### Min/Max Operations
| Algorithm | Description |
|---|---|
| `min` | Returns the smaller of two values or the smallest in an initializer list. |
| `min_element` | Finds the smallest element in a range. |
| `max` | Returns the larger of two values or the largest in an initializer list. |
| `max_element` | Finds the largest element in a range. |
| `minmax` | Returns the smaller and larger of two values. |
| `minmax_element` | Finds both the smallest and largest elements in a range. |
| `clamp` | Clamps a value between a minimum and maximum. |
### Permutation Operations
| Algorithm | Description |
|---|---|
| `next_permutation` | Generates the next lexicographic permutation. |
| `prev_permutation` | Generates the previous lexicographic permutation. |
## Reference
For reference to the STD implementation, see also:
- Algorithms: https://en.cppreference.com/w/cpp/algorithm.html
- Ranges/Views: https://en.cppreference.com/w/cpp/ranges.html
## Limitations
- Not all C++20 range features are available due to limitation to C++17. Especially C++20 concepts are not used.
- Designed for ETL containers but can work with standard containers if compatible with ETL's iterator requirements.

100
docs/source-formatting.md Normal file
View File

@ -0,0 +1,100 @@
# Source Formatting
This project uses **clang-format** (version 18) to enforce a consistent coding style
for C and C++ source files. For convenience, **treefmt** is also configured as a
single-command wrapper that discovers and formats every file in the tree.
---
## clang-format
### Configuration file
The formatting rules live in [`.clang-format`](../.clang-format) at the repository
root. The style is based on **LLVM**.
See the `.clang-format` file itself for the complete list.
### Version requirement
clang-format **18** is required.
The helper script [`scripts/clang-format-wrapper`](../scripts/clang-format-wrapper)
automatically resolves the correct binary: it first looks for `clang-format-18` on
`PATH`, then falls back to `clang-format` and verifies that its major version is 18.
All other tooling in the repo calls this wrapper instead of `clang-format` directly.
### Running clang-format manually
Format every tracked source file in the repository:
```bash
git ls-files -z \
'*.c' '*.cc' '*.cpp' \
'*.h' '*.hh' '*.hpp' \
':(exclude)include/etl/generators/*' \
':(exclude)include/etl/private/*_cpp03.h' | xargs -0 scripts/clang-format-wrapper -i --verbose --style=file
```
You can also format individual files directly:
```bash
scripts/clang-format-wrapper -i --style=file path/to/file.cpp
```
---
## treefmt
[treefmt](https://treefmt.com) is a language-agnostic source-tree formatter.
It reads a single configuration file and dispatches each file to the appropriate
formatter. In this project, it delegates all C/C++ formatting to the same
`clang-format-wrapper` described above.
In comparison to calling clang-format directly, it brings a significant speedup.
### Configuration file
The configuration lives in [`.treefmt.toml`](../.treefmt.toml) at the repository root.
### Installing treefmt
treefmt is a standalone Go binary. Install it with any of:
```bash
# Using the official install script
curl -fsSL https://raw.githubusercontent.com/numtide/treefmt/main/install.sh | bash
# Or via Homebrew
brew install treefmt
# Or via Nix
nix profile install nixpkgs#treefmt2
```
See the [treefmt documentation](https://treefmt.com) for more options.
### Running treefmt
From the repository root:
```bash
# Format everything
treefmt
# Check formatting without modifying files (useful in CI)
treefmt --fail-on-change
```
---
## Excluded paths
`.treefmt.toml` excludes generated files under
`include/etl/generators/`. Do **not** format those files manually via clang-format or treefmt.
## Pre-commit
Before submitting a PR / contribution, run `treefmt --fail-on-change` to catch
unformatted code before merge.
Alternatively, a plain `treefmt` automatically fixes any issues.

View File

@ -10,6 +10,6 @@
#define ETL_CALLBACK_TIMER_USE_ATOMIC_LOCK
#define ETL_NO_STL
//#include "etl/profiles/auto.h"
// #include "etl/profiles/auto.h"
#endif

View File

@ -1,23 +1,23 @@
#include <stdio.h>
//#if (__cplusplus < 201103L)
// #if (__cplusplus < 201103L)
extern "C"
{
//#endif
#include "Board_LED.h" // ::Board Support:LED
// #endif
#include "Board_Buttons.h" // ::Board Support:Buttons
//#if (__cplusplus < 201103L)
#include "Board_LED.h" // ::Board Support:LED
// #if (__cplusplus < 201103L)
}
//#endif
// #endif
#include "stm32f4xx.h" // Device header
#include "stm32f4xx.h" // Device header
#include "etl/function.h"
#include "etl/callback_timer.h"
#include "etl/vector.h"
#include "etl/iterator.h"
#include "etl/binary.h"
#include "etl/callback_timer.h"
#include "etl/function.h"
#include "etl/iterator.h"
#include "etl/vector.h"
struct FP
{
@ -28,7 +28,7 @@ static etl::vector<FP, 10> power_callbacks;
void register_poweroff_callback(void (*function)())
{
FP fp = { function };
FP fp = {function};
power_callbacks.push_back(fp);
}
@ -45,38 +45,38 @@ etl::timer::id::type swap_timers;
* SystemCoreClockConfigure: configure SystemCoreClock using HSI
(HSE is not populated on Nucleo board)
*----------------------------------------------------------------------------*/
void SystemCoreClockConfigure(void) {
void SystemCoreClockConfigure(void)
{
RCC->CR |= ((uint32_t)RCC_CR_HSION); // Enable HSI
while ((RCC->CR & RCC_CR_HSIRDY) == 0); // Wait for HSI Ready
RCC->CR |= ((uint32_t)RCC_CR_HSION); // Enable HSI
while ((RCC->CR & RCC_CR_HSIRDY) == 0); // Wait for HSI Ready
RCC->CFGR = RCC_CFGR_SW_HSI; // HSI is system clock
while ((RCC->CFGR & RCC_CFGR_SWS) != RCC_CFGR_SWS_HSI); // Wait for HSI used as system clock
RCC->CFGR = RCC_CFGR_SW_HSI; // HSI is system clock
while ((RCC->CFGR & RCC_CFGR_SWS) != RCC_CFGR_SWS_HSI); // Wait for HSI used as system clock
FLASH->ACR = FLASH_ACR_PRFTEN; // Enable Prefetch Buffer
FLASH->ACR |= FLASH_ACR_ICEN; // Instruction cache enable
FLASH->ACR |= FLASH_ACR_DCEN; // Data cache enable
FLASH->ACR |= FLASH_ACR_LATENCY_5WS; // Flash 5 wait state
FLASH->ACR = FLASH_ACR_PRFTEN; // Enable Prefetch Buffer
FLASH->ACR |= FLASH_ACR_ICEN; // Instruction cache enable
FLASH->ACR |= FLASH_ACR_DCEN; // Data cache enable
FLASH->ACR |= FLASH_ACR_LATENCY_5WS; // Flash 5 wait state
RCC->CFGR |= RCC_CFGR_HPRE_DIV1; // HCLK = SYSCLK
RCC->CFGR |= RCC_CFGR_PPRE1_DIV4; // APB1 = HCLK/4
RCC->CFGR |= RCC_CFGR_PPRE2_DIV2; // APB2 = HCLK/2
RCC->CFGR |= RCC_CFGR_HPRE_DIV1; // HCLK = SYSCLK
RCC->CFGR |= RCC_CFGR_PPRE1_DIV4; // APB1 = HCLK/4
RCC->CFGR |= RCC_CFGR_PPRE2_DIV2; // APB2 = HCLK/2
RCC->CR &= ~RCC_CR_PLLON; // Disable PLL
RCC->CR &= ~RCC_CR_PLLON; // Disable PLL
// PLL configuration: VCO = HSI/M * N, Sysclk = VCO/P
RCC->PLLCFGR = ( 16ul | // PLL_M = 16
(384ul << 6U) | // PLL_N = 384
( 3ul << 16U) | // PLL_P = 8
(RCC_PLLCFGR_PLLSRC_HSI) | // PLL_SRC = HSI
( 8ul << 24U) ); // PLL_Q = 8
RCC->PLLCFGR = (16ul | // PLL_M = 16
(384ul << 6U) | // PLL_N = 384
(3ul << 16U) | // PLL_P = 8
(RCC_PLLCFGR_PLLSRC_HSI) | // PLL_SRC = HSI
(8ul << 24U)); // PLL_Q = 8
RCC->CR |= RCC_CR_PLLON; // Enable PLL
while((RCC->CR & RCC_CR_PLLRDY) == 0) __NOP(); // Wait till PLL is ready
RCC->CR |= RCC_CR_PLLON; // Enable PLL
while ((RCC->CR & RCC_CR_PLLRDY) == 0) __NOP(); // Wait till PLL is ready
RCC->CFGR &= ~RCC_CFGR_SW; // Select PLL as system clock source
RCC->CFGR |= RCC_CFGR_SW_PLL;
while ((RCC->CFGR & RCC_CFGR_SWS) != RCC_CFGR_SWS_PLL); // Wait till PLL is system clock src
RCC->CFGR &= ~RCC_CFGR_SW; // Select PLL as system clock source
RCC->CFGR |= RCC_CFGR_SW_PLL;
while ((RCC->CFGR & RCC_CFGR_SWS) != RCC_CFGR_SWS_PLL); // Wait till PLL is system clock src
}
void StartTimers()
@ -123,7 +123,7 @@ void LedToggle()
int main()
{
SystemCoreClockConfigure(); // configure HSI as System Clock
SystemCoreClockConfigure(); // configure HSI as System Clock
SystemCoreClockUpdate();
LED_Initialize();
@ -131,10 +131,10 @@ int main()
// The LEDs will start flashing fast after 2 seconds.
// After another 5 seconds they will start flashing slower.
short_toggle = callback_timer.register_timer(LedToggle, 50, etl::timer::mode::REPEATING);
long_toggle = callback_timer.register_timer(LedToggle, 100, etl::timer::mode::REPEATING);
short_toggle = callback_timer.register_timer(LedToggle, 50, etl::timer::mode::REPEATING);
long_toggle = callback_timer.register_timer(LedToggle, 100, etl::timer::mode::REPEATING);
start_timers = callback_timer.register_timer(StartTimers, 2000, etl::timer::mode::SINGLE_SHOT);
swap_timers = callback_timer.register_timer(SwapTimers, 1500, etl::timer::mode::SINGLE_SHOT);
swap_timers = callback_timer.register_timer(SwapTimers, 1500, etl::timer::mode::SINGLE_SHOT);
SysTick_Config(SystemCoreClock / 1000);
@ -152,7 +152,7 @@ extern "C"
{
void SysTick_Handler()
{
const uint32_t TICK = 1U;
const uint32_t TICK = 1U;
static uint32_t nticks = TICK;
if (callback_timer.tick(nticks))

View File

@ -11,8 +11,8 @@ enum VectorId
USART1_IRQ_HANDLER = 52,
USART2_IRQ_HANDLER = 53,
VECTOR_ID_END,
VECTOR_ID_OFFSET = TIM1_CC_IRQ_HANDLER,
VECTOR_ID_RANGE = VECTOR_ID_END - VECTOR_ID_OFFSET
VECTOR_ID_OFFSET = TIM1_CC_IRQ_HANDLER,
VECTOR_ID_RANGE = VECTOR_ID_END - VECTOR_ID_OFFSET
};
typedef etl::delegate_service<VECTOR_ID_RANGE, VECTOR_ID_OFFSET> InterruptVectors;
@ -91,8 +91,8 @@ public:
// Constructor.
Uart(int port_id, size_t interruptId)
: port_id(port_id),
callback(etl::delegate<void(size_t)>::create<Uart, &Uart::InterruptHandler>(*this))
: port_id(port_id)
, callback(etl::delegate<void(size_t)>::create<Uart, &Uart::InterruptHandler>(*this))
{
GetInterruptVectorsInstance().register_delegate(interruptId, callback);
}
@ -119,7 +119,8 @@ Uart uart1(0, USART1_IRQ_HANDLER);
Uart uart2(1, USART2_IRQ_HANDLER);
// Declare a global callback for the timer.
// Uses the most efficient callback type for a class, as everthing is known at compile time.
// Uses the most efficient callback type for a class, as everything is known at
// compile time.
etl::delegate<void(size_t)> timer_member_callback = etl::delegate<void(size_t)>::create<Timer, timer, &Timer::InterruptHandler>();
// Declare the callbacks for the free functions.

View File

@ -1,7 +1,7 @@
#include <iostream>
#include "etl/function.h"
#include "etl/callback_service.h"
#include "etl/function.h"
enum VectorId
{
@ -11,8 +11,8 @@ enum VectorId
USART1_IRQ_HANDLER = 52,
USART2_IRQ_HANDLER = 53,
VECTOR_ID_END,
VECTOR_ID_OFFSET = TIM1_CC_IRQ_HANDLER,
VECTOR_ID_RANGE = VECTOR_ID_END - VECTOR_ID_OFFSET
VECTOR_ID_OFFSET = TIM1_CC_IRQ_HANDLER,
VECTOR_ID_RANGE = VECTOR_ID_END - VECTOR_ID_OFFSET
};
typedef etl::callback_service<VECTOR_ID_RANGE, VECTOR_ID_OFFSET> InterruptVectors;
@ -91,8 +91,8 @@ public:
// Constructor.
Uart(int port_id, int interruptId)
: port_id(port_id),
callback(*this)
: port_id(port_id)
, callback(*this)
{
GetInterruptVectorsInstance().register_callback(interruptId, callback);
}
@ -119,7 +119,8 @@ Uart uart1(0, USART1_IRQ_HANDLER);
Uart uart2(1, USART2_IRQ_HANDLER);
// Declare a global callback for the timer.
// Uses the most efficient callback type for a class, as everthing is known at compile time.
// Uses the most efficient callback type for a class, as everything is known at
// compile time.
etl::function_imp<Timer, size_t, timer, &Timer::InterruptHandler> timer_member_callback;
// Declare the callbacks for the free functions.

View File

@ -1,13 +1,13 @@
#include <iostream>
#include <thread>
#include <atomic>
#include <string>
#include <chrono>
#include <iostream>
#include <string>
#include <thread>
#include "etl/mutex.h"
#include "etl/message.h"
#include "etl/message_router.h"
#include "etl/mutex.h"
//*************************************
struct Message1 : public etl::message<1>
@ -48,9 +48,7 @@ public:
}
//*****************
void on_receive_unknown(const etl::imessage&)
{
}
void on_receive_unknown(const etl::imessage&) {}
std::string result;
@ -61,7 +59,7 @@ private:
//*************************************
etl::atomic<bool> start = false;
Router router;
Router router;
//*************************************
void thread1()
@ -106,5 +104,3 @@ int main()
return 0;
}

View File

@ -31,9 +31,9 @@ SOFTWARE.
// derived class.
//*****************************************************************************
#include "etl/queue.h"
#include "etl/fsm.h"
#include "etl/message_packet.h"
#include "etl/queue.h"
#include <iostream>
#include <string>
@ -122,7 +122,7 @@ public:
while (!queue.empty())
{
message_packet& packet = queue.front();
etl::imessage& msg = packet.get();
etl::imessage& msg = packet.get();
std::cout << "Processing message " << int(msg.get_message_id()) << std::endl;
// Call the base class's receive function.
@ -258,7 +258,7 @@ int main()
State2 state2;
// The list of states.
etl::ifsm_state* state_list[] = { &state1, &state2 };
etl::ifsm_state* state_list[] = {&state1, &state2};
// Define some messages.
Message1 m1(1);
@ -285,4 +285,3 @@ int main()
return 0;
}

View File

@ -1,6 +1,6 @@
#include "etl/queue.h"
#include "etl/message_router.h"
#include "etl/queue.h"
#include <iostream>
#include <string>
@ -52,8 +52,6 @@ public:
typedef etl::message_router<Router, Message1, Message2, Message3> Base_t;
using Base_t::receive;
//***************************************************************************
Router()
: message_router(1)
@ -83,7 +81,7 @@ public:
while (!queue.empty())
{
message_packet& packet = queue.front();
etl::imessage& msg = packet.get();
etl::imessage& msg = packet.get();
std::cout << "Processing message " << int(msg.get_message_id()) << std::endl;
// Call the base class's receive function.
@ -148,4 +146,3 @@ int main()
return 0;
}

View File

@ -29,26 +29,26 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>

View File

@ -31,9 +31,9 @@ SOFTWARE.
// Experiment with the different scheduling policies.
//*****************************************************************************
#include "etl/function.h"
#include "etl/scheduler.h"
#include "etl/task.h"
#include "etl/function.h"
#include <iostream>
#include <string>
@ -50,13 +50,13 @@ public:
: task(1)
, work(3)
{
}
//*************************************
uint32_t task_request_work() const
{
return work; // How much work do we still have to do? This could be a message queue length.
return work; // How much work do we still have to do? This could be a
// message queue length.
}
//*************************************
@ -83,13 +83,13 @@ public:
: task(2)
, work(4)
{
}
//*************************************
uint32_t task_request_work() const
{
return work; // How much work do we still have to do? This could be a message queue length.
return work; // How much work do we still have to do? This could be a
// message queue length.
}
//*************************************
@ -115,7 +115,6 @@ public:
Idle(etl::ischeduler& scheduler_)
: scheduler(scheduler_)
{
}
//*************************************
@ -181,4 +180,3 @@ int main()
return 0;
}

View File

@ -2,18 +2,18 @@
// Shared message example
//*****************************************************************************
#include "etl/shared_message.h"
#include "etl/message.h"
#include "etl/reference_counted_message_pool.h"
#include "etl/message_router.h"
#include "etl/message_bus.h"
#include "etl/fixed_sized_memory_block_allocator.h"
#include "etl/message.h"
#include "etl/message_bus.h"
#include "etl/message_router.h"
#include "etl/queue.h"
#include "etl/reference_counted_message_pool.h"
#include "etl/shared_message.h"
#include <iostream>
#include <atomic>
#include <string>
#include <iostream>
#include <mutex>
#include <string>
constexpr etl::message_router_id_t RouterId1 = 1U;
constexpr etl::message_router_id_t RouterId2 = 2U;
@ -26,9 +26,8 @@ struct Message1 : public etl::message<1>
Message1(std::string s_)
: s(s_)
{
}
std::string s;
};
@ -40,10 +39,10 @@ struct Message2 : public etl::message<2>
Message2(std::string s_)
: s(s_)
{
}
std::string s;
char data[100];
};
@ -55,7 +54,6 @@ struct Message3 : public etl::message<3>
Message3(std::string s_)
: s(s_)
{
}
std::string s;
@ -199,7 +197,7 @@ struct Bus : public etl::message_bus<2U>
//*****************************************************************************
MessageRouter1 router1;
MessageRouter2 router2;
Bus bus;
Bus bus;
//*****************************************************************************
// The thread safe message pool. Uses atomic uint32_t for counting.
@ -230,8 +228,8 @@ private:
};
//*****************************************************************************
// The memory block allocator that supplies the pool with memory
// to store reference counted messages in.
// The memory block allocator that supplies the pool with memory
// to store reference counted messages in.
// The reference counted message parameters type for the messages we will use.
using message_parameters_small = MessagePool::pool_message_parameters<Message1, Message3>;
@ -243,10 +241,12 @@ constexpr size_t max_alignment_small = message_parameters_small::max_alignment;
constexpr size_t max_size_large = message_parameters_large::max_size;
constexpr size_t max_alignment_large = message_parameters_large::max_alignment;
// A fixed memory block allocator for 4 items, using the parameters from the smaller messages.
// A fixed memory block allocator for 4 items, using the parameters from the
// smaller messages.
etl::fixed_sized_memory_block_allocator<max_size_small, max_alignment_small, 4U> memory_allocator;
// A fixed memory block allocator for 4 items, using the parameters from the larger message.
// A fixed memory block allocator for 4 items, using the parameters from the
// larger message.
etl::fixed_sized_memory_block_allocator<max_size_large, max_alignment_large, 4U> memory_allocator_successor;
//*****************************************************************************
@ -256,8 +256,8 @@ etl::fixed_sized_memory_block_allocator<max_size_large, max_alignment_large, 4U>
MessagePool message_pool(memory_allocator);
//*****************************************************************************
// A statically allocated reference counted message that is never allocated or released by a pool.
// Contains a copy of Message3("Three").
// A statically allocated reference counted message that is never allocated or
// released by a pool. Contains a copy of Message3("Three").
//*****************************************************************************
etl::persistent_message<Message3> pm3(Message3("Three"));
@ -269,10 +269,15 @@ int main()
Message1 m1("One");
Message2 m2("Two");
etl::shared_message sm1(message_pool, m1); // Created a shared message by allocating a reference counted message from message_pool containing a copy of m1.
etl::shared_message sm2(message_pool, m2); // Created a shared message by allocating a reference counted message from message_pool containing a copy of m2.
etl::shared_message sm3(pm3); // Created a shared message from a statically allocated persistent message.
etl::shared_message sm1(message_pool,
m1); // Created a shared message by allocating a reference counted message
// from message_pool containing a copy of m1.
etl::shared_message sm2(message_pool,
m2); // Created a shared message by allocating a reference counted message
// from message_pool containing a copy of m2.
etl::shared_message sm3(pm3); // Created a shared message from a statically
// allocated persistent message.
bus.subscribe(router1); // Subscribe router1 to the bus.
bus.subscribe(router2); // Subscribe router2 to the bus.

View File

@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 3.10)
project(UniquePtrWithPool LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Add source files
add_executable(UniquePtrWithPool Main.cpp)
target_include_directories(UniquePtrWithPool PRIVATE ../../include)

View File

@ -0,0 +1,38 @@
#include <iostream>
#include "etl/memory.h"
#include "etl/pool.h"
struct S
{
S(int a_, double b_)
: a(a_)
, b(b_)
{
}
int a;
double b;
};
int main()
{
etl::pool<S, 10> pool;
auto pool_deleter = [&pool](auto ptr)
{
std::cout << "Releasing S(" << ptr->a << ", " << ptr->b << ") back to pool." << std::endl;
pool.destroy(ptr);
};
using Unique = etl::unique_ptr<S, decltype(pool_deleter)>;
Unique us1(pool.create(1, 2), pool_deleter);
std::cout << "Created S(" << us1->a << ", " << us1->b << ") from pool." << std::endl;
{
Unique us2(pool.create(3, 4), pool_deleter);
std::cout << "Created S(" << us2->a << ", " << us2->b << ") from pool." << std::endl;
}
Unique us3(pool.create(5, 6), pool_deleter);
std::cout << "Created S(" << us3->a << ", " << us3->b << ") from pool." << std::endl;
}

View File

@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36408.4 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UniquePtrWithPool", "UniquePtrWithPool.vcxproj", "{B9ED2FDF-2529-4315-9AEF-02A98B804DEC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B9ED2FDF-2529-4315-9AEF-02A98B804DEC}.Debug|x64.ActiveCfg = Debug|x64
{B9ED2FDF-2529-4315-9AEF-02A98B804DEC}.Debug|x64.Build.0 = Debug|x64
{B9ED2FDF-2529-4315-9AEF-02A98B804DEC}.Debug|x86.ActiveCfg = Debug|Win32
{B9ED2FDF-2529-4315-9AEF-02A98B804DEC}.Debug|x86.Build.0 = Debug|Win32
{B9ED2FDF-2529-4315-9AEF-02A98B804DEC}.Release|x64.ActiveCfg = Release|x64
{B9ED2FDF-2529-4315-9AEF-02A98B804DEC}.Release|x64.Build.0 = Release|x64
{B9ED2FDF-2529-4315-9AEF-02A98B804DEC}.Release|x86.ActiveCfg = Release|Win32
{B9ED2FDF-2529-4315-9AEF-02A98B804DEC}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D21FA849-65C8-4A81-BD9D-B38BFBD73494}
EndGlobalSection
EndGlobal

View File

@ -19,36 +19,36 @@
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{0523db70-0955-4eb0-a042-04514987a602}</ProjectGuid>
<RootNamespace>etlinitialiserlist</RootNamespace>
<ProjectGuid>{b9ed2fdf-2529-4315-9aef-02a98b804dec}</ProjectGuid>
<RootNamespace>UniquePtrWithPool</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
@ -70,26 +70,13 @@
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;ETL_NO_STL;ETL_IN_UNIT_TEST_INITIALIZER_LIST;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalIncludeDirectories>../../include/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@ -104,11 +91,10 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>../../include/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
@ -135,13 +121,11 @@
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\test_initializer_list.cpp" />
<ClCompile Include="Main.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View File

@ -88,35 +88,35 @@ public:
// Notify observers about a position event.
void Position_Event()
{
Position position = { 100, 200 };
Position position = {100, 200};
notify_observers(position);
}
// Notify observers about a button up event.
void Button_Event_Up()
{
Button button = { Button::Up };
Button button = {Button::Up};
notify_observers(button);
}
// Notify observers about a button down event.
void Button_Event_Down()
{
Button button = { Button::Down };
Button button = {Button::Down};
notify_observers(button);
}
// Notify observers about a wheel up event.
void Wheel_Event_Up()
{
Wheel wheel = { 50 };
Wheel wheel = {50};
notify_observers(wheel);
}
// Notify observers about a wheel down event.
void Wheel_Event_Down()
{
Wheel wheel = { -25 };
Wheel wheel = {-25};
notify_observers(wheel);
}
};
@ -137,6 +137,6 @@ int main()
mouse_driver.Position_Event();
mouse_driver.Wheel_Event_Down();
mouse_driver.Wheel_Event_Up();
return 0;
}

View File

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ .Title }} | {{ .Site.Title }}</title>
</head>
<body>
<main>
{{ block "main" . }}{{ end }}
</main>
{{ partial "footer.html" . }}
</body>
</html>

View File

@ -0,0 +1,4 @@
<footer style="text-align: center;">
<p>© 2014{{ now.Format "2006" }} {{ .Site.Title }}. All rights reserved.</p>
<p></p>
</footer>

View File

@ -0,0 +1,9 @@
<a href="https://scan.coverity.com/projects/embedded-template-library">
<img alt="Coverity Scan Build Status"
src="https://scan.coverity.com/projects/30565/badge.svg"/>
</a>
<a href="https://scan.coverity.com/projects/embedded-template-library">
<img alt="Coverity Scan Build Status"
src="https://img.shields.io/coverity/scan/30565.svg"/>
</a>

BIN
images/QR Github.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -31,17 +31,41 @@ SOFTWARE.
#ifndef ETL_ABSOLUTE_INCLUDED
#define ETL_ABSOLUTE_INCLUDED
#include "type_traits.h"
#include "platform.h"
#include "error_handler.h"
#include "integral_limits.h"
#include "type_traits.h"
namespace etl
{
namespace private_absolute
{
//*************************************************************************
// Non-constexpr function that is never called for valid inputs.
// If reached during constant evaluation, the compiler emits an error
// because it's not constexpr.
// At runtime, triggers the ETL assert handler.
//*************************************************************************
template <typename T>
inline T signed_min_error()
{
ETL_ASSERT_FAIL(ETL_ERROR_GENERIC("absolute value of minimum signed integer is undefined"));
return T(0);
}
} // namespace private_absolute
//***************************************************************************
// For signed types.
//***************************************************************************
template <typename T>
ETL_CONSTEXPR typename etl::enable_if<etl::is_signed<T>::value, T>::type
absolute(T value)
ETL_NODISCARD ETL_CONSTEXPR typename etl::enable_if< etl::is_signed<T>::value && etl::is_integral<T>::value, T>::type absolute(T value)
{
return (value == etl::integral_limits<T>::min) ? etl::private_absolute::signed_min_error<T>() : static_cast<T>((value < T(0)) ? -value : value);
}
template <typename T>
ETL_NODISCARD ETL_CONSTEXPR typename etl::enable_if< etl::is_signed<T>::value && !etl::is_integral<T>::value, T>::type absolute(T value)
ETL_NOEXCEPT
{
return (value < T(0)) ? -value : value;
}
@ -50,8 +74,7 @@ namespace etl
// For unsigned types.
//***************************************************************************
template <typename T>
ETL_CONSTEXPR typename etl::enable_if<etl::is_unsigned<T>::value, T>::type
absolute(T value)
ETL_NODISCARD ETL_CONSTEXPR typename etl::enable_if<etl::is_unsigned<T>::value, T>::type absolute(T value) ETL_NOEXCEPT
{
return value;
}
@ -60,16 +83,15 @@ namespace etl
// For signed types.
// Returns the result as the unsigned type.
//***************************************************************************
#if ETL_USING_CPP11
template <typename T, typename TReturn = typename etl::make_unsigned<T>::type>
#else
template <typename T, typename TReturn>
#endif
ETL_CONSTEXPR typename etl::enable_if<etl::is_signed<T>::value, TReturn>::type
absolute_unsigned(T value)
template <typename T>
ETL_NODISCARD ETL_CONSTEXPR typename etl::enable_if<etl::is_signed<T>::value, typename etl::make_unsigned<T>::type>::type absolute_unsigned(T value)
ETL_NOEXCEPT
{
typedef typename etl::make_unsigned<T>::type TReturn;
return (value == etl::integral_limits<T>::min) ? (etl::integral_limits<TReturn>::max / 2U) + 1U
: (value < T(0)) ? TReturn(-value) : TReturn(value);
: (value < T(0)) ? TReturn(-value)
: TReturn(value);
}
//***************************************************************************
@ -77,12 +99,10 @@ namespace etl
// Returns the result as the unsigned type.
//***************************************************************************
template <typename T>
ETL_CONSTEXPR typename etl::enable_if<etl::is_unsigned<T>::value, T>::type
absolute_unsigned(T value)
ETL_NODISCARD ETL_CONSTEXPR typename etl::enable_if<etl::is_unsigned<T>::value, T>::type absolute_unsigned(T value) ETL_NOEXCEPT
{
return etl::absolute(value);
}
}
} // namespace etl
#endif

File diff suppressed because it is too large Load Diff

View File

@ -32,10 +32,11 @@ SOFTWARE.
#define ETL_ALIGNMENT_INCLUDED
#include "platform.h"
#include "type_traits.h"
#include "static_assert.h"
#include "error_handler.h"
#include "exception.h"
#include "static_assert.h"
#include "type_traits.h"
#include "utility.h"
#include <stdint.h>
@ -71,10 +72,23 @@ namespace etl
}
};
//***************************************************************************
/// Typed storage exception.
//***************************************************************************
class typed_storage_error : public alignment_exception
{
public:
typed_storage_error(string_type file_name_, numeric_type line_number_)
: alignment_exception(ETL_ERROR_TEXT("typed_storage:error", ETL_ALIGNMENT_FILE_ID"B"), file_name_, line_number_)
{
}
};
//*****************************************************************************
/// Check that 'p' has 'required_alignment'.
//*****************************************************************************
inline bool is_aligned(void* p, size_t required_alignment)
inline bool is_aligned(const void* p, size_t required_alignment)
{
uintptr_t address = reinterpret_cast<uintptr_t>(p);
return (address % required_alignment) == 0U;
@ -84,7 +98,7 @@ namespace etl
/// Check that 'p' has 'Alignment'.
//*****************************************************************************
template <size_t Alignment>
bool is_aligned(void* p)
bool is_aligned(const void* p)
{
uintptr_t address = reinterpret_cast<uintptr_t>(p);
return (address % Alignment) == 0U;
@ -94,7 +108,7 @@ namespace etl
/// Check that 'p' has the alignment of 'T'.
//*****************************************************************************
template <typename T>
bool is_aligned(void* p)
bool is_aligned(const void* p)
{
return is_aligned<etl::alignment_of<T>::value>(p);
}
@ -110,28 +124,28 @@ namespace etl
// Matching alignment.
template <size_t Alignment, typename T1, typename... TRest>
class type_with_alignment_matcher<true, Alignment, T1, TRest...>
class type_with_alignment_matcher<true, Alignment, T1, TRest...>
{
public:
typedef T1 type;
};
// Non-matching alignment
template <size_t Alignment, typename T1, typename T2, typename... TRest>
class type_with_alignment_matcher <false, Alignment, T1, T2, TRest...>
class type_with_alignment_matcher<false, Alignment, T1, T2, TRest...>
{
public:
typedef typename type_with_alignment_matcher < Alignment <= etl::alignment_of<T2>::value , Alignment, T2, TRest... > ::type type;
typedef typename type_with_alignment_matcher< Alignment <= etl::alignment_of<T2>::value, Alignment, T2, TRest... >::type type;
};
// Non-matching alignment, none left.
template <size_t Alignment, typename T1>
class type_with_alignment_matcher <false, Alignment, T1>
class type_with_alignment_matcher<false, Alignment, T1>
{
public:
typedef char type;
};
@ -139,23 +153,23 @@ namespace etl
// Helper.
//***************************************************************************
template <size_t Alignment, typename T1, typename... T>
class type_with_alignment_helper
class type_with_alignment_helper
{
public:
typedef typename type_with_alignment_matcher<Alignment <= etl::alignment_of<T1>::value, Alignment, T1, T...>::type type;
};
#else
//***************************************************************************
// Matcher.
//***************************************************************************
template <bool Is_Match, const size_t Alignment, typename T1 = void, typename T2 = void, typename T3 = void, typename T4 = void,
typename T5 = void, typename T6 = void, typename T7 = void, typename T8 = void>
template <bool Is_Match, const size_t Alignment, typename T1 = void, typename T2 = void, typename T3 = void, typename T4 = void,
typename T5 = void, typename T6 = void, typename T7 = void, typename T8 = void>
class type_with_alignment_matcher;
// Matching alignment.
template <size_t Alignment, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
class type_with_alignment_matcher <true, Alignment, T1, T2, T3, T4, T5, T6, T7, T8>
class type_with_alignment_matcher<true, Alignment, T1, T2, T3, T4, T5, T6, T7, T8>
{
public:
@ -164,16 +178,17 @@ namespace etl
// Non-matching alignment.
template <size_t Alignment, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
class type_with_alignment_matcher <false, Alignment, T1, T2, T3, T4, T5, T6, T7, T8>
class type_with_alignment_matcher<false, Alignment, T1, T2, T3, T4, T5, T6, T7, T8>
{
public:
typedef typename type_with_alignment_matcher<Alignment <= etl::alignment_of<T2>::value, Alignment, T2, T3, T4, T5, T6, T7, T8, void>::type type;
typedef
typename type_with_alignment_matcher< Alignment <= etl::alignment_of<T2>::value, Alignment, T2, T3, T4, T5, T6, T7, T8, void>::type type;
};
// Non-matching alignment, none left.
template <size_t Alignment>
class type_with_alignment_matcher <false, Alignment, void, void, void, void, void, void, void, void>
class type_with_alignment_matcher<false, Alignment, void, void, void, void, void, void, void, void>
{
public:
@ -183,16 +198,16 @@ namespace etl
//***************************************************************************
// Helper.
//***************************************************************************
template <size_t Alignment, typename T1, typename T2 = void, typename T3 = void, typename T4 = void,
typename T5 = void, typename T6 = void, typename T7 = void, typename T8 = void>
template <size_t Alignment, typename T1, typename T2 = void, typename T3 = void, typename T4 = void, typename T5 = void, typename T6 = void,
typename T7 = void, typename T8 = void>
class type_with_alignment_helper
{
public:
typedef typename type_with_alignment_matcher<Alignment <= etl::alignment_of<T1>::value, Alignment, T1, T2, T3, T4, T5, T6, T7, T8>::type type;
typedef typename type_with_alignment_matcher< Alignment <= etl::alignment_of<T1>::value, Alignment, T1, T2, T3, T4, T5, T6, T7, T8>::type type;
};
#endif
}
} // namespace private_alignment
//***************************************************************************
/// Gets a type that has the same as the specified alignment.
@ -204,12 +219,17 @@ namespace etl
public:
#if ETL_USING_CPP11
typedef struct { alignas(Alignment) char dummy; } type;
typedef struct
{
alignas(Alignment) char dummy;
} type;
#else
#if ETL_NOT_USING_64BIT_TYPES
typedef typename private_alignment::type_with_alignment_helper<Alignment, int_least8_t, int_least16_t, int32_t, float, double, void*>::type type;
typedef typename private_alignment::type_with_alignment_helper< Alignment, int_least8_t, int_least16_t, int32_t, float, double, void*>::type type;
#else
typedef typename private_alignment::type_with_alignment_helper<Alignment, int_least8_t, int_least16_t, int32_t, int64_t, float, double, void*>::type type;
typedef
typename private_alignment::type_with_alignment_helper< Alignment, int_least8_t, int_least16_t, int32_t, int64_t, float, double, void*>::type
type;
#endif
#endif
@ -231,42 +251,37 @@ namespace etl
{
struct type
{
//type()
// : data()
//{
//}
/// Convert to T reference.
template <typename T>
operator T& ()
operator T&()
{
ETL_STATIC_ASSERT((etl::is_same<T*, void*>:: value || ((Alignment % etl::alignment_of<T>::value) == 0)), "Incompatible alignment");
ETL_STATIC_ASSERT((etl::is_same<T*, void*>::value || ((Alignment % etl::alignment_of<T>::value) == 0)), "Incompatible alignment");
T* t = *this;
return *t;
}
/// Convert to const T reference.
template <typename T>
operator const T& () const
operator const T&() const
{
ETL_STATIC_ASSERT((etl::is_same<T*, void*>:: value || ((Alignment % etl::alignment_of<T>::value) == 0)), "Incompatible alignment");
ETL_STATIC_ASSERT((etl::is_same<T*, void*>::value || ((Alignment % etl::alignment_of<T>::value) == 0)), "Incompatible alignment");
const T* t = *this;
return *t;
}
/// Convert to T pointer.
template <typename T>
operator T* ()
operator T*()
{
ETL_STATIC_ASSERT((etl::is_same<T*, void*>:: value || ((Alignment % etl::alignment_of<T>::value) == 0)), "Incompatible alignment");
ETL_STATIC_ASSERT((etl::is_same<T*, void*>::value || ((Alignment % etl::alignment_of<T>::value) == 0)), "Incompatible alignment");
return reinterpret_cast<T*>(data);
}
/// Convert to const T pointer.
template <typename T>
operator const T* () const
operator const T*() const
{
ETL_STATIC_ASSERT((etl::is_same<T*, void*>:: value || ((Alignment % etl::alignment_of<T>::value) == 0)), "Incompatible alignment");
ETL_STATIC_ASSERT((etl::is_same<T*, void*>::value || ((Alignment % etl::alignment_of<T>::value) == 0)), "Incompatible alignment");
return reinterpret_cast<const T*>(data);
}
@ -274,7 +289,7 @@ namespace etl
template <typename T>
T& get_reference()
{
ETL_STATIC_ASSERT((etl::is_same<T*, void*>:: value || ((Alignment % etl::alignment_of<T>::value) == 0)), "Incompatible alignment");
ETL_STATIC_ASSERT((etl::is_same<T*, void*>::value || ((Alignment % etl::alignment_of<T>::value) == 0)), "Incompatible alignment");
T* t = *this;
return *t;
}
@ -283,7 +298,7 @@ namespace etl
template <typename T>
const T& get_reference() const
{
ETL_STATIC_ASSERT((etl::is_same<T*, void*>:: value || ((Alignment % etl::alignment_of<T>::value) == 0)), "Incompatible alignment");
ETL_STATIC_ASSERT((etl::is_same<T*, void*>::value || ((Alignment % etl::alignment_of<T>::value) == 0)), "Incompatible alignment");
const T* t = *this;
return *t;
}
@ -292,7 +307,7 @@ namespace etl
template <typename T>
T* get_address()
{
ETL_STATIC_ASSERT((etl::is_same<T*, void*>:: value || ((Alignment % etl::alignment_of<T>::value) == 0)), "Incompatible alignment");
ETL_STATIC_ASSERT((etl::is_same<T*, void*>::value || ((Alignment % etl::alignment_of<T>::value) == 0)), "Incompatible alignment");
return reinterpret_cast<T*>(data);
}
@ -300,7 +315,7 @@ namespace etl
template <typename T>
const T* get_address() const
{
ETL_STATIC_ASSERT((etl::is_same<T*, void*>:: value || ((Alignment % etl::alignment_of<T>::value) == 0)), "Incompatible alignment");
ETL_STATIC_ASSERT((etl::is_same<T*, void*>::value || ((Alignment % etl::alignment_of<T>::value) == 0)), "Incompatible alignment");
return reinterpret_cast<const T*>(data);
}
@ -309,8 +324,9 @@ namespace etl
#else
union
{
char data[Length];
typename etl::type_with_alignment<Alignment>::type etl_alignment_type; // A POD type that has the same alignment as Alignment.
char data[Length];
typename etl::type_with_alignment<Alignment>::type etl_alignment_type; // A POD type that has the same alignment
// as Alignment.
};
#endif
};
@ -334,6 +350,516 @@ namespace etl
template <size_t Length, typename T>
using aligned_storage_as_t = typename aligned_storage_as<Length, T>::type;
#endif
}
//***************************************************************************
/// Wrapper class that provides a memory area and lets the user create an
/// instance of T in this memory at runtime. This class also erases the
/// destructor call of T, i.e. if typed_storage goes out of scope, the
/// destructor if the wrapped type will not be called. This can be done
/// explicitly by calling destroy().
/// \tparam T Type of element stored in this instance of typed_storage.
//***************************************************************************
template <typename T>
class typed_storage
{
public:
typedef T value_type;
typedef T& reference;
typedef const T& const_reference;
typedef T* pointer;
typedef const T* const_pointer;
//***************************************************************************
// Default constructor
//***************************************************************************
ETL_CONSTEXPR typed_storage() ETL_NOEXCEPT
: valid(false)
{
}
#if ETL_USING_CPP11
//***************************************************************************
/// Constructs the instance of T forwarding the given \p args to its
/// constructor.
//***************************************************************************
template <typename... TArgs>
typed_storage(TArgs&&... args) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
: valid(false)
{
create(etl::forward<TArgs>(args)...);
}
#else
//***************************************************************************
/// Constructs the instance of T with type T1
//***************************************************************************
template <typename T1>
typed_storage(const T1& t1)
: valid(false)
{
create(t1);
}
//***************************************************************************
/// Constructs the instance of T with types T1, T2
//***************************************************************************
template <typename T1, typename T2>
typed_storage(const T1& t1, const T2& t2)
: valid(false)
{
create(t1, t2);
}
//***************************************************************************
/// Constructs the instance of T with types T1, T2, T3
//***************************************************************************
template <typename T1, typename T2, typename T3>
typed_storage(const T1& t1, const T2& t2, const T3& t3)
: valid(false)
{
create(t1, t2, t3);
}
//***************************************************************************
/// Constructs the instance of T with types T1, T2, T3, T4
//***************************************************************************
template <typename T1, typename T2, typename T3, typename T4>
typed_storage(const T1& t1, const T2& t2, const T3& t3, const T4& t4)
: valid(false)
{
create(t1, t2, t3, t4);
}
#endif
//***************************************************************************
/// Default destructor which will NOT call the destructor of the object
/// which was created by calling create().
//***************************************************************************
~typed_storage() ETL_NOEXCEPT
{
// Intentionally empty.
}
//***************************************************************************
/// \returns <b>true</b> if object has been constructed using create().
/// \returns <b>false</b> otherwise.
//***************************************************************************
bool has_value() const ETL_NOEXCEPT
{
return valid;
}
#if ETL_USING_CPP11
//***************************************************************************
/// Constructs the instance of T forwarding the given \p args to its
/// constructor. \returns the instance of T which has been constructed in
/// the internal byte array.
//***************************************************************************
template <typename... TArgs>
reference create(TArgs&&... args) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
ETL_ASSERT(!has_value(), ETL_ERROR(etl::typed_storage_error));
pointer p = ::new (&storage.value) value_type(etl::forward<TArgs>(args)...);
valid = true;
return *p;
}
#else
//***************************************************************************
/// Constructs the instance of T with type T1
/// \returns the instance of T which has been constructed in the internal
/// byte array.
//***************************************************************************
template <typename T1>
reference create(const T1& t1)
{
ETL_ASSERT(!has_value(), ETL_ERROR(etl::typed_storage_error));
pointer p = ::new (&storage.value) value_type(t1);
valid = true;
return *p;
}
//***************************************************************************
/// Constructs the instance of T with types T1, T2
/// \returns the instance of T which has been constructed in the internal
/// byte array.
//***************************************************************************
template <typename T1, typename T2>
reference create(const T1& t1, const T2& t2)
{
ETL_ASSERT(!has_value(), ETL_ERROR(etl::typed_storage_error));
pointer p = ::new (&storage.value) value_type(t1, t2);
valid = true;
return *p;
}
//***************************************************************************
/// Constructs the instance of T with types T1, T2, T3
/// \returns the instance of T which has been constructed in the internal
/// byte array.
//***************************************************************************
template <typename T1, typename T2, typename T3>
reference create(const T1& t1, const T2& t2, const T3& t3)
{
ETL_ASSERT(!has_value(), ETL_ERROR(etl::typed_storage_error));
pointer p = ::new (&storage.value) value_type(t1, t2, t3);
valid = true;
return *p;
}
//***************************************************************************
/// Constructs the instance of T with types T1, T2, T3, T4
/// \returns the instance of T which has been constructed in the internal
/// byte array.
//***************************************************************************
template <typename T1, typename T2, typename T3, typename T4>
reference create(const T1& t1, const T2& t2, const T3& t3, const T4& t4)
{
ETL_ASSERT(!has_value(), ETL_ERROR(etl::typed_storage_error));
pointer p = ::new (&storage.value) value_type(t1, t2, t3, t4);
valid = true;
return *p;
}
#endif
//***************************************************************************
/// Calls the destructor of the stored object, if created.
//***************************************************************************
void destroy() ETL_NOEXCEPT
{
if (has_value())
{
storage.value.~T();
valid = false;
}
}
//***************************************************************************
/// \returns a pointer of type T and asserts if has_value() is false.
//***************************************************************************
pointer operator->() ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
ETL_ASSERT(has_value(), ETL_ERROR(etl::typed_storage_error));
return &storage.value;
}
//***************************************************************************
/// \returns a const pointer of type T and asserts if has_value() is false.
//***************************************************************************
const_pointer operator->() const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
ETL_ASSERT(has_value(), ETL_ERROR(etl::typed_storage_error));
return &storage.value;
}
//***************************************************************************
/// \returns reference of type T and asserts if has_value() is false.
//***************************************************************************
reference operator*() ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
return *operator->();
}
//***************************************************************************
/// \returns const_reference of type T and asserts if has_value() is false.
//***************************************************************************
const_reference operator*() const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
return *operator->();
}
private:
typed_storage(etl::typed_storage<T>&) ETL_DELETE;
typed_storage& operator=(etl::typed_storage<T>&) ETL_DELETE;
struct dummy_t
{
};
//*******************************
union union_type
{
ETL_CONSTEXPR union_type() ETL_NOEXCEPT
: dummy()
{
}
~union_type() ETL_NOEXCEPT {}
dummy_t dummy;
value_type value;
} storage;
bool valid;
};
//***************************************************************************
/// Wrapper class wraps a supplied memory area and lets the user create an
/// instance of T in this memory at runtime. This class also erases the
/// destructor call of T, i.e. if typed_storage goes out of scope, the
/// destructor if the wrapped type will not be called. This can be done
/// explicitly by calling destroy().
/// \tparam T Type of element stored in this instance of typed_storage.
//***************************************************************************
template <typename T>
class typed_storage_ext
{
public:
typedef T value_type;
typedef T& reference;
typedef const T& const_reference;
typedef T* pointer;
typedef const T* const_pointer;
template <typename U>
friend ETL_CONSTEXPR14 void swap(typed_storage_ext<U>& lhs, typed_storage_ext<U>& rhs) ETL_NOEXCEPT;
//***************************************************************************
/// Constructor.
//***************************************************************************
typed_storage_ext(void* pbuffer_) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
: pbuffer(reinterpret_cast<T*>(pbuffer_))
, valid(false)
{
ETL_ASSERT(etl::is_aligned(pbuffer_, etl::alignment_of<T>::value), ETL_ERROR(etl::alignment_error));
}
#if ETL_USING_CPP11
//***************************************************************************
/// Constructs the instance of T forwarding the given \p args to its
/// constructor.
//***************************************************************************
template <typename... TArgs>
typed_storage_ext(void* pbuffer_, TArgs&&... args) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
: pbuffer(reinterpret_cast<T*>(pbuffer_))
, valid(false)
{
ETL_ASSERT(etl::is_aligned(pbuffer_, etl::alignment_of<T>::value), ETL_ERROR(etl::alignment_error));
create(etl::forward<TArgs>(args)...);
}
//***************************************************************************
/// Move constructor.
/// Transfers ownership of the buffer from \p other to this.
//***************************************************************************
typed_storage_ext(typed_storage_ext<T>&& other) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
: pbuffer(other.pbuffer)
, valid(other.valid)
{
other.pbuffer = ETL_NULLPTR;
other.valid = false;
}
#else
//***************************************************************************
/// Constructs the instance of T with type T1
//***************************************************************************
template <typename T1>
typed_storage_ext(void* pbuffer_, const T1& t1)
: pbuffer(reinterpret_cast<T*>(pbuffer_))
, valid(false)
{
ETL_ASSERT(etl::is_aligned(pbuffer_, etl::alignment_of<T>::value), ETL_ERROR(etl::alignment_error));
create(t1);
}
//***************************************************************************
/// Constructs the instance of T with types T1, T2
//***************************************************************************
template <typename T1, typename T2>
typed_storage_ext(void* pbuffer_, const T1& t1, const T2& t2)
: pbuffer(reinterpret_cast<T*>(pbuffer_))
, valid(false)
{
ETL_ASSERT(etl::is_aligned(pbuffer_, etl::alignment_of<T>::value), ETL_ERROR(etl::alignment_error));
create(t1, t2);
}
//***************************************************************************
/// Constructs the instance of T with types T1, T2, T3
//***************************************************************************
template <typename T1, typename T2, typename T3>
typed_storage_ext(void* pbuffer_, const T1& t1, const T2& t2, const T3& t3)
: pbuffer(reinterpret_cast<T*>(pbuffer_))
, valid(false)
{
ETL_ASSERT(etl::is_aligned(pbuffer_, etl::alignment_of<T>::value), ETL_ERROR(etl::alignment_error));
create(t1, t2, t3);
}
//***************************************************************************
/// Constructs the instance of T with types T1, T2, T3, T4
//***************************************************************************
template <typename T1, typename T2, typename T3, typename T4>
typed_storage_ext(void* pbuffer_, const T1& t1, const T2& t2, const T3& t3, const T4& t4)
: pbuffer(reinterpret_cast<T*>(pbuffer_))
, valid(false)
{
ETL_ASSERT(etl::is_aligned(pbuffer_, etl::alignment_of<T>::value), ETL_ERROR(etl::alignment_error));
create(t1, t2, t3, t4);
}
#endif
//***************************************************************************
/// Default destructor which will NOT call the destructor of the object
/// which was created by calling create().
//***************************************************************************
~typed_storage_ext() ETL_NOEXCEPT
{
// Intentionally empty.
}
//***************************************************************************
/// \returns <b>true</b> if object has been constructed using create().
/// \returns <b>false</b> otherwise.
//***************************************************************************
bool has_value() const ETL_NOEXCEPT
{
return valid;
}
#if ETL_USING_CPP11
//***************************************************************************
/// Constructs the instance of T forwarding the given \p args to its
/// constructor. \returns the instance of T which has been constructed in
/// the external buffer.
//***************************************************************************
template <typename... TArgs>
reference create(TArgs&&... args) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
ETL_ASSERT(!has_value(), ETL_ERROR(etl::typed_storage_error));
pointer p = ::new (pbuffer) value_type(etl::forward<TArgs>(args)...);
valid = true;
return *p;
}
#else
//***************************************************************************
/// Constructs the instance of T with type T1
/// \returns the instance of T which has been constructed in the external
/// buffer.
//***************************************************************************
template <typename T1>
reference create(const T1& t1)
{
ETL_ASSERT(!has_value(), ETL_ERROR(etl::typed_storage_error));
pointer p = ::new (pbuffer) value_type(t1);
valid = true;
return *p;
}
//***************************************************************************
/// Constructs the instance of T with types T1, T2
/// \returns the instance of T which has been constructed in the external
/// buffer.
//***************************************************************************
template <typename T1, typename T2>
reference create(const T1& t1, const T2& t2)
{
ETL_ASSERT(!has_value(), ETL_ERROR(etl::typed_storage_error));
pointer p = ::new (pbuffer) value_type(t1, t2);
valid = true;
return *p;
}
//***************************************************************************
/// Constructs the instance of T with types T1, T2, T3
/// \returns the instance of T which has been constructed in the external
/// buffer.
//***************************************************************************
template <typename T1, typename T2, typename T3>
reference create(const T1& t1, const T2& t2, const T3& t3)
{
ETL_ASSERT(!has_value(), ETL_ERROR(etl::typed_storage_error));
pointer p = ::new (pbuffer) value_type(t1, t2, t3);
valid = true;
return *p;
}
//***************************************************************************
/// Constructs the instance of T with types T1, T2, T3, T4
/// \returns the instance of T which has been constructed in the external
/// buffer.
//***************************************************************************
template <typename T1, typename T2, typename T3, typename T4>
reference create(const T1& t1, const T2& t2, const T3& t3, const T4& t4)
{
ETL_ASSERT(!has_value(), ETL_ERROR(etl::typed_storage_error));
pointer p = ::new (pbuffer) value_type(t1, t2, t3, t4);
valid = true;
return *p;
}
#endif
//***************************************************************************
/// Calls the destructor of the stored object, if created.
//***************************************************************************
void destroy() ETL_NOEXCEPT
{
if (has_value())
{
pbuffer->~T();
valid = false;
}
}
//***************************************************************************
/// \returns a pointer of type T and asserts if has_value() is false.
//***************************************************************************
pointer operator->() ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
ETL_ASSERT(has_value(), ETL_ERROR(etl::typed_storage_error));
return pbuffer;
}
//***************************************************************************
/// \returns a const pointer of type T and asserts if has_value() is false.
//***************************************************************************
const_pointer operator->() const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
ETL_ASSERT(has_value(), ETL_ERROR(etl::typed_storage_error));
return pbuffer;
}
//***************************************************************************
/// \returns reference of type T and asserts if has_value() is false.
//***************************************************************************
reference operator*() ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
return *operator->();
}
//***************************************************************************
/// \returns const_reference of type T and asserts if has_value() is false.
//***************************************************************************
const_reference operator*() const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
return *operator->();
}
private:
typed_storage_ext(etl::typed_storage_ext<T>&) ETL_DELETE;
typed_storage_ext& operator=(etl::typed_storage_ext<T>&) ETL_DELETE;
pointer pbuffer;
bool valid;
};
//***************************************************************************
/// Swap two etl::typed_storage_ext
//***************************************************************************
template <typename T>
ETL_CONSTEXPR14 void swap(etl::typed_storage_ext<T>& lhs, etl::typed_storage_ext<T>& rhs) ETL_NOEXCEPT
{
using ETL_OR_STD::swap;
swap(lhs.pbuffer, rhs.pbuffer);
swap(lhs.valid, rhs.valid);
}
} // namespace etl
#endif

File diff suppressed because it is too large Load Diff

View File

@ -32,18 +32,18 @@ SOFTWARE.
#define ETL_ARRAY_VIEW_INCLUDED
#include "platform.h"
#include "memory.h"
#include "algorithm.h"
#include "array.h"
#include "iterator.h"
#include "error_handler.h"
#include "exception.h"
#include "nullptr.h"
#include "hash.h"
#include "algorithm.h"
#include "iterator.h"
#include "memory.h"
#include "nullptr.h"
#include "type_traits.h"
#if ETL_USING_STL && ETL_USING_CPP11
#include <array>
#include <array>
#endif
///\defgroup array array
@ -93,6 +93,19 @@ namespace etl
}
};
//***************************************************************************
/// The exception thrown when the view is empty.
//***************************************************************************
class array_view_empty : public array_view_exception
{
public:
array_view_empty(string_type file_name_, numeric_type line_number_)
: array_view_exception(ETL_ERROR_TEXT("array_view:empty", ETL_ARRAY_VIEW_FILE_ID"C"), file_name_, line_number_)
{
}
};
//***************************************************************************
/// Array view.
//***************************************************************************
@ -101,31 +114,31 @@ namespace etl
{
public:
typedef T value_type;
typedef size_t size_type;
typedef const T& const_reference;
typedef const T* const_pointer;
typedef const T* const_iterator;
typedef T value_type;
typedef size_t size_type;
typedef const T& const_reference;
typedef const T* const_pointer;
typedef const T* const_iterator;
typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
#if defined(ETL_ARRAY_VIEW_IS_MUTABLE)
typedef T* pointer;
typedef T& reference;
typedef T* iterator;
typedef T* pointer;
typedef T& reference;
typedef T* iterator;
typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
#else
typedef const_pointer pointer;
typedef const_reference reference;
typedef const_pointer iterator;
typedef const_pointer pointer;
typedef const_reference reference;
typedef const_pointer iterator;
typedef const_reverse_iterator reverse_iterator;
#endif
//*************************************************************************
/// Default constructor.
//*************************************************************************
ETL_CONSTEXPR array_view()
: mbegin(ETL_NULLPTR),
mend(ETL_NULLPTR)
ETL_CONSTEXPR array_view() ETL_NOEXCEPT
: mbegin(ETL_NULLPTR)
, mend(ETL_NULLPTR)
{
}
@ -133,8 +146,9 @@ namespace etl
//*************************************************************************
/// Construct from etl::array.
//*************************************************************************
template <typename U, size_t N, typename = typename etl::enable_if<etl::is_same<etl::remove_cv_t<T>, etl::remove_cv_t<U>>::value, void>::type>
ETL_CONSTEXPR array_view(etl::array<U, N>& a) ETL_NOEXCEPT
template < typename U, size_t Size,
typename = typename etl::enable_if< etl::is_same<etl::remove_cv_t<T>, etl::remove_cv_t<U>>::value, void>::type>
ETL_CONSTEXPR array_view(etl::array<U, Size>& a) ETL_NOEXCEPT
: mbegin(a.data())
, mend(a.data() + a.size())
{
@ -143,8 +157,9 @@ namespace etl
//*************************************************************************
/// Construct from etl::array.
//*************************************************************************
template <typename U, size_t N, typename = typename etl::enable_if<etl::is_same<etl::remove_cv_t<T>, etl::remove_cv_t<U>>::value, void>::type>
ETL_CONSTEXPR array_view(const etl::array<U, N>& a) ETL_NOEXCEPT
template < typename U, size_t Size,
typename = typename etl::enable_if< etl::is_same<etl::remove_cv_t<T>, etl::remove_cv_t<U>>::value, void>::type>
ETL_CONSTEXPR array_view(const etl::array<U, Size>& a) ETL_NOEXCEPT
: mbegin(a.data())
, mend(a.data() + a.size())
{
@ -153,8 +168,10 @@ namespace etl
//*************************************************************************
/// Construct from etl::array.
//*************************************************************************
template <typename U, size_t N>
ETL_CONSTEXPR array_view(etl::array<U, N>& a, typename etl::enable_if<etl::is_same<typename etl::remove_cv<T>::type, typename etl::remove_cv<U>::type>::value, void>::type* = 0) ETL_NOEXCEPT
template <typename U, size_t Size>
ETL_CONSTEXPR array_view(
etl::array<U, Size>& a,
typename etl::enable_if< etl::is_same<typename etl::remove_cv<T>::type, typename etl::remove_cv<U>::type>::value, void>::type* = 0) ETL_NOEXCEPT
: mbegin(a.data())
, mend(a.data() + a.size())
{
@ -163,8 +180,10 @@ namespace etl
//*************************************************************************
/// Construct from etl::array.
//*************************************************************************
template <typename U, size_t N>
ETL_CONSTEXPR array_view(const etl::array<U, N>& a, typename etl::enable_if<etl::is_same<typename etl::remove_cv<T>::type, typename etl::remove_cv<U>::type>::value, void>::type* = 0) ETL_NOEXCEPT
template <typename U, size_t Size>
ETL_CONSTEXPR array_view(
const etl::array<U, Size>& a,
typename etl::enable_if< etl::is_same<typename etl::remove_cv<T>::type, typename etl::remove_cv<U>::type>::value, void>::type* = 0) ETL_NOEXCEPT
: mbegin(a.data())
, mend(a.data() + a.size())
{
@ -175,8 +194,9 @@ namespace etl
//*************************************************************************
/// Construct from std::array.
//*************************************************************************
template <typename U, size_t N, typename = typename etl::enable_if<etl::is_same<etl::remove_cv_t<T>, etl::remove_cv_t<U>>::value, void>::type>
ETL_CONSTEXPR array_view(std::array<U, N>& a) ETL_NOEXCEPT
template < typename U, size_t Size,
typename = typename etl::enable_if< etl::is_same<etl::remove_cv_t<T>, etl::remove_cv_t<U>>::value, void>::type>
ETL_CONSTEXPR array_view(std::array<U, Size>& a) ETL_NOEXCEPT
: mbegin(a.data())
, mend(a.data() + a.size())
{
@ -185,8 +205,9 @@ namespace etl
//*************************************************************************
/// Construct from std::array.
//*************************************************************************
template <typename U, size_t N, typename = typename etl::enable_if<etl::is_same<etl::remove_cv_t<T>, etl::remove_cv_t<U>>::value, void>::type>
ETL_CONSTEXPR array_view(const std::array<U, N>& a) ETL_NOEXCEPT
template < typename U, size_t Size,
typename = typename etl::enable_if< etl::is_same<etl::remove_cv_t<T>, etl::remove_cv_t<U>>::value, void>::type>
ETL_CONSTEXPR array_view(const std::array<U, Size>& a) ETL_NOEXCEPT
: mbegin(a.data())
, mend(a.data() + a.size())
{
@ -198,10 +219,12 @@ namespace etl
/// Construct from a container or other type that supports
/// data() and size() member functions.
//*************************************************************************
template <typename TContainer, typename = typename etl::enable_if<!etl::is_pointer<etl::remove_reference_t<TContainer>>::value &&
!etl::is_array<etl::remove_reference_t<TContainer>>::value &&
etl::is_same<etl::remove_cv_t<T>, etl::remove_cv_t<typename etl::remove_reference_t<TContainer>::value_type>>::value, void>::type>
ETL_CONSTEXPR array_view(TContainer&& a) ETL_NOEXCEPT
template < typename TContainer,
typename = typename etl::enable_if<
!etl::is_pointer<etl::remove_reference_t<TContainer>>::value && !etl::is_array<etl::remove_reference_t<TContainer>>::value
&& etl::is_same<etl::remove_cv_t<T>, etl::remove_cv_t<typename etl::remove_reference_t< TContainer>::value_type>>::value,
void>::type>
ETL_CONSTEXPR array_view(TContainer&& a) ETL_NOEXCEPT
: mbegin(a.data())
, mend(a.data() + a.size())
{
@ -212,9 +235,12 @@ namespace etl
/// data() and size() member functions.
//*************************************************************************
template <typename TContainer>
ETL_CONSTEXPR array_view(TContainer& a, typename etl::enable_if<!etl::is_pointer<typename etl::remove_reference<TContainer>::type>::value &&
!etl::is_array<TContainer>::value &&
etl::is_same<typename etl::remove_cv<T>::type, typename etl::remove_cv<typename etl::remove_reference<TContainer>::type::value_type>::type>::value, void>::type* = 0) ETL_NOEXCEPT
ETL_CONSTEXPR array_view(TContainer& a,
typename etl::enable_if<
!etl::is_pointer< typename etl::remove_reference<TContainer>::type>::value && !etl::is_array<TContainer>::value
&& etl::is_same< typename etl::remove_cv<T>::type,
typename etl::remove_cv<typename etl::remove_reference< TContainer>::type::value_type>::type>::value,
void>::type* = 0) ETL_NOEXCEPT
: mbegin(a.data())
, mend(a.data() + a.size())
{
@ -225,9 +251,12 @@ namespace etl
/// data() and size() member functions.
//*************************************************************************
template <typename TContainer>
ETL_CONSTEXPR array_view(const TContainer& a, typename etl::enable_if<!etl::is_pointer<typename etl::remove_reference<TContainer>::type>::value &&
!etl::is_array<TContainer>::value &&
etl::is_same<typename etl::remove_cv<T>::type, typename etl::remove_cv<typename etl::remove_reference<TContainer>::type::value_type>::type>::value, void>::type* = 0) ETL_NOEXCEPT
ETL_CONSTEXPR array_view(const TContainer& a,
typename etl::enable_if<
!etl::is_pointer< typename etl::remove_reference<TContainer>::type>::value && !etl::is_array<TContainer>::value
&& etl::is_same< typename etl::remove_cv<T>::type,
typename etl::remove_cv<typename etl::remove_reference< TContainer>::type::value_type>::type>::value,
void>::type* = 0) ETL_NOEXCEPT
: mbegin(a.data())
, mend(a.data() + a.size())
{
@ -238,78 +267,89 @@ namespace etl
/// Construct from iterators
//*************************************************************************
template <typename TIterator>
ETL_CONSTEXPR array_view(const TIterator begin_, const TIterator end_)
: mbegin(etl::addressof(*begin_)),
mend(etl::addressof(*begin_) + etl::distance(begin_, end_))
ETL_CONSTEXPR array_view(const TIterator begin_, const TIterator end_) ETL_NOEXCEPT
: mbegin(etl::to_address(begin_))
, mend(etl::to_address(begin_) + etl::distance(begin_, end_))
{
}
//*************************************************************************
/// Construct from iterator and size
//*************************************************************************
template <typename TIterator, typename TSize>
ETL_CONSTEXPR array_view(const TIterator begin_, const TSize size_) ETL_NOEXCEPT
: mbegin(etl::to_address(begin_))
, mend(etl::to_address(begin_) + size_)
{
}
//*************************************************************************
/// Construct from C array
//*************************************************************************
template <typename TIterator,
typename TSize>
ETL_CONSTEXPR array_view(const TIterator begin_, const TSize size_)
: mbegin(etl::addressof(*begin_)),
mend(etl::addressof(*begin_) + size_)
{
}
//*************************************************************************
/// Construct from C array
//*************************************************************************
template<size_t Array_Size>
ETL_CONSTEXPR array_view(T(&begin_)[Array_Size])
: mbegin(begin_),
mend(begin_ + Array_Size)
template <size_t Array_Size>
ETL_CONSTEXPR array_view(T (&begin_)[Array_Size]) ETL_NOEXCEPT
: mbegin(begin_)
, mend(begin_ + Array_Size)
{
}
//*************************************************************************
/// Copy constructor
//*************************************************************************
ETL_CONSTEXPR array_view(const array_view& other)
: mbegin(other.mbegin),
mend(other.mend)
ETL_CONSTEXPR array_view(const array_view& other) ETL_NOEXCEPT
: mbegin(other.mbegin)
, mend(other.mend)
{
}
//*************************************************************************
/// Returns a reference to the first element.
/// If asserts or exceptions are enabled, throws an etl::array_view_empty if
/// the view is empty.
//*************************************************************************
reference front()
{
ETL_ASSERT_CHECK_EXTRA(!empty(), ETL_ERROR(array_view_empty));
return *mbegin;
}
//*************************************************************************
/// Returns a const reference to the first element.
/// If asserts or exceptions are enabled, throws an etl::array_view_empty if
/// the view is empty.
//*************************************************************************
const_reference front() const
{
ETL_ASSERT_CHECK_EXTRA(!empty(), ETL_ERROR(array_view_empty));
return *mbegin;
}
//*************************************************************************
/// Returns a reference to the last element.
/// If asserts or exceptions are enabled, throws an etl::array_view_empty if
/// the view is empty.
//*************************************************************************
reference back()
{
ETL_ASSERT_CHECK_EXTRA(!empty(), ETL_ERROR(array_view_empty));
return *(mend - 1);
}
//*************************************************************************
/// Returns a const reference to the last element.
/// If asserts or exceptions are enabled, throws an etl::array_view_empty if
/// the view is empty.
//*************************************************************************
const_reference back() const
{
ETL_ASSERT_CHECK_EXTRA(!empty(), ETL_ERROR(array_view_empty));
return *(mend - 1);
}
//*************************************************************************
/// Returns a pointer to the first element of the internal storage.
//*************************************************************************
pointer data()
pointer data() ETL_NOEXCEPT
{
return mbegin;
}
@ -317,7 +357,7 @@ namespace etl
//*************************************************************************
/// Returns a const pointer to the first element of the internal storage.
//*************************************************************************
const_pointer data() const
const_pointer data() const ETL_NOEXCEPT
{
return mbegin;
}
@ -325,7 +365,7 @@ namespace etl
//*************************************************************************
/// Returns an iterator to the beginning of the array.
//*************************************************************************
iterator begin()
iterator begin() ETL_NOEXCEPT
{
return mbegin;
}
@ -333,7 +373,7 @@ namespace etl
//*************************************************************************
/// Returns a const iterator to the beginning of the array.
//*************************************************************************
const_iterator begin() const
const_iterator begin() const ETL_NOEXCEPT
{
return mbegin;
}
@ -341,7 +381,7 @@ namespace etl
//*************************************************************************
/// Returns a const iterator to the beginning of the array.
//*************************************************************************
const_iterator cbegin() const
const_iterator cbegin() const ETL_NOEXCEPT
{
return mbegin;
}
@ -349,7 +389,7 @@ namespace etl
//*************************************************************************
/// Returns an iterator to the end of the array.
//*************************************************************************
iterator end()
iterator end() ETL_NOEXCEPT
{
return mend;
}
@ -357,7 +397,7 @@ namespace etl
//*************************************************************************
/// Returns a const iterator to the end of the array.
//*************************************************************************
const_iterator end() const
const_iterator end() const ETL_NOEXCEPT
{
return mend;
}
@ -365,7 +405,7 @@ namespace etl
//*************************************************************************
// Returns a const iterator to the end of the array.
//*************************************************************************
const_iterator cend() const
const_iterator cend() const ETL_NOEXCEPT
{
return mend;
}
@ -373,7 +413,7 @@ namespace etl
//*************************************************************************
// Returns an reverse iterator to the reverse beginning of the array.
//*************************************************************************
reverse_iterator rbegin()
reverse_iterator rbegin() ETL_NOEXCEPT
{
return reverse_iterator(mend);
}
@ -381,7 +421,7 @@ namespace etl
//*************************************************************************
/// Returns a const reverse iterator to the reverse beginning of the array.
//*************************************************************************
const_reverse_iterator rbegin() const
const_reverse_iterator rbegin() const ETL_NOEXCEPT
{
return const_reverse_iterator(mend);
}
@ -389,7 +429,7 @@ namespace etl
//*************************************************************************
/// Returns a const reverse iterator to the reverse beginning of the array.
//*************************************************************************
const_reverse_iterator crbegin() const
const_reverse_iterator crbegin() const ETL_NOEXCEPT
{
return const_reverse_iterator(mend);
}
@ -397,7 +437,7 @@ namespace etl
//*************************************************************************
/// Returns a reverse iterator to the end of the array.
//*************************************************************************
reverse_iterator rend()
reverse_iterator rend() ETL_NOEXCEPT
{
return reverse_iterator(mbegin);
}
@ -405,7 +445,7 @@ namespace etl
//*************************************************************************
/// Returns a const reverse iterator to the end of the array.
//*************************************************************************
const_reverse_iterator rend() const
const_reverse_iterator rend() const ETL_NOEXCEPT
{
return const_reverse_iterator(mbegin);
}
@ -413,7 +453,7 @@ namespace etl
//*************************************************************************
/// Returns a const reverse iterator to the end of the array.
//*************************************************************************
const_reverse_iterator crend() const
const_reverse_iterator crend() const ETL_NOEXCEPT
{
return const_reverse_iterator(mbegin);
}
@ -421,7 +461,7 @@ namespace etl
//*************************************************************************
/// Returns <b>true</b> if the array size is zero.
//*************************************************************************
ETL_CONSTEXPR bool empty() const
ETL_CONSTEXPR bool empty() const ETL_NOEXCEPT
{
return (mbegin == mend);
}
@ -429,7 +469,7 @@ namespace etl
//*************************************************************************
/// Returns the size of the array.
//*************************************************************************
ETL_CONSTEXPR size_t size() const
ETL_CONSTEXPR size_t size() const ETL_NOEXCEPT
{
return static_cast<size_t>(mend - mbegin);
}
@ -437,7 +477,7 @@ namespace etl
//*************************************************************************
/// Returns the maximum possible size of the array.
//*************************************************************************
ETL_CONSTEXPR size_t max_size() const
ETL_CONSTEXPR size_t max_size() const ETL_NOEXCEPT
{
return size();
}
@ -445,7 +485,7 @@ namespace etl
//*************************************************************************
/// Assign from a view.
//*************************************************************************
array_view& operator=(const array_view& other)
array_view& operator=(const array_view& other) ETL_NOEXCEPT
{
mbegin = other.mbegin;
mend = other.mend;
@ -458,36 +498,43 @@ namespace etl
template <typename TIterator>
void assign(const TIterator begin_, const TIterator end_)
{
mbegin = etl::addressof(*begin_);
mend = etl::addressof(*begin_) + etl::distance(begin_, end_);
mbegin = etl::to_address(begin_);
mend = etl::to_address(begin_) + etl::distance(begin_, end_);
}
//*************************************************************************
/// Assign from iterator and size.
//*************************************************************************
template <typename TIterator,
typename TSize>
template <typename TIterator, typename TSize>
void assign(const TIterator begin_, const TSize size_)
{
mbegin = etl::addressof(*begin_);
mend = etl::addressof(*begin_) + size_;
mbegin = etl::to_address(begin_);
mend = etl::to_address(begin_) + size_;
}
#if defined(ETL_ARRAY_VIEW_IS_MUTABLE)
//*************************************************************************
/// Returns a reference to the indexed value.
/// If asserts or exceptions are enabled, throws an etl::array_view_bounds
/// if the index is out of bounds.
//*************************************************************************
reference operator[](const size_t i)
reference operator[](const size_t i) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS || ETL_NOT_CHECKING_INDEX_OPERATOR)
{
ETL_ASSERT_CHECK_INDEX_OPERATOR(i < size(), ETL_ERROR(array_view_bounds));
return mbegin[i];
}
#endif
//*************************************************************************
/// Returns a const reference to the indexed value.
/// If asserts or exceptions are enabled, throws an etl::array_view_bounds
/// if the index is out of bounds.
//*************************************************************************
const_reference operator[](const size_t i) const
const_reference operator[](const size_t i) const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS || ETL_NOT_CHECKING_INDEX_OPERATOR)
{
ETL_ASSERT_CHECK_INDEX_OPERATOR(i < size(), ETL_ERROR(array_view_bounds));
return mbegin[i];
}
@ -516,7 +563,7 @@ namespace etl
//*************************************************************************
/// Swaps with another array_view.
//*************************************************************************
void swap(array_view& other)
void swap(array_view& other) ETL_NOEXCEPT
{
using ETL_OR_STD::swap; // Allow ADL
@ -527,23 +574,23 @@ namespace etl
//*************************************************************************
/// Shrinks the view by moving its start forward.
//*************************************************************************
void remove_prefix(const size_type n)
void remove_prefix(const size_type n) ETL_NOEXCEPT
{
if (n < size())
mbegin += n;
else
mbegin = mend;
if (n < size())
mbegin += n;
else
mbegin = mend;
}
//*************************************************************************
/// Shrinks the view by moving its end backward.
//*************************************************************************
void remove_suffix(const size_type n)
void remove_suffix(const size_type n) ETL_NOEXCEPT
{
if (n < size())
mend -= n;
else
mend = mbegin;
if (n < size())
mend -= n;
else
mend = mbegin;
}
//*************************************************************************
@ -557,16 +604,15 @@ namespace etl
//*************************************************************************
/// Equality for array views.
//*************************************************************************
friend bool operator == (const array_view<T>& lhs, const array_view<T>& rhs)
friend bool operator==(const array_view<T>& lhs, const array_view<T>& rhs)
{
return (lhs.size() == rhs.size()) &&
etl::equal(lhs.begin(), lhs.end(), rhs.begin());
return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//*************************************************************************
/// Inequality for array views.
//*************************************************************************
friend bool operator != (const array_view<T>& lhs, const array_view<T>& rhs)
friend bool operator!=(const array_view<T>& lhs, const array_view<T>& rhs)
{
return !(lhs == rhs);
}
@ -574,7 +620,7 @@ namespace etl
//*************************************************************************
/// Less-than for array views.
//*************************************************************************
friend bool operator < (const array_view<T>& lhs, const array_view<T>& rhs)
friend bool operator<(const array_view<T>& lhs, const array_view<T>& rhs)
{
return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
}
@ -582,7 +628,7 @@ namespace etl
//*************************************************************************
/// Greater-than for array views.
//*************************************************************************
friend bool operator > (const array_view<T>& lhs, const array_view<T>& rhs)
friend bool operator>(const array_view<T>& lhs, const array_view<T>& rhs)
{
return rhs < lhs;
}
@ -590,7 +636,7 @@ namespace etl
//*************************************************************************
/// Less-than-equal for array views.
//*************************************************************************
friend bool operator <= (const array_view<T>& lhs, const array_view<T>& rhs)
friend bool operator<=(const array_view<T>& lhs, const array_view<T>& rhs)
{
return !(lhs > rhs);
}
@ -598,7 +644,7 @@ namespace etl
//*************************************************************************
/// Greater-than-equal for array views.
//*************************************************************************
friend bool operator >= (const array_view<T>& lhs, const array_view<T>& rhs)
friend bool operator>=(const array_view<T>& lhs, const array_view<T>& rhs)
{
return !(lhs < rhs);
}
@ -614,18 +660,14 @@ namespace etl
//*************************************************************************
#if ETL_USING_CPP17
template <typename TArray>
array_view(TArray& a)
-> array_view<typename TArray::value_type>;
array_view(TArray& a) -> array_view<typename TArray::value_type>;
template <typename TIterator>
array_view(const TIterator begin_, const TIterator end_)
-> array_view<etl::remove_pointer_t<TIterator>>;
array_view(const TIterator begin_, const TIterator end_) -> array_view<etl::remove_pointer_t<TIterator>>;
template <typename TIterator,
typename TSize>
array_view(const TIterator begin_, const TSize size_)
-> array_view<etl::remove_pointer_t<TIterator>>;
#endif
template <typename TIterator, typename TSize>
array_view(const TIterator begin_, const TSize size_) -> array_view<etl::remove_pointer_t<TIterator>>;
#endif
//*************************************************************************
/// Hash function.
@ -641,13 +683,13 @@ namespace etl
}
};
#endif
}
} // namespace etl
//*************************************************************************
/// Swaps the values.
//*************************************************************************
template <typename T>
void swap(etl::array_view<T>& lhs, etl::array_view<T>& rhs)
void swap(etl::array_view<T>& lhs, etl::array_view<T>& rhs) ETL_NOEXCEPT
{
lhs.swap(rhs);
}

View File

@ -32,12 +32,12 @@ SOFTWARE.
#define ETL_ARRAY_WRAPPER_INCLUDED
#include "platform.h"
#include "iterator.h"
#include "algorithm.h"
#include "error_handler.h"
#include "exception.h"
#include "hash.h"
#include "iterator.h"
#include "parameter_type.h"
#include "algorithm.h"
///\defgroup array array
/// A wrapper for arrays
@ -75,19 +75,19 @@ namespace etl
//***************************************************************************
/// Array wrapper.
//***************************************************************************
template <typename T, size_t SIZE_, T(&ARRAY_)[SIZE_]>
template <typename T, size_t SIZE_, T (&ARRAY_)[SIZE_]>
class array_wrapper
{
public:
typedef T value_type;
typedef size_t size_type;
typedef T& reference;
typedef const T& const_reference;
typedef T* pointer;
typedef const T* const_pointer;
typedef T* iterator;
typedef const T* const_iterator;
typedef T value_type;
typedef size_t size_type;
typedef T& reference;
typedef const T& const_reference;
typedef T* pointer;
typedef const T* const_pointer;
typedef T* iterator;
typedef const T* const_iterator;
typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
@ -141,7 +141,7 @@ namespace etl
//*************************************************************************
/// Returns a pointer to the first element of the internal storage.
//*************************************************************************
pointer data()
pointer data() ETL_NOEXCEPT
{
return &ARRAY_[BEGIN];
}
@ -149,7 +149,7 @@ namespace etl
//*************************************************************************
/// Returns a const pointer to the first element of the internal storage.
//*************************************************************************
ETL_CONSTEXPR const_pointer data() const
ETL_CONSTEXPR const_pointer data() const ETL_NOEXCEPT
{
return &ARRAY_[BEGIN];
}
@ -157,7 +157,7 @@ namespace etl
//*************************************************************************
/// Returns an iterator to the beginning of the array.
//*************************************************************************
iterator begin()
iterator begin() ETL_NOEXCEPT
{
return &ARRAY_[BEGIN];
}
@ -165,7 +165,7 @@ namespace etl
//*************************************************************************
/// Returns a const iterator to the beginning of the array.
//*************************************************************************
ETL_CONSTEXPR const_iterator begin() const
ETL_CONSTEXPR const_iterator begin() const ETL_NOEXCEPT
{
return &ARRAY_[BEGIN];
}
@ -173,7 +173,7 @@ namespace etl
//*************************************************************************
/// Returns a const iterator to the beginning of the array.
//*************************************************************************
ETL_CONSTEXPR const_iterator cbegin() const
ETL_CONSTEXPR const_iterator cbegin() const ETL_NOEXCEPT
{
return &ARRAY_[BEGIN];
}
@ -181,7 +181,7 @@ namespace etl
//*************************************************************************
/// Returns an iterator to the end of the array.
//*************************************************************************
iterator end()
iterator end() ETL_NOEXCEPT
{
return &ARRAY_[END];
}
@ -189,7 +189,7 @@ namespace etl
//*************************************************************************
/// Returns a const iterator to the end of the array.
//*************************************************************************
ETL_CONSTEXPR const_iterator end() const
ETL_CONSTEXPR const_iterator end() const ETL_NOEXCEPT
{
return &ARRAY_[END];
}
@ -197,7 +197,7 @@ namespace etl
//*************************************************************************
// Returns a const iterator to the end of the array.
//*************************************************************************
ETL_CONSTEXPR const_iterator cend() const
ETL_CONSTEXPR const_iterator cend() const ETL_NOEXCEPT
{
return &ARRAY_[END];
}
@ -205,7 +205,7 @@ namespace etl
//*************************************************************************
// Returns an reverse iterator to the reverse beginning of the array.
//*************************************************************************
reverse_iterator rbegin()
reverse_iterator rbegin() ETL_NOEXCEPT
{
return reverse_iterator(&ARRAY_[END]);
}
@ -213,7 +213,7 @@ namespace etl
//*************************************************************************
/// Returns a const reverse iterator to the reverse beginning of the array.
//*************************************************************************
ETL_CONSTEXPR const_reverse_iterator rbegin() const
ETL_CONSTEXPR const_reverse_iterator rbegin() const ETL_NOEXCEPT
{
return const_reverse_iterator(&ARRAY_[END]);
}
@ -221,7 +221,7 @@ namespace etl
//*************************************************************************
/// Returns a const reverse iterator to the reverse beginning of the array.
//*************************************************************************
ETL_CONSTEXPR const_reverse_iterator crbegin() const
ETL_CONSTEXPR const_reverse_iterator crbegin() const ETL_NOEXCEPT
{
return const_reverse_iterator(&ARRAY_[END]);
}
@ -229,7 +229,7 @@ namespace etl
//*************************************************************************
/// Returns a reverse iterator to the end of the array.
//*************************************************************************
reverse_iterator rend()
reverse_iterator rend() ETL_NOEXCEPT
{
return reverse_iterator(&ARRAY_[BEGIN]);
}
@ -237,7 +237,7 @@ namespace etl
//*************************************************************************
/// Returns a const reverse iterator to the end of the array.
//*************************************************************************
ETL_CONSTEXPR const_reverse_iterator rend() const
ETL_CONSTEXPR const_reverse_iterator rend() const ETL_NOEXCEPT
{
return const_reverse_iterator(&ARRAY_[BEGIN]);
}
@ -245,7 +245,7 @@ namespace etl
//*************************************************************************
/// Returns a const reverse iterator to the end of the array.
//*************************************************************************
ETL_CONSTEXPR const_reverse_iterator crend() const
ETL_CONSTEXPR const_reverse_iterator crend() const ETL_NOEXCEPT
{
return const_reverse_iterator(&ARRAY_[BEGIN]);
}
@ -253,7 +253,7 @@ namespace etl
//*************************************************************************
/// Returns the size of the array.
//*************************************************************************
ETL_CONSTEXPR size_t size() const
ETL_CONSTEXPR size_t size() const ETL_NOEXCEPT
{
return SIZE;
}
@ -261,25 +261,36 @@ namespace etl
//*************************************************************************
/// Returns the maximum possible size of the array.
//*************************************************************************
ETL_CONSTEXPR size_t max_size() const
ETL_CONSTEXPR size_t max_size() const ETL_NOEXCEPT
{
return MAX_SIZE;
}
//*************************************************************************
/// Returns a reference to the indexed value.
/// If asserts or exceptions are enabled, throws an
/// etl::array_wrapper_bounds if the index is out of bounds.
//*************************************************************************
reference operator[](size_t i)
reference operator[](size_t i) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS || ETL_NOT_CHECKING_INDEX_OPERATOR)
{
ETL_ASSERT_CHECK_INDEX_OPERATOR(i < SIZE, ETL_ERROR(etl::array_wrapper_bounds));
return ARRAY_[i];
}
//*************************************************************************
/// Returns a const reference to the indexed value.
/// If asserts or exceptions are enabled, throws an
/// etl::array_wrapper_bounds if the index is out of bounds.
//*************************************************************************
ETL_CONSTEXPR const_reference operator[](size_t i) const
ETL_CONSTEXPR const_reference operator[](size_t i) const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS || ETL_NOT_CHECKING_INDEX_OPERATOR)
{
// Throwing from c++11 constexpr requires special syntax
#if ETL_USING_CPP11 && ETL_NOT_USING_CPP14 && ETL_USING_EXCEPTIONS && ETL_CHECKING_INDEX_OPERATOR
return i < SIZE ? ARRAY_[i] : throw(ETL_ERROR(etl::array_wrapper_bounds));
#else
ETL_ASSERT_CHECK_INDEX_OPERATOR(i < SIZE, ETL_ERROR(etl::array_wrapper_bounds));
return ARRAY_[i];
#endif
}
//*************************************************************************
@ -311,9 +322,8 @@ namespace etl
//*************************************************************************
/// Swaps the contents of arrays.
//*************************************************************************
template <typename U, U(&ARRAYOTHER)[SIZE_]>
typename etl::enable_if<etl::is_same<T, U>::value, void>::type
swap(etl::array_wrapper<U, SIZE_, ARRAYOTHER>& other)
template <typename U, U (&ARRAYOTHER)[SIZE_]>
typename etl::enable_if<etl::is_same<T, U>::value, void>::type swap(etl::array_wrapper<U, SIZE_, ARRAYOTHER>& other)
{
using ETL_OR_STD::swap; // Allow ADL
@ -327,9 +337,8 @@ namespace etl
//*************************************************************************
/// Equality for array wrappers.
//*************************************************************************
template <typename TL, typename TR, size_t SIZEL, size_t SIZER, TL(&ARRAYL)[SIZEL], TR(&ARRAYR)[SIZER]>
bool operator == (const etl::array_wrapper<TL, SIZEL, ARRAYL>& lhs,
const etl::array_wrapper<TR, SIZER, ARRAYR>& rhs)
template <typename TL, typename TR, size_t SIZEL, size_t SIZER, TL (&ARRAYL)[SIZEL], TR (&ARRAYR)[SIZER]>
bool operator==(const etl::array_wrapper<TL, SIZEL, ARRAYL>& lhs, const etl::array_wrapper<TR, SIZER, ARRAYR>& rhs)
{
return (SIZEL == SIZER) && etl::equal(lhs.begin(), lhs.end(), rhs.begin());
}
@ -337,9 +346,8 @@ namespace etl
//*************************************************************************
/// Inequality for array wrapper.
//*************************************************************************
template <typename TL, typename TR, size_t SIZEL, size_t SIZER, TL(&ARRAYL)[SIZEL], TR(&ARRAYR)[SIZER]>
bool operator != (const etl::array_wrapper<TL, SIZEL, ARRAYL>& lhs,
const etl::array_wrapper<TR, SIZER, ARRAYR>& rhs)
template <typename TL, typename TR, size_t SIZEL, size_t SIZER, TL (&ARRAYL)[SIZEL], TR (&ARRAYR)[SIZER]>
bool operator!=(const etl::array_wrapper<TL, SIZEL, ARRAYL>& lhs, const etl::array_wrapper<TR, SIZER, ARRAYR>& rhs)
{
return !(lhs == rhs);
}
@ -347,9 +355,8 @@ namespace etl
//*************************************************************************
/// Less-than for array wrapper.
//*************************************************************************
template <typename TL, typename TR, size_t SIZEL, size_t SIZER, TL(&ARRAYL)[SIZEL], TR(&ARRAYR)[SIZER]>
bool operator < (const etl::array_wrapper<TL, SIZEL, ARRAYL>& lhs,
const etl::array_wrapper<TR, SIZER, ARRAYR>& rhs)
template <typename TL, typename TR, size_t SIZEL, size_t SIZER, TL (&ARRAYL)[SIZEL], TR (&ARRAYR)[SIZER]>
bool operator<(const etl::array_wrapper<TL, SIZEL, ARRAYL>& lhs, const etl::array_wrapper<TR, SIZER, ARRAYR>& rhs)
{
return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
}
@ -357,9 +364,8 @@ namespace etl
//*************************************************************************
/// Greater-than for array wrapper.
//*************************************************************************
template <typename TL, typename TR, size_t SIZEL, size_t SIZER, TL(&ARRAYL)[SIZEL], TR(&ARRAYR)[SIZER]>
bool operator > (const etl::array_wrapper<TL, SIZEL, ARRAYL>& lhs,
const etl::array_wrapper<TR, SIZER, ARRAYR>& rhs)
template <typename TL, typename TR, size_t SIZEL, size_t SIZER, TL (&ARRAYL)[SIZEL], TR (&ARRAYR)[SIZER]>
bool operator>(const etl::array_wrapper<TL, SIZEL, ARRAYL>& lhs, const etl::array_wrapper<TR, SIZER, ARRAYR>& rhs)
{
return rhs < lhs;
}
@ -367,9 +373,8 @@ namespace etl
//*************************************************************************
/// Less-than-equal for array wrapper.
//*************************************************************************
template <typename TL, typename TR, size_t SIZEL, size_t SIZER, TL(&ARRAYL)[SIZEL], TR(&ARRAYR)[SIZER]>
bool operator <= (const etl::array_wrapper<TL, SIZEL, ARRAYL>& lhs,
const etl::array_wrapper<TR, SIZER, ARRAYR>& rhs)
template <typename TL, typename TR, size_t SIZEL, size_t SIZER, TL (&ARRAYL)[SIZEL], TR (&ARRAYR)[SIZER]>
bool operator<=(const etl::array_wrapper<TL, SIZEL, ARRAYL>& lhs, const etl::array_wrapper<TR, SIZER, ARRAYR>& rhs)
{
return !(lhs > rhs);
}
@ -377,9 +382,8 @@ namespace etl
//*************************************************************************
/// Greater-than-equal for array wrapper.
//*************************************************************************
template <typename TL, typename TR, size_t SIZEL, size_t SIZER, TL(&ARRAYL)[SIZEL], TR(&ARRAYR)[SIZER]>
bool operator >= (const etl::array_wrapper<TL, SIZEL, ARRAYL>& lhs,
const etl::array_wrapper<TR, SIZER, ARRAYR>& rhs)
template <typename TL, typename TR, size_t SIZEL, size_t SIZER, TL (&ARRAYL)[SIZEL], TR (&ARRAYR)[SIZER]>
bool operator>=(const etl::array_wrapper<TL, SIZEL, ARRAYL>& lhs, const etl::array_wrapper<TR, SIZER, ARRAYR>& rhs)
{
return !(lhs < rhs);
}
@ -388,7 +392,7 @@ namespace etl
/// Hash function.
//*************************************************************************
#if ETL_USING_8BIT_TYPES
template <typename T, size_t SIZE, T(&ARRAY)[SIZE]>
template <typename T, size_t SIZE, T (&ARRAY)[SIZE]>
struct hash<etl::array_wrapper<T, SIZE, ARRAY> >
{
size_t operator()(const etl::array_wrapper<T, SIZE, ARRAY>& aw) const
@ -400,19 +404,17 @@ namespace etl
}
};
#endif
}
} // namespace etl
//*************************************************************************
/// Swap.
//*************************************************************************
template <typename T, size_t SIZE, T(&ARRAYL)[SIZE], T(&ARRAYR)[SIZE]>
void swap(etl::array_wrapper<T, SIZE, ARRAYL>& lhs,
etl::array_wrapper<T, SIZE, ARRAYR>& rhs)
template <typename T, size_t SIZE, T (&ARRAYL)[SIZE], T (&ARRAYR)[SIZE]>
void swap(etl::array_wrapper<T, SIZE, ARRAYL>& lhs, etl::array_wrapper<T, SIZE, ARRAYR>& rhs)
{
lhs.swap(rhs);
}
#define ETL_ARRAY_WRAPPER(arraytype, arrayobject) etl::array_wrapper<arraytype, ETL_ARRAY_SIZE(arrayobject), arrayobject>
#define ETL_ARRAY_WRAPPER(arraytype, arrayobject) etl::array_wrapper<arraytype, ETL_ARRAY_SIZE(arrayobject), arrayobject>
#endif

View File

@ -32,7 +32,7 @@ SOFTWARE.
#include "platform.h"
#if ETL_HAS_ATOMIC
#if (ETL_USING_CPP11 && (ETL_USING_STL || defined(ETL_IN_UNIT_TEST)))
#if (ETL_USING_CPP11 && (ETL_USING_STL || defined(ETL_IN_UNIT_TEST)))
#include "atomic/atomic_std.h"
#elif defined(ETL_COMPILER_ARM5)
#include "atomic/atomic_arm.h"

File diff suppressed because it is too large Load Diff

View File

@ -30,8 +30,8 @@ SOFTWARE.
#define ETL_ATOMIC_STD_INCLUDED
#include "../platform.h"
#include "../nullptr.h"
#include "../char_traits.h"
#include "../nullptr.h"
#include <atomic>
#include <stdint.h>
@ -55,39 +55,39 @@ namespace etl
static ETL_CONSTANT etl::memory_order memory_order_acq_rel = std::memory_order_acq_rel;
static ETL_CONSTANT etl::memory_order memory_order_seq_cst = std::memory_order_seq_cst;
using atomic_bool = std::atomic<bool>;
using atomic_char = std::atomic<char>;
using atomic_schar = std::atomic<signed char>;
using atomic_uchar = std::atomic<unsigned char>;
using atomic_short = std::atomic<short>;
using atomic_ushort = std::atomic<unsigned short>;
using atomic_int = std::atomic<int>;
using atomic_uint = std::atomic<unsigned int>;
using atomic_long = std::atomic<long>;
using atomic_ulong = std::atomic<unsigned long>;
using atomic_llong = std::atomic<long long>;
using atomic_ullong = std::atomic<unsigned long long>;
using atomic_wchar_t = std::atomic<wchar_t>;
using atomic_bool = std::atomic<bool>;
using atomic_char = std::atomic<char>;
using atomic_schar = std::atomic<signed char>;
using atomic_uchar = std::atomic<unsigned char>;
using atomic_short = std::atomic<short>;
using atomic_ushort = std::atomic<unsigned short>;
using atomic_int = std::atomic<int>;
using atomic_uint = std::atomic<unsigned int>;
using atomic_long = std::atomic<long>;
using atomic_ulong = std::atomic<unsigned long>;
using atomic_llong = std::atomic<long long>;
using atomic_ullong = std::atomic<unsigned long long>;
using atomic_wchar_t = std::atomic<wchar_t>;
#if ETL_HAS_NATIVE_CHAR8_T
using atomic_char8_t = std::atomic<char8_t>;
#endif
#if ETL_HAS_NATIVE_CHAR16_T
using atomic_char16_t = std::atomic<char16_t>;
using atomic_char16_t = std::atomic<char16_t>;
#endif
#if ETL_HAS_NATIVE_CHAR32_T
using atomic_char32_t = std::atomic<char32_t>;
using atomic_char32_t = std::atomic<char32_t>;
#endif
#if ETL_USING_8BIT_TYPES
using atomic_uint8_t = std::atomic<uint8_t>;
using atomic_int8_t = std::atomic<int8_t>;
using atomic_uint8_t = std::atomic<uint8_t>;
using atomic_int8_t = std::atomic<int8_t>;
#endif
using atomic_uint16_t = std::atomic<uint16_t>;
using atomic_int16_t = std::atomic<int16_t>;
using atomic_uint32_t = std::atomic<uint32_t>;
using atomic_int32_t = std::atomic<int32_t>;
using atomic_uint16_t = std::atomic<uint16_t>;
using atomic_int16_t = std::atomic<int16_t>;
using atomic_uint32_t = std::atomic<uint32_t>;
using atomic_int32_t = std::atomic<int32_t>;
#if ETL_USING_64BIT_TYPES
using atomic_uint64_t = std::atomic<uint64_t>;
using atomic_int64_t = std::atomic<int64_t>;
using atomic_uint64_t = std::atomic<uint64_t>;
using atomic_int64_t = std::atomic<int64_t>;
#endif
using atomic_int_least8_t = std::atomic<int_least8_t>;
using atomic_uint_least8_t = std::atomic<uint_least8_t>;
@ -99,22 +99,22 @@ namespace etl
using atomic_int_least64_t = std::atomic<int_least64_t>;
using atomic_uint_least64_t = std::atomic<uint_least64_t>;
#endif
using atomic_int_fast8_t = std::atomic<int_fast8_t>;
using atomic_uint_fast8_t = std::atomic<uint_fast8_t>;
using atomic_int_fast16_t = std::atomic<int_fast16_t>;
using atomic_uint_fast16_t = std::atomic<uint_fast16_t>;
using atomic_int_fast32_t = std::atomic<int_fast32_t>;
using atomic_uint_fast32_t = std::atomic<uint_fast32_t>;
using atomic_int_fast8_t = std::atomic<int_fast8_t>;
using atomic_uint_fast8_t = std::atomic<uint_fast8_t>;
using atomic_int_fast16_t = std::atomic<int_fast16_t>;
using atomic_uint_fast16_t = std::atomic<uint_fast16_t>;
using atomic_int_fast32_t = std::atomic<int_fast32_t>;
using atomic_uint_fast32_t = std::atomic<uint_fast32_t>;
#if ETL_USING_64BIT_TYPES
using atomic_int_fast64_t = std::atomic<int_fast64_t>;
using atomic_uint_fast64_t = std::atomic<uint_fast64_t>;
using atomic_int_fast64_t = std::atomic<int_fast64_t>;
using atomic_uint_fast64_t = std::atomic<uint_fast64_t>;
#endif
using atomic_intptr_t = std::atomic<intptr_t>;
using atomic_uintptr_t = std::atomic<uintptr_t>;
using atomic_size_t = std::atomic<size_t>;
using atomic_ptrdiff_t = std::atomic<ptrdiff_t>;
using atomic_intmax_t = std::atomic<intmax_t>;
using atomic_uintmax_t = std::atomic<uintmax_t>;
}
using atomic_intptr_t = std::atomic<intptr_t>;
using atomic_uintptr_t = std::atomic<uintptr_t>;
using atomic_size_t = std::atomic<size_t>;
using atomic_ptrdiff_t = std::atomic<ptrdiff_t>;
using atomic_intmax_t = std::atomic<intmax_t>;
using atomic_uintmax_t = std::atomic<uintmax_t>;
} // namespace etl
#endif

View File

@ -1,13 +1,11 @@
//*************************************************************************
///Decode from Base64 from and to pointer/length
//*************************************************************************///\file
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2023 John Wellbelove
Copyright(c) 2024 John Wellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
@ -28,23 +26,30 @@ SOFTWARE.
#ifndef ETL_BASE64_INCLUDED
#define ETL_BASE64_INCLUDED
#include "etl/platform.h"
#include "etl/span.h"
#include "etl/static_assert.h"
#include "etl/error_handler.h"
#include "etl/exception.h"
#include "etl/type_traits.h"
#include "etl/binary.h"
#include "etl/algorithm.h"
#include "etl/integral_limits.h"
#include "etl/iterator.h"
#include "etl/string.h"
#include "platform.h"
#include "enum_type.h"
#include "error_handler.h"
#include "exception.h"
#include "integral_limits.h"
#include "static_assert.h"
#include "type_traits.h"
#include <stdint.h>
#if ETL_USING_STL
#include <string>
#endif
/**************************************************************************************************************************************************************************
* See https://en.wikipedia.org/wiki/Base64
*
* Encoding Encoding characters
*Separate encoding of lines Decoding non-encoding characters 62nd 63rd Pad
*Separators Length Checksum RFC 1421 : Base64 for
*Privacy - Enhanced Mail(deprecated) + / = mandatory CR + LF 64,
*or lower for the last line No No RFC 2045 : Base64 transfer encoding for MIME
*+ / = mandatory CR + LF At most 76 No Discarded RFC 2152 : Base64
*for UTF - 7 + / No No No RFC
*3501 : Base64 encoding for IMAP mailbox names + , No
*No No RFC 4648 : base64(standard)[a] + / = optional No No RFC 4648 :
*base64url(URL - and filename - safe standard) - _ = optional No No
**************************************************************************************************************************************************************************/
namespace etl
{
@ -62,7 +67,7 @@ namespace etl
};
//***************************************************************************
/// Memory misalignment exception.
/// buffer overflow exception.
//***************************************************************************
class base64_overflow : public base64_exception
{
@ -74,450 +79,134 @@ namespace etl
}
};
//*************************************************************************
/// Codec for Base64
//*************************************************************************
//***************************************************************************
/// Illegal character exception.
//***************************************************************************
class base64_invalid_data : public base64_exception
{
public:
base64_invalid_data(string_type file_name_, numeric_type line_number_)
: base64_exception(ETL_ERROR_TEXT("base64:invalid data", ETL_BASE64_FILE_ID"B"), file_name_, line_number_)
{
}
};
//***************************************************************************
/// Invalid decode input length exception.
//***************************************************************************
class base64_invalid_decode_input_length : public base64_exception
{
public:
base64_invalid_decode_input_length(string_type file_name_, numeric_type line_number_)
: base64_exception(ETL_ERROR_TEXT("base64:invalid decode input length", ETL_BASE64_FILE_ID"C"), file_name_, line_number_)
{
}
};
//***************************************************************************
/// Common Base64 definitions
//***************************************************************************
class base64
{
public:
//*************************************************************************
/// Encode to Base64 from and to pointer/length
//*************************************************************************
template <typename T>
ETL_CONSTEXPR14
static
typename etl::enable_if<etl::is_integral<T>::value && (etl::integral_limits<T>::bits == 8U), size_t>::type
encode(const T* input, size_t input_length, char* output, size_t output_length)
struct Encoding
{
if (input_length == 0U)
enum enum_type
{
return 0;
}
// RFC_1421, // Not implemented
// RFC_2045, // Not implemented
RFC_2152,
RFC_3501,
RFC_4648,
RFC_4648_PADDING,
RFC_4648_URL,
RFC_4648_URL_PADDING,
};
// Figure out if the output buffer is large enough.
size_t required_output_length = encode_size(input_length);
ETL_ASSERT_OR_RETURN_VALUE(output_length >= required_output_length, ETL_ERROR(base64_overflow), 0U);
const T* p_in = input;
const T* p_in_end = input + input_length;
char* p_out = output;
char* p_out_end = output + required_output_length;
int next_sextet = First_Sextet;
// Step through the input buffer, creating the output sextets.
while (p_in != p_in_end)
{
T c = *p_in;
char index = 0;
switch (next_sextet)
{
//**************************
case First_Sextet:
{
index = static_cast<char>((*p_in & b11111100) >> 2);
next_sextet = Second_Sextet;
break;
}
//**************************
case Second_Sextet:
{
index = static_cast<char>((c & b00000011) << 4);
++p_in;
// Next byte valid?
if (p_in != p_in_end)
{
index = index | ((*p_in & b11110000) >> 4);
}
next_sextet = Third_Sextet;
break;
}
//**************************
case Third_Sextet:
{
index = (c & b00001111) << 2;
++p_in;
// Next byte valid?
if (p_in != p_in_end)
{
index = index | static_cast<char>((*p_in & b11000000) >> 6);
}
next_sextet = Fourth_Sextet;
break;
}
//**************************
case Fourth_Sextet:
{
index = static_cast<char>(c & b00111111);
++p_in;
next_sextet = First_Sextet;
break;
}
//**************************
default:
{
// Should never get here.
assert(false);
break;
}
}
*p_out = get_sextet_from_index(index);
++p_out;
}
// Pad out the end of the output buffer.
while (p_out != p_out_end)
{
*p_out++ = padding();
}
return static_cast<size_t>(etl::distance(output, p_out));
}
//*************************************************************************
/// Encode to Base64 from and to pointer/pointer
//*************************************************************************
template <typename T>
ETL_CONSTEXPR14
static
typename etl::enable_if<etl::is_integral<T>::value && (etl::integral_limits<T>::bits == 8U), size_t>::type
encode(const T* input_begin, const T* input_end, char* output_begin, char* output_end)
{
return encode(input_begin, static_cast<size_t>(etl::distance(input_begin, input_end)),
output_begin, static_cast<size_t>(etl::distance(output_begin, output_end)));
}
//*************************************************************************
/// Encode to Base64 from and to span/span
//*************************************************************************
template <typename T, size_t Length1, size_t Length2>
ETL_CONSTEXPR14
static
typename etl::enable_if<etl::is_integral<T>::value && (etl::integral_limits<T>::bits == 8U), size_t>::type
encode(const etl::span<const T, Length1>& input_span,
const etl::span<char, Length2>& output_span)
{
return encode(input_span.begin(), input_span.size(),
output_span.begin(), output_span.size());
}
//*************************************************************************
/// Encode to Base64 from pointer/length to etl::istring
//*************************************************************************
template <typename T>
ETL_CONSTEXPR14
static
typename etl::enable_if<etl::is_integral<T>::value && (etl::integral_limits<T>::bits == 8U), size_t>::type
encode(const T* input_begin, size_t input_length,
etl::istring& output)
{
output.resize(etl::base64::encode_size(input_length));
return encode(input_begin, input_length,
output.data(), output.size());
}
//*************************************************************************
/// Encode to Base64 from pointer/pointer to etl::istring
//*************************************************************************
template <typename T>
ETL_CONSTEXPR14
static
typename etl::enable_if<etl::is_integral<T>::value && (etl::integral_limits<T>::bits == 8U), size_t>::type
encode(const T* input_begin, const T* input_end,
etl::istring& output)
{
output.resize(etl::base64::encode_size(etl::distance(input_begin, input_end)));
return encode(input_begin, static_cast<size_t>(etl::distance(input_begin, input_end)),
output.data(), output.size());
}
//*************************************************************************
/// Encode to Base64 from span to etl::istring
//*************************************************************************
template <typename T, size_t Length1>
ETL_CONSTEXPR14
static
typename etl::enable_if<etl::is_integral<T>::value && (etl::integral_limits<T>::bits == 8U), size_t>::type
encode(const etl::span<const T, Length1>& input_span,
etl::istring& output)
{
output.resize(etl::base64::encode_size(Length1));
return encode(input_span.begin(), input_span.size(),
output.data(), output.size());
}
//*************************************************************************
/// Calculates the buffer size required to encode to Base64
//*************************************************************************
ETL_NODISCARD
ETL_CONSTEXPR14
static
size_t encode_size(size_t input_length)
{
size_t required_output_length = (input_length * 8U) / 6U;
if ((input_length % 3U) != 0U)
{
while ((required_output_length % 4U) != 0)
{
++required_output_length;
}
}
return required_output_length;
}
//*************************************************************************
/// Decode from Base64 from and to pointer/length
//*************************************************************************
template <typename T>
ETL_CONSTEXPR14
static
typename etl::enable_if<etl::is_integral<T>::value && (etl::integral_limits<T>::bits == 8U), size_t>::type
decode(const char* input, size_t input_length, T* output, size_t output_length)
{
if (input_length == 0)
{
return 0;
}
// Figure out if the output buffer is large enough.
size_t required_output_length = etl::base64::decode_size(input, input_length);
ETL_ASSERT_OR_RETURN_VALUE(output_length >= required_output_length, ETL_ERROR(base64_overflow), 0U);
const char* p_in = input;
const char* p_in_end = input + input_length;
T* p_out = output;
T c = 0;
int next_sextet = First_Sextet;
// Step through the input buffer, creating the output binary.
while (p_in != p_in_end)
{
char sextet = *p_in++; // Get the sextet as a T.
if (sextet == padding())
{
break;
}
char index = get_index_from_sextet(sextet);
switch (next_sextet)
{
//**************************
case First_Sextet:
{
c = (index & b00111111) << 2;
next_sextet = Second_Sextet;
break;
}
//**************************
case Second_Sextet:
{
c |= (index & b00110000) >> 4;
*p_out++ = static_cast<T>(c);
c = (index & b00001111) << 4;
next_sextet = Third_Sextet;
break;
}
//**************************
case Third_Sextet:
{
c |= (index & b00111100) >> 2;
*p_out++ = static_cast<T>(c);
c = (index & b00000011) << 6;
next_sextet = Fourth_Sextet;
break;
}
//**************************
case Fourth_Sextet:
{
c |= (index & b00111111);
*p_out++ = static_cast<T>(c);
next_sextet = First_Sextet;
break;
}
//**************************
default:
{
// Should never get here.
assert(false);
break;
}
}
}
return static_cast<size_t>(etl::distance(output, p_out));
}
//*************************************************************************
/// Decode from Base64 from and to pointer/pointer
//*************************************************************************
template <typename T>
ETL_CONSTEXPR14
static
typename etl::enable_if<etl::is_integral<T>::value && (etl::integral_limits<T>::bits == 8U), size_t>::type
decode(const char* input_begin, const char* input_end, T* output_begin, T* output_end)
{
return decode(input_begin, static_cast<size_t>(etl::distance(input_begin, input_end)),
output_begin, static_cast<size_t>(etl::distance(output_begin, output_end)));
}
//*************************************************************************
/// Decode from Base64 from and to span/span
//*************************************************************************
template <typename T, size_t Length1, size_t Length2>
ETL_CONSTEXPR14
static
typename etl::enable_if<etl::is_integral<T>::value && (etl::integral_limits<T>::bits == 8U), size_t>::type
decode(const etl::span<const char, Length1>& input_span,
const etl::span<T, Length2>& output_span)
{
return decode(input_span.begin(), input_span.size(),
output_span.begin(), output_span.size());
}
//*************************************************************************
/// Calculates the buffer size required to decode from Base64
//*************************************************************************
ETL_NODISCARD
ETL_CONSTEXPR14
static size_t decode_size(const char* input, size_t input_length)
{
if (input_length == 0U)
{
return 0U;
}
// Figure out the minimum output buffer size.
size_t length = static_cast<size_t>(etl::distance(input, etl::find(input, input + input_length, padding())) - 1);
size_t required_output_length = length - (length / 4U);
return required_output_length;
}
private:
//*************************************************************************
/// Sextet index id.
enum
{
First_Sextet,
Second_Sextet,
Third_Sextet,
Fourth_Sextet
ETL_DECLARE_ENUM_TYPE(Encoding, int)
// ETL_ENUM_TYPE(RFC_1421, "RFC_1421") // Not implemented
// ETL_ENUM_TYPE(RFC_2045, "RFC_2045") // Not implemented
ETL_ENUM_TYPE(RFC_2152, "RFC_2152")
ETL_ENUM_TYPE(RFC_3501, "RFC_3501")
ETL_ENUM_TYPE(RFC_4648, "RFC_4648")
ETL_ENUM_TYPE(RFC_4648_PADDING, "RFC_4648_PADDING")
ETL_ENUM_TYPE(RFC_4648_URL, "RFC_4648_URL")
ETL_ENUM_TYPE(RFC_4648_URL_PADDING, "RFC_4648_URL_PADDING")
ETL_END_ENUM_TYPE
};
// Sextets
// 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
// 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
// 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
// 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
// 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
// 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
// 'w', 'x', 'y', 'z', '0', '1', '2', '3',
// '4', '5', '6', '7', '8', '9', '+', '/'
//*************************************************************************
// Translates an index into a sextet
//*************************************************************************
ETL_CONSTEXPR14 static char get_sextet_from_index(char index)
struct Padding
{
if ((index >= 0) && (index < 26))
enum enum_type
{
return 'A' + index;
}
else if ((index >= 26) && (index < 52))
No_Padding = 0,
Use_Padding = 1
};
ETL_DECLARE_ENUM_TYPE(Padding, bool)
ETL_ENUM_TYPE(No_Padding, "No_Padding")
ETL_ENUM_TYPE(Use_Padding, "Use_Padding")
ETL_END_ENUM_TYPE
};
struct Non_Coding_Characters
{
enum enum_type
{
index -= 26;
return 'a' + index;
}
else if ((index >= 52) && (index < 62))
{
index -= 52;
return '0' + index;
}
else if (index == 62)
{
return '+';
}
else if (index == 63)
{
return '/';
}
else
{
// Should never get here.
assert(false);
return padding();
}
Ignore = 0,
Reject = 1
};
ETL_DECLARE_ENUM_TYPE(Non_Coding_Characters, bool)
ETL_ENUM_TYPE(Ignore, "Ignore")
ETL_ENUM_TYPE(Reject, "Reject")
ETL_END_ENUM_TYPE
};
enum
{
Invalid_Data = etl::integral_limits<int>::max,
Min_Encode_Buffer_Size = 4,
Min_Decode_Buffer_Size = 3
};
protected:
ETL_CONSTEXPR14 base64(const char* encoder_table_, bool use_padding_)
: encoder_table(encoder_table_)
, use_padding(use_padding_)
{
}
//*************************************************************************
// Translates a sextet into an index
// Character set for RFC-1421, RFC-2045, RFC-2152 and RFC-4648
//*************************************************************************
ETL_CONSTEXPR14 static char get_index_from_sextet(char sextet)
static ETL_CONSTEXPR14 const char* character_set_1()
{
if ((sextet >= 'A') && (sextet <= 'Z'))
{
return sextet - 'A';
}
else if ((sextet >= 'a') && (sextet <= 'z'))
{
return sextet - 'a' + 26;
}
else if ((sextet >= '0') && (sextet <= '9'))
{
return sextet - '0' + 52;
}
else if (sextet == '+')
{
return 62;
}
else if (sextet == '/')
{
return 63;
}
else
{
// Should never get here.
assert(false);
return 0;
}
return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
}
//*************************************************************************
/// Gets the padding character
// Character set for RFC-4648-URL
//*************************************************************************
ETL_NODISCARD
ETL_CONSTEXPR14
static char padding()
static ETL_CONSTEXPR14 const char* character_set_2()
{
return '=';
return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
}
//*************************************************************************
// Character set for RFC-3501-URL
//*************************************************************************
static ETL_CONSTEXPR14 const char* character_set_3()
{
return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+,";
}
const char* encoder_table;
const bool use_padding;
};
}
} // namespace etl
#endif

View File

@ -0,0 +1,764 @@
//*************************************************************************
/// Decode from Base64 from and to pointer/length
//*************************************************************************///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2024 John Wellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_BASE64_DECODER_INCLUDED
#define ETL_BASE64_DECODER_INCLUDED
#include "platform.h"
#include "algorithm.h"
#include "binary.h"
#include "delegate.h"
#include "enum_type.h"
#include "error_handler.h"
#include "integral_limits.h"
#include "iterator.h"
#include "span.h"
#include "static_assert.h"
#include "type_traits.h"
#include "base64.h"
#include <stdint.h>
#if ETL_USING_STL
#include <iterator>
#endif
#define ETL_IS_8_BIT_INTEGRAL(Type) \
(etl::is_integral<typename etl::remove_cv<Type>::type>::value && (etl::integral_limits<typename etl::remove_cv<Type>::type>::bits == 8U))
#define ETL_IS_ITERATOR_TYPE_8_BIT_INTEGRAL(Type) \
(etl::is_integral< typename etl::iterator_traits< typename etl::remove_cv<Type>::type>::value_type>::value \
&& (etl::integral_limits< typename etl::iterator_traits< typename etl::remove_cv<Type>::type>::value_type>::bits == 8U))
namespace etl
{
//*************************************************************************
/// Base64 Decoder
//*************************************************************************
class ibase64_decoder : public base64
{
public:
typedef etl::span<const unsigned char> span_type;
typedef etl::delegate<void(const span_type&)> callback_type;
//*************************************************************************
/// Decode to Base64
//*************************************************************************
template <typename T>
ETL_CONSTEXPR14 bool decode(T value)
{
ETL_STATIC_ASSERT(ETL_IS_8_BIT_INTEGRAL(T), "Input type must be an 8 bit integral");
push_to_input_buffer(value);
if (input_buffer_is_full())
{
if (decode_block())
{
if (callback.is_valid())
{
if (output_buffer_is_full())
{
callback(span());
reset_output_buffer();
}
}
}
reset_input_buffer();
}
return !error();
}
//*************************************************************************
/// Decode from Base64
//*************************************************************************
template <typename TInputIterator>
ETL_CONSTEXPR14 bool decode(TInputIterator input_begin, TInputIterator input_end)
{
ETL_STATIC_ASSERT(ETL_IS_ITERATOR_TYPE_8_BIT_INTEGRAL(TInputIterator), "Input type must be an 8 bit integral");
while (input_begin != input_end)
{
if (!decode(*input_begin++))
{
return false;
}
}
return true;
}
//*************************************************************************
/// Decode from Base64
//*************************************************************************
template <typename TInputIterator>
ETL_CONSTEXPR14 bool decode(TInputIterator input_begin, size_t input_length)
{
ETL_STATIC_ASSERT(ETL_IS_ITERATOR_TYPE_8_BIT_INTEGRAL(TInputIterator), "Input type must be an 8 bit integral");
while (input_length-- != 0)
{
if (!decode(*input_begin++))
{
return false;
}
}
return true;
}
//*************************************************************************
/// Decode from Base64
//*************************************************************************
template <typename TInputIterator>
ETL_CONSTEXPR14 bool decode_final(TInputIterator input_begin, TInputIterator input_end)
{
return decode(input_begin, input_end) && flush();
}
//*************************************************************************
/// Decode from Base64
//*************************************************************************
template <typename TInputIterator>
ETL_CONSTEXPR14 bool decode_final(TInputIterator input_begin, size_t input_length)
{
return decode(input_begin, input_length) && flush();
}
//*************************************************************************
/// Flush any remaining data to the output.
//*************************************************************************
ETL_CONSTEXPR14 bool flush()
{
// Encode any remaining input data.
bool success = decode_block();
reset_input_buffer();
if (success)
{
if (callback.is_valid())
{
// Send any remaining data.
if (size() != 0)
{
callback(span());
}
// Indicate this was the final block.
callback(span_type());
reset_output_buffer();
}
}
padding_received = false;
return success;
}
//*************************************************************************
/// Reset the encoder.
//*************************************************************************
ETL_CONSTEXPR14 void restart()
{
reset_input_buffer();
reset_output_buffer();
overflow_detected = false;
invalid_data_detected = false;
padding_received = false;
}
//*************************************************************************
/// Returns the beginning of the output buffer.
//*************************************************************************
ETL_NODISCARD ETL_CONSTEXPR14 const unsigned char* begin() const
{
return p_output_buffer;
}
//*************************************************************************
/// This only returns a useful value if a callback has not been set or
/// called.
//*************************************************************************
ETL_NODISCARD ETL_CONSTEXPR14 const unsigned char* end() const
{
return p_output_buffer + output_buffer_length;
}
//*************************************************************************
/// Returns the beginning of the output buffer.
//*************************************************************************
ETL_NODISCARD ETL_CONSTEXPR14 const unsigned char* cbegin() const
{
return p_output_buffer;
}
//*************************************************************************
/// This only returns a useful value if a callback has not been set or
/// called.
//*************************************************************************
ETL_NODISCARD ETL_CONSTEXPR14 const unsigned char* cend() const
{
return p_output_buffer + output_buffer_length;
}
//*************************************************************************
/// Returns the size of the output buffer.
/// This only returns a useful value if a callback has not been set or
/// called.
//*************************************************************************
ETL_NODISCARD ETL_CONSTEXPR14 size_t size() const
{
return output_buffer_length;
}
//*************************************************************************
/// Returns the maximum size of the output buffer.
//*************************************************************************
ETL_NODISCARD ETL_CONSTEXPR14 size_t buffer_size() const
{
return output_buffer_max_size;
}
//*************************************************************************
/// Get a span of the output data.
/// This only returns a useful span if a callback has not been set or
/// called.
//*************************************************************************
ETL_NODISCARD ETL_CONSTEXPR14 span_type span() const
{
return span_type(begin(), end());
}
//*************************************************************************
/// Returns true if the output buffer has overflowed
//*************************************************************************
ETL_NODISCARD ETL_CONSTEXPR14 bool overflow() const
{
return overflow_detected;
}
//*************************************************************************
/// Returns true if an invalid character was detected.
//*************************************************************************
ETL_NODISCARD ETL_CONSTEXPR14 bool invalid_data() const
{
return invalid_data_detected;
}
//*************************************************************************
/// Returns true if an error was detected.
//*************************************************************************
ETL_NODISCARD ETL_CONSTEXPR14 bool error() const
{
return overflow() || invalid_data();
}
protected:
//*************************************************************************
/// Constructor
//*************************************************************************
ETL_CONSTEXPR14 ibase64_decoder(const char* encoder_table_, bool use_padding_, unsigned char* p_output_buffer_, size_t ouput_buffer_max_size_,
callback_type callback_)
: base64(encoder_table_, use_padding_)
, input_buffer()
, input_buffer_length(0)
, p_output_buffer(p_output_buffer_)
, output_buffer_length(0)
, output_buffer_max_size(ouput_buffer_max_size_)
, callback(callback_)
, overflow_detected(false)
, invalid_data_detected(false)
, padding_received(false)
{
}
//*************************************************************************
/// Calculates the minimum buffer size required to decode from Base64
//*************************************************************************
ETL_NODISCARD
static ETL_CONSTEXPR14 size_t decoded_size_from_valid_input_length(size_t input_length)
{
return input_length - (input_length / 4U);
}
private:
//*************************************************************************
// Translates a sextet into an index
//*************************************************************************
template <typename T>
ETL_CONSTEXPR14 uint32_t get_index_from_sextet(T sextet)
{
const char* encoder_table_end = encoder_table + 64;
const char* p_sextet = etl::find(encoder_table, encoder_table_end, static_cast<char>(sextet));
if (p_sextet != encoder_table_end)
{
return static_cast<uint32_t>(etl::distance(encoder_table, p_sextet));
}
else
{
invalid_data_detected = true;
return 0;
}
}
//*************************************************************************
/// Gets the padding character
//*************************************************************************
template <typename T>
ETL_NODISCARD
static
ETL_CONSTEXPR14 T padding()
{
return static_cast<T>('=');
}
//*************************************************************************
/// Decode one block of data.
//*************************************************************************
ETL_CONSTEXPR14 bool decode_block()
{
switch (input_buffer_length)
{
// Only triggered on call to flush().
case 2:
{
uint32_t sextets = (get_index_from_sextet(input_buffer[0]) << 6);
sextets = sextets | (get_index_from_sextet(input_buffer[1]));
push_to_output_buffer((sextets >> 4) & 0xFF);
break;
}
// Only triggered on call to flush().
case 3:
{
uint32_t sextets = (get_index_from_sextet(input_buffer[0]) << 12);
sextets = sextets | (get_index_from_sextet(input_buffer[1]) << 6);
sextets = sextets | (get_index_from_sextet(input_buffer[2]));
push_to_output_buffer((sextets >> 10) & 0xFF);
push_to_output_buffer((sextets >> 2) & 0xFF);
break;
}
// Only triggered on call to decode().
case 4:
{
// Read in four sextets
uint32_t sextets = (get_index_from_sextet(input_buffer[0]) << 18);
sextets = sextets | (get_index_from_sextet(input_buffer[1]) << 12);
sextets = sextets | (get_index_from_sextet(input_buffer[2]) << 6);
sextets = sextets | (get_index_from_sextet(input_buffer[3]));
// Write out three octets
push_to_output_buffer((sextets >> 16) & 0xFF);
push_to_output_buffer((sextets >> 8) & 0xFF);
push_to_output_buffer((sextets >> 0) & 0xFF);
break;
}
default:
{
break;
}
}
ETL_ASSERT(!invalid_data_detected, ETL_ERROR(etl::base64_invalid_data));
ETL_ASSERT(!overflow_detected, ETL_ERROR(etl::base64_overflow));
return (!invalid_data_detected && !overflow_detected);
}
//*************************************************************************
// Push to the output buffer.
//*************************************************************************
ETL_CONSTEXPR14 void push_to_output_buffer(unsigned char c)
{
if (output_buffer_length < output_buffer_max_size)
{
p_output_buffer[output_buffer_length++] = c;
}
else
{
overflow_detected = true;
}
}
//*************************************************************************
//
//*************************************************************************
ETL_CONSTEXPR14 bool output_buffer_is_full() const
{
return output_buffer_length == output_buffer_max_size;
}
//*************************************************************************
//
//*************************************************************************
ETL_CONSTEXPR14 bool output_buffer_is_empty() const
{
return output_buffer_length == 0;
}
//*************************************************************************
//
//*************************************************************************
ETL_CONSTEXPR14 void reset_output_buffer()
{
output_buffer_length = 0;
}
//*************************************************************************
// Push to the input buffer.
//*************************************************************************
template <typename T>
ETL_CONSTEXPR14 void push_to_input_buffer(T value)
{
if (value == padding<T>())
{
padding_received = true;
}
else
{
if (padding_received)
{
ETL_ASSERT_FAIL(ETL_ERROR(etl::base64_invalid_data));
invalid_data_detected = true;
}
else
{
input_buffer[input_buffer_length++] = static_cast<char>(value);
}
}
}
//*************************************************************************
//
//*************************************************************************
ETL_CONSTEXPR14 bool input_buffer_is_full() const
{
return input_buffer_length == 4U;
}
//*************************************************************************
//
//*************************************************************************
ETL_CONSTEXPR14 void reset_input_buffer()
{
input_buffer_length = 0;
}
char input_buffer[4];
size_t input_buffer_length;
unsigned char* p_output_buffer;
size_t output_buffer_length;
const size_t output_buffer_max_size;
callback_type callback;
bool overflow_detected;
bool invalid_data_detected;
bool padding_received;
};
//*************************************************************************
/// Base64 RFC-2152 Decoder
//*************************************************************************
template <size_t Buffer_Size = etl::base64::Min_Decode_Buffer_Size>
class base64_rfc2152_decoder : public ibase64_decoder
{
public:
ETL_STATIC_ASSERT((Buffer_Size >= etl::base64::Min_Decode_Buffer_Size), "Buffer size must be greater than etl::base64::Min_Decode_Buffer_Size");
//*************************************************************************
/// Base64 RFC-2152 constructor.
//*************************************************************************
ETL_CONSTEXPR14 base64_rfc2152_decoder()
: ibase64_decoder(etl::base64::character_set_1(), etl::base64::Padding::No_Padding, output_buffer, Buffer_Size, callback_type())
, output_buffer()
{
}
//*************************************************************************
/// Base64 RFC-2152 constructor.
//*************************************************************************
ETL_CONSTEXPR14 base64_rfc2152_decoder(callback_type callback_)
: ibase64_decoder(etl::base64::character_set_1(), etl::base64::Padding::No_Padding, output_buffer, Buffer_Size, callback_)
, output_buffer()
{
}
//*************************************************************************
/// Calculate the required output encode buffer size.
//*************************************************************************
ETL_NODISCARD
static
ETL_CONSTEXPR14 size_t safe_output_buffer_size(size_t input_length)
{
return ibase64_decoder::decoded_size_from_valid_input_length(input_length);
}
private:
/// The internal output buffer.
unsigned char output_buffer[Buffer_Size];
};
//*************************************************************************
/// Base64 RFC-3501 Decoder
//*************************************************************************
template <size_t Buffer_Size = etl::base64::Min_Decode_Buffer_Size>
class base64_rfc3501_decoder : public ibase64_decoder
{
public:
ETL_STATIC_ASSERT((Buffer_Size >= etl::base64::Min_Decode_Buffer_Size), "Buffer size must be greater than etl::base64::Min_Decode_Buffer_Size");
//*************************************************************************
/// Base64 RFC-3501 constructor.
//*************************************************************************
ETL_CONSTEXPR14 base64_rfc3501_decoder()
: ibase64_decoder(etl::base64::character_set_3(), etl::base64::Padding::No_Padding, output_buffer, Buffer_Size, callback_type())
, output_buffer()
{
}
//*************************************************************************
/// Base64 RFC-3501 constructor.
//*************************************************************************
ETL_CONSTEXPR14 base64_rfc3501_decoder(callback_type callback_)
: ibase64_decoder(etl::base64::character_set_3(), etl::base64::Padding::No_Padding, output_buffer, Buffer_Size, callback_)
, output_buffer()
{
}
//*************************************************************************
/// Calculate the required output encode buffer size.
//*************************************************************************
ETL_NODISCARD
static
ETL_CONSTEXPR14 size_t safe_output_buffer_size(size_t input_length)
{
return ibase64_decoder::decoded_size_from_valid_input_length(input_length);
}
private:
/// The internal output buffer.
unsigned char output_buffer[Buffer_Size];
};
//*************************************************************************
/// Base64 RFC-4648 Decoder
//*************************************************************************
template <size_t Buffer_Size = etl::base64::Min_Decode_Buffer_Size>
class base64_rfc4648_decoder : public ibase64_decoder
{
public:
ETL_STATIC_ASSERT((Buffer_Size >= etl::base64::Min_Decode_Buffer_Size), "Buffer size must be greater than etl::base64::Min_Decode_Buffer_Size");
//*************************************************************************
/// Base64 RFC-4648 constructor.
//*************************************************************************
ETL_CONSTEXPR14 base64_rfc4648_decoder()
: ibase64_decoder(etl::base64::character_set_1(), etl::base64::Padding::No_Padding, output_buffer, Buffer_Size, callback_type())
, output_buffer()
{
}
//*************************************************************************
/// Base64 RFC-4648 constructor.
//*************************************************************************
ETL_CONSTEXPR14 base64_rfc4648_decoder(callback_type callback_)
: ibase64_decoder(etl::base64::character_set_1(), etl::base64::Padding::No_Padding, output_buffer, Buffer_Size, callback_)
, output_buffer()
{
}
//*************************************************************************
/// Calculate the required output encode buffer size.
//*************************************************************************
ETL_NODISCARD
static
ETL_CONSTEXPR14 size_t safe_output_buffer_size(size_t input_length)
{
return ibase64_decoder::decoded_size_from_valid_input_length(input_length);
}
private:
/// The internal output buffer.
unsigned char output_buffer[Buffer_Size];
};
//*************************************************************************
/// Base64 RFC-4648-Padding Decoder
//*************************************************************************
template <size_t Buffer_Size = etl::base64::Min_Decode_Buffer_Size>
class base64_rfc4648_padding_decoder : public ibase64_decoder
{
public:
ETL_STATIC_ASSERT((Buffer_Size >= etl::base64::Min_Decode_Buffer_Size), "Buffer size must be greater than etl::base64::Min_Decode_Buffer_Size");
//*************************************************************************
/// Base64 RFC-4648-Padding constructor.
//*************************************************************************
ETL_CONSTEXPR14 base64_rfc4648_padding_decoder()
: ibase64_decoder(etl::base64::character_set_1(), etl::base64::Padding::Use_Padding, output_buffer, Buffer_Size, callback_type())
, output_buffer()
{
}
//*************************************************************************
/// Base64 RFC-4648-Padding constructor.
//*************************************************************************
ETL_CONSTEXPR14 base64_rfc4648_padding_decoder(callback_type callback_)
: ibase64_decoder(etl::base64::character_set_1(), etl::base64::Padding::Use_Padding, output_buffer, Buffer_Size, callback_)
, output_buffer()
{
}
//*************************************************************************
/// Calculate the required output encode buffer size.
//*************************************************************************
ETL_NODISCARD
static
ETL_CONSTEXPR14 size_t safe_output_buffer_size(size_t input_length)
{
return ibase64_decoder::decoded_size_from_valid_input_length(input_length);
}
private:
/// The internal output buffer.
unsigned char output_buffer[Buffer_Size];
};
//*************************************************************************
/// Base64 RFC-4648-URL Decoder
//*************************************************************************
template <size_t Buffer_Size = etl::base64::Min_Decode_Buffer_Size>
class base64_rfc4648_url_decoder : public ibase64_decoder
{
public:
ETL_STATIC_ASSERT((Buffer_Size >= etl::base64::Min_Decode_Buffer_Size), "Buffer size must be greater than etl::base64::Min_Decode_Buffer_Size");
//*************************************************************************
/// Base64 RFC-4648-Padding constructor.
//*************************************************************************
ETL_CONSTEXPR14 base64_rfc4648_url_decoder()
: ibase64_decoder(etl::base64::character_set_2(), etl::base64::Padding::No_Padding, output_buffer, Buffer_Size, callback_type())
, output_buffer()
{
}
//*************************************************************************
/// Base64 RFC-4648-Padding constructor.
//*************************************************************************
ETL_CONSTEXPR14 base64_rfc4648_url_decoder(callback_type callback_)
: ibase64_decoder(etl::base64::character_set_2(), etl::base64::Padding::No_Padding, output_buffer, Buffer_Size, callback_)
, output_buffer()
{
}
//*************************************************************************
/// Calculate the required output encode buffer size.
//*************************************************************************
ETL_NODISCARD
static
ETL_CONSTEXPR14 size_t safe_output_buffer_size(size_t input_length)
{
return ibase64_decoder::decoded_size_from_valid_input_length(input_length);
}
private:
/// The internal output buffer.
unsigned char output_buffer[Buffer_Size];
};
//*************************************************************************
/// Base64 RFC-4648-URL-Padding Decoder
//*************************************************************************
template <size_t Buffer_Size = etl::base64::Min_Decode_Buffer_Size>
class base64_rfc4648_url_padding_decoder : public ibase64_decoder
{
public:
ETL_STATIC_ASSERT((Buffer_Size >= etl::base64::Min_Decode_Buffer_Size), "Buffer size must be greater than etl::base64::Min_Decode_Buffer_Size");
//*************************************************************************
/// Base64 RFC-4648-Padding constructor.
//*************************************************************************
ETL_CONSTEXPR14 base64_rfc4648_url_padding_decoder()
: ibase64_decoder(etl::base64::character_set_2(), etl::base64::Padding::Use_Padding, output_buffer, Buffer_Size, callback_type())
, output_buffer()
{
}
//*************************************************************************
/// Base64 RFC-4648-Padding constructor.
//*************************************************************************
ETL_CONSTEXPR14 base64_rfc4648_url_padding_decoder(callback_type callback_)
: ibase64_decoder(etl::base64::character_set_2(), etl::base64::Padding::Use_Padding, output_buffer, Buffer_Size, callback_)
, output_buffer()
{
}
//*************************************************************************
/// Calculate the required output encode buffer size.
//*************************************************************************
ETL_NODISCARD
static
ETL_CONSTEXPR14 size_t safe_output_buffer_size(size_t input_length)
{
return ibase64_decoder::decoded_size_from_valid_input_length(input_length);
}
private:
/// The internal output buffer.
unsigned char output_buffer[Buffer_Size];
};
} // namespace etl
#undef ETL_IS_TYPE_8_BIT_INTEGRAL
#undef ETL_IS_ITERATOR_TYPE_8_BIT_INTEGRAL
#endif

View File

@ -0,0 +1,752 @@
//*************************************************************************
/// Decode from Base64 from and to pointer/length
//*************************************************************************///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2024 John Wellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_BASE64_ENCODER_INCLUDED
#define ETL_BASE64_ENCODER_INCLUDED
#include "platform.h"
#include "algorithm.h"
#include "binary.h"
#include "delegate.h"
#include "enum_type.h"
#include "error_handler.h"
#include "integral_limits.h"
#include "iterator.h"
#include "span.h"
#include "static_assert.h"
#include "type_traits.h"
#include "base64.h"
#include <stdint.h>
#if ETL_USING_STL
#include <iterator>
#endif
#define ETL_IS_8_BIT_INTEGRAL(Type) \
(etl::is_integral<typename etl::remove_cv<Type>::type>::value && (etl::integral_limits<typename etl::remove_cv<Type>::type>::bits == 8U))
#define ETL_IS_ITERATOR_TYPE_8_BIT_INTEGRAL(Type) \
(etl::is_integral< typename etl::iterator_traits< typename etl::remove_cv<Type>::type>::value_type>::value \
&& (etl::integral_limits< typename etl::iterator_traits< typename etl::remove_cv<Type>::type>::value_type>::bits == 8U))
namespace etl
{
//*************************************************************************
/// Base64 Encoder
//*************************************************************************
class ibase64_encoder : public base64
{
public:
typedef etl::span<const char> span_type;
typedef etl::delegate<void(const span_type&)> callback_type;
//*************************************************************************
/// Encode to Base64
//*************************************************************************
template <typename T>
ETL_CONSTEXPR14 bool encode(T value)
{
ETL_STATIC_ASSERT(ETL_IS_8_BIT_INTEGRAL(T), "Input type must be an 8 bit integral");
push_to_input_buffer(value);
if (input_buffer_is_full())
{
encode_block();
reset_input_buffer();
if (callback.is_valid())
{
if (output_buffer_is_full())
{
callback(span());
reset_output_buffer();
}
}
}
return !error();
}
//*************************************************************************
/// Encode to Base64
//*************************************************************************
template <typename TInputIterator>
ETL_CONSTEXPR14 bool encode(TInputIterator input_begin, size_t input_length)
{
ETL_STATIC_ASSERT(ETL_IS_ITERATOR_TYPE_8_BIT_INTEGRAL(TInputIterator), "Input type must be an 8 bit integral");
while (input_length-- != 0)
{
if (!encode(*input_begin++))
{
return false;
}
}
return true;
}
//*************************************************************************
/// Encode to Base64
//*************************************************************************
template <typename TInputIterator>
ETL_CONSTEXPR14 bool encode(TInputIterator input_begin, TInputIterator input_end)
{
ETL_STATIC_ASSERT(ETL_IS_ITERATOR_TYPE_8_BIT_INTEGRAL(TInputIterator), "Input type must be an 8 bit integral");
while (input_begin != input_end)
{
if (!encode(*input_begin++))
{
return false;
}
}
return true;
}
//*************************************************************************
/// Encode to Base64
//*************************************************************************
template <typename TInputIterator>
ETL_CONSTEXPR14 bool encode_final(TInputIterator input_begin, size_t input_length)
{
return encode(input_begin, input_length) && flush();
}
//*************************************************************************
/// Encode to Base64
//*************************************************************************
template <typename TInputIterator>
ETL_CONSTEXPR14 bool encode_final(TInputIterator input_begin, TInputIterator input_end)
{
return encode(input_begin, input_end) && flush();
}
//*************************************************************************
/// Flush any remaining data to the output.
//*************************************************************************
ETL_CONSTEXPR14 bool flush()
{
// Encode any remaining input data.
bool success = encode_block();
reset_input_buffer();
if (success)
{
if (callback.is_valid())
{
// Send any remaining data.
if (size() != 0)
{
callback(span());
}
// Indicate this was the final block.
callback(span_type());
reset_output_buffer();
}
}
return success;
}
//*************************************************************************
/// Reset the encoder.
//*************************************************************************
ETL_CONSTEXPR14 void restart()
{
reset_input_buffer();
reset_output_buffer();
}
//*************************************************************************
/// Returns the beginning of the output buffer.
//*************************************************************************
ETL_NODISCARD ETL_CONSTEXPR14 const char* begin() const
{
return p_output_buffer;
}
//*************************************************************************
/// This only returns a useful value if a callback has not been set or
/// called.
//*************************************************************************
ETL_NODISCARD ETL_CONSTEXPR14 const char* end() const
{
return p_output_buffer + output_buffer_length;
}
//*************************************************************************
/// Returns the beginning of the output buffer.
//*************************************************************************
ETL_NODISCARD ETL_CONSTEXPR14 const char* cbegin() const
{
return p_output_buffer;
}
//*************************************************************************
/// This only returns a useful value if a callback has not been set or
/// called.
//*************************************************************************
ETL_NODISCARD ETL_CONSTEXPR14 const char* cend() const
{
return p_output_buffer + output_buffer_length;
}
//*************************************************************************
/// Returns the size of the output buffer.
/// This only returns a useful value if a callback has not been set or
/// called.
//*************************************************************************
ETL_NODISCARD ETL_CONSTEXPR14 size_t size() const
{
return output_buffer_length;
}
//*************************************************************************
/// Returns the maximum size of the output buffer.
//*************************************************************************
ETL_NODISCARD ETL_CONSTEXPR14 size_t max_size() const
{
return output_buffer_max_size;
}
//*************************************************************************
/// Get a span of the output data.
/// This only returns a useful span if a callback has not been set or
/// called.
//*************************************************************************
ETL_NODISCARD ETL_CONSTEXPR14 span_type span() const
{
return span_type(begin(), end());
}
//*************************************************************************
/// Returns true if the output buffer has overflowed
//*************************************************************************
ETL_NODISCARD ETL_CONSTEXPR14 bool overflow() const
{
return overflowed;
}
//*************************************************************************
/// Returns true if an error was detected.
//*************************************************************************
ETL_NODISCARD ETL_CONSTEXPR14 bool error() const
{
return overflow();
}
protected:
//*************************************************************************
/// Constructor
//*************************************************************************
ETL_CONSTEXPR14 ibase64_encoder(const char* encoder_table_, bool use_padding_, char* p_output_buffer_, size_t ouput_buffer_max_size_,
callback_type callback_)
: base64(encoder_table_, use_padding_)
, input_buffer()
, input_buffer_length(0)
, p_output_buffer(p_output_buffer_)
, output_buffer_length(0)
, output_buffer_max_size(ouput_buffer_max_size_)
, callback(callback_)
, overflowed(false)
{
}
//*************************************************************************
/// Encode one block of data.
//*************************************************************************
ETL_CONSTEXPR14 bool encode_block()
{
switch (input_buffer_length)
{
// Only triggered on call to flush().
case 1:
{
uint32_t octets = input_buffer[0];
octets = octets << 4; // Adjust one octet (8 bits) for two sextets
// worth of data (12 bits)
// Write out two sextets + optional padding.
push_to_output_buffer(encoder_table[(octets >> 6) & 0x3F]);
push_to_output_buffer(encoder_table[(octets >> 0) & 0x3F]);
if (use_padding)
{
push_to_output_buffer('=');
push_to_output_buffer('=');
}
break;
}
// Only triggered on call to flush().
case 2:
{
uint32_t octets = (static_cast<uint32_t>(input_buffer[0]) << 8) | input_buffer[1];
octets <<= 2; // Adjust two octets (16 bits) for three sextets worth
// of data (18 bits)
// Write out three sextets + optional padding.
push_to_output_buffer(encoder_table[(octets >> 12) & 0x3F]);
push_to_output_buffer(encoder_table[(octets >> 6) & 0x3F]);
push_to_output_buffer(encoder_table[(octets >> 0) & 0x3F]);
if (use_padding)
{
push_to_output_buffer('=');
}
break;
}
// Only triggered on call to encode().
case 3:
{
uint32_t octets = (static_cast<uint32_t>(input_buffer[0]) << 16) | (static_cast<uint32_t>(input_buffer[1]) << 8) | input_buffer[2];
// Write out four sextets
push_to_output_buffer(encoder_table[(octets >> 18) & 0x3F]);
push_to_output_buffer(encoder_table[(octets >> 12) & 0x3F]);
push_to_output_buffer(encoder_table[(octets >> 6) & 0x3F]);
push_to_output_buffer(encoder_table[(octets >> 0) & 0x3F]);
break;
}
default:
{
break;
}
}
ETL_ASSERT(!overflowed, ETL_ERROR(etl::base64_overflow));
return !overflowed;
}
//*************************************************************************
/// Calculates the minimum buffer size required to encode to Base64
//*************************************************************************
ETL_NODISCARD
static
ETL_CONSTEXPR14 size_t encoded_size(size_t input_length, bool use_padding)
{
size_t required_output_length = 0;
if (input_length == 0U)
{
return 0U;
}
if (use_padding)
{
required_output_length = (input_length * 4U) / 3U;
while ((required_output_length % 4U) != 0)
{
++required_output_length;
}
}
else
{
required_output_length = input_length + (((input_length - 1U) / 3U) + 1U);
}
while (required_output_length % 4)
{
++required_output_length;
}
return required_output_length;
}
private:
//*************************************************************************
// Push to the output buffer.
//*************************************************************************
ETL_CONSTEXPR14 void push_to_output_buffer(char c)
{
if (output_buffer_length < output_buffer_max_size)
{
p_output_buffer[output_buffer_length++] = c;
}
else
{
overflowed = true;
}
}
//*************************************************************************
//
//*************************************************************************
ETL_CONSTEXPR14 bool output_buffer_is_full() const
{
return output_buffer_length == output_buffer_max_size;
}
//*************************************************************************
//
//*************************************************************************
ETL_CONSTEXPR14 bool output_buffer_is_empty() const
{
return output_buffer_length == 0;
}
//*************************************************************************
//
//*************************************************************************
ETL_CONSTEXPR14 void reset_output_buffer()
{
output_buffer_length = 0;
}
//*************************************************************************
// Push to the input buffer.
//*************************************************************************
template <typename T>
ETL_CONSTEXPR14 void push_to_input_buffer(T value)
{
input_buffer[input_buffer_length++] = static_cast<uint8_t>(value);
}
//*************************************************************************
//
//*************************************************************************
ETL_CONSTEXPR14 bool input_buffer_is_full() const
{
return input_buffer_length == 3U;
}
//*************************************************************************
//
//*************************************************************************
ETL_CONSTEXPR14 void reset_input_buffer()
{
input_buffer_length = 0;
}
uint8_t input_buffer[3];
size_t input_buffer_length;
char* p_output_buffer;
size_t output_buffer_length;
const size_t output_buffer_max_size;
callback_type callback;
bool overflowed;
};
//*************************************************************************
/// Base64 RFC-2152 Encoder
//*************************************************************************
template <size_t Buffer_Size = etl::base64::Min_Encode_Buffer_Size>
class base64_rfc2152_encoder : public ibase64_encoder
{
public:
ETL_STATIC_ASSERT((Buffer_Size >= etl::base64::Min_Encode_Buffer_Size), "Buffer size must be greater than etl::base64::Min_Encode_Buffer_Size");
ETL_STATIC_ASSERT(((Buffer_Size % etl::base64::Min_Encode_Buffer_Size) == 0),
"Buffer size must be a multiple of etl::base64::Min_Encode_Buffer_Size");
//*************************************************************************
/// Base64 RFC-2152 constructor.
//*************************************************************************
ETL_CONSTEXPR14 base64_rfc2152_encoder()
: ibase64_encoder(etl::base64::character_set_1(), etl::base64::Padding::No_Padding, output_buffer, Buffer_Size, callback_type())
, output_buffer()
{
}
//*************************************************************************
/// Base64 RFC-2152 constructor.
//*************************************************************************
ETL_CONSTEXPR14 base64_rfc2152_encoder(callback_type callback_)
: ibase64_encoder(etl::base64::character_set_1(), etl::base64::Padding::No_Padding, output_buffer, Buffer_Size, callback_)
, output_buffer()
{
}
//*************************************************************************
/// Calculate the required output encode buffer size.
//*************************************************************************
ETL_NODISCARD
static
ETL_CONSTEXPR14 size_t safe_output_buffer_size(size_t input_length)
{
return ibase64_encoder::encoded_size(input_length, etl::base64::Padding::No_Padding);
}
private:
/// The internal output buffer.
char output_buffer[Buffer_Size];
};
//*************************************************************************
/// Base64 RFC-3501 Encoder
//*************************************************************************
template <size_t Buffer_Size = etl::base64::Min_Encode_Buffer_Size>
class base64_rfc3501_encoder : public ibase64_encoder
{
public:
ETL_STATIC_ASSERT((Buffer_Size >= etl::base64::Min_Encode_Buffer_Size), "Buffer size must be greater than etl::base64::Min_Encode_Buffer_Size");
ETL_STATIC_ASSERT(((Buffer_Size % etl::base64::Min_Encode_Buffer_Size) == 0),
"Buffer size must be a multiple of etl::base64::Min_Encode_Buffer_Size");
//*************************************************************************
/// Base64 RFC-3501 constructor.
//*************************************************************************
ETL_CONSTEXPR14 base64_rfc3501_encoder()
: ibase64_encoder(etl::base64::character_set_3(), etl::base64::Padding::No_Padding, output_buffer, Buffer_Size, callback_type())
, output_buffer()
{
}
//*************************************************************************
/// Base64 RFC-3501 constructor.
//*************************************************************************
ETL_CONSTEXPR14 base64_rfc3501_encoder(callback_type callback_)
: ibase64_encoder(etl::base64::character_set_3(), etl::base64::Padding::No_Padding, output_buffer, Buffer_Size, callback_)
, output_buffer()
{
}
//*************************************************************************
/// Calculate the required output encode buffer size.
//*************************************************************************
ETL_NODISCARD
static
ETL_CONSTEXPR14 size_t safe_output_buffer_size(size_t input_length)
{
return ibase64_encoder::encoded_size(input_length, etl::base64::Padding::No_Padding);
}
private:
/// The internal output buffer.
char output_buffer[Buffer_Size];
};
//*************************************************************************
/// Base64 RFC-4648 Encoder
//*************************************************************************
template <size_t Buffer_Size = etl::base64::Min_Encode_Buffer_Size>
class base64_rfc4648_encoder : public ibase64_encoder
{
public:
ETL_STATIC_ASSERT((Buffer_Size >= etl::base64::Min_Encode_Buffer_Size), "Buffer size must be greater than etl::base64::Min_Encode_Buffer_Size");
ETL_STATIC_ASSERT(((Buffer_Size % etl::base64::Min_Encode_Buffer_Size) == 0),
"Buffer size must be a multiple of etl::base64::Min_Encode_Buffer_Size");
//*************************************************************************
/// Base64 RFC-4648 constructor.
//*************************************************************************
ETL_CONSTEXPR14 base64_rfc4648_encoder()
: ibase64_encoder(etl::base64::character_set_1(), etl::base64::Padding::No_Padding, output_buffer, Buffer_Size, callback_type())
, output_buffer()
{
}
//*************************************************************************
/// Base64 RFC-4648 constructor.
//*************************************************************************
ETL_CONSTEXPR14 base64_rfc4648_encoder(callback_type callback_)
: ibase64_encoder(etl::base64::character_set_1(), etl::base64::Padding::No_Padding, output_buffer, Buffer_Size, callback_)
, output_buffer()
{
}
//*************************************************************************
/// Calculate the required output encode buffer size.
//*************************************************************************
ETL_NODISCARD
static
ETL_CONSTEXPR14 size_t safe_output_buffer_size(size_t input_length)
{
return ibase64_encoder::encoded_size(input_length, etl::base64::Padding::No_Padding);
}
private:
/// The internal output buffer.
char output_buffer[Buffer_Size];
};
//*************************************************************************
/// Base64 RFC-4648-Padding Encoder
//*************************************************************************
template <size_t Buffer_Size = etl::base64::Min_Encode_Buffer_Size>
class base64_rfc4648_padding_encoder : public ibase64_encoder
{
public:
ETL_STATIC_ASSERT((Buffer_Size >= etl::base64::Min_Encode_Buffer_Size), "Buffer size must be greater than etl::base64::Min_Encode_Buffer_Size");
ETL_STATIC_ASSERT(((Buffer_Size % etl::base64::Min_Encode_Buffer_Size) == 0),
"Buffer size must be a multiple of etl::base64::Min_Encode_Buffer_Size");
//*************************************************************************
/// Base64 RFC-4648-Padding constructor.
//*************************************************************************
ETL_CONSTEXPR14 base64_rfc4648_padding_encoder()
: ibase64_encoder(etl::base64::character_set_1(), etl::base64::Padding::Use_Padding, output_buffer, Buffer_Size, callback_type())
, output_buffer()
{
}
//*************************************************************************
/// Base64 RFC-4648-Padding constructor.
//*************************************************************************
ETL_CONSTEXPR14 base64_rfc4648_padding_encoder(callback_type callback_)
: ibase64_encoder(etl::base64::character_set_1(), etl::base64::Padding::Use_Padding, output_buffer, Buffer_Size, callback_)
, output_buffer()
{
}
//*************************************************************************
/// Calculate the required output encode buffer size.
//*************************************************************************
ETL_NODISCARD
static
ETL_CONSTEXPR14 size_t safe_output_buffer_size(size_t input_length)
{
return ibase64_encoder::encoded_size(input_length, etl::base64::Padding::Use_Padding);
}
private:
/// The internal output buffer.
char output_buffer[Buffer_Size];
};
//*************************************************************************
/// Base64 RFC-4648-URL Encoder
//*************************************************************************
template <size_t Buffer_Size = etl::base64::Min_Encode_Buffer_Size>
class base64_rfc4648_url_encoder : public ibase64_encoder
{
public:
ETL_STATIC_ASSERT((Buffer_Size >= etl::base64::Min_Encode_Buffer_Size), "Buffer size must be greater than etl::base64::Min_Encode_Buffer_Size");
ETL_STATIC_ASSERT(((Buffer_Size % etl::base64::Min_Encode_Buffer_Size) == 0),
"Buffer size must be a multiple of etl::base64::Min_Encode_Buffer_Size");
//*************************************************************************
/// Base64 RFC-4648-URL constructor.
//*************************************************************************
ETL_CONSTEXPR14 base64_rfc4648_url_encoder()
: ibase64_encoder(etl::base64::character_set_2(), etl::base64::Padding::No_Padding, output_buffer, Buffer_Size, callback_type())
, output_buffer()
{
}
//*************************************************************************
/// Base64 RFC-4648-URL constructor.
//*************************************************************************
ETL_CONSTEXPR14 base64_rfc4648_url_encoder(callback_type callback_)
: ibase64_encoder(etl::base64::character_set_2(), etl::base64::Padding::No_Padding, output_buffer, Buffer_Size, callback_)
, output_buffer()
{
}
//*************************************************************************
/// Calculate the required output encode buffer size.
//*************************************************************************
ETL_NODISCARD
static
ETL_CONSTEXPR14 size_t safe_output_buffer_size(size_t input_length)
{
return ibase64_encoder::encoded_size(input_length, etl::base64::Padding::No_Padding);
}
private:
/// The internal output buffer.
char output_buffer[Buffer_Size];
};
//*************************************************************************
/// Base64 RFC-4648-URL_Padding Encoder
//*************************************************************************
template <size_t Buffer_Size = etl::base64::Min_Encode_Buffer_Size>
class base64_rfc4648_url_padding_encoder : public ibase64_encoder
{
public:
ETL_STATIC_ASSERT((Buffer_Size >= etl::base64::Min_Encode_Buffer_Size), "Buffer size must be greater than etl::base64::Min_Encode_Buffer_Size");
ETL_STATIC_ASSERT(((Buffer_Size % etl::base64::Min_Encode_Buffer_Size) == 0),
"Buffer size must be a multiple of etl::base64::Min_Encode_Buffer_Size");
//*************************************************************************
/// Base64 RFC-4648-URL constructor.
//*************************************************************************
ETL_CONSTEXPR14 base64_rfc4648_url_padding_encoder()
: ibase64_encoder(etl::base64::character_set_2(), etl::base64::Padding::Use_Padding, output_buffer, Buffer_Size, callback_type())
, output_buffer()
{
}
//*************************************************************************
/// Base64 RFC-4648-URL constructor.
//*************************************************************************
ETL_CONSTEXPR14 base64_rfc4648_url_padding_encoder(callback_type callback_)
: ibase64_encoder(etl::base64::character_set_2(), etl::base64::Padding::Use_Padding, output_buffer, Buffer_Size, callback_)
, output_buffer()
{
}
//*************************************************************************
/// Calculate the required output encode buffer size.
//*************************************************************************
ETL_NODISCARD
static
ETL_CONSTEXPR14 size_t safe_output_buffer_size(size_t input_length)
{
return ibase64_encoder::encoded_size(input_length, etl::base64::Padding::Use_Padding);
}
private:
/// The internal output buffer.
char output_buffer[Buffer_Size];
};
} // namespace etl
#undef ETL_IS_TYPE_8_BIT_INTEGRAL
#undef ETL_IS_ITERATOR_TYPE_8_BIT_INTEGRAL
#endif

Some files were not shown because too many files have changed in this diff Show More