From 496c8a2e7c0b89d2f00294e612c9e9f8d093539c Mon Sep 17 00:00:00 2001 From: Saku Glumoff Date: Tue, 4 Jun 2024 20:17:41 +0300 Subject: [PATCH 1/5] 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`. --- include/etl/exception.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/etl/exception.h b/include/etl/exception.h index 90ab6e72..49e6adca 100644 --- a/include/etl/exception.h +++ b/include/etl/exception.h @@ -100,7 +100,7 @@ namespace etl //*************************************************************************** /// Gets the line for the exception. - /// \return const char* to the line. + /// \return int as line number. //*************************************************************************** ETL_CONSTEXPR numeric_type line_number() const From 9247c14e825e16c7beebb4f2252a7a8ccabd2e45 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 5 Jun 2024 14:03:37 +0100 Subject: [PATCH 2/5] Changed std algorithms to etl --- include/etl/algorithm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/etl/algorithm.h b/include/etl/algorithm.h index 844bc12f..59f8b9be 100644 --- a/include/etl/algorithm.h +++ b/include/etl/algorithm.h @@ -1293,7 +1293,7 @@ namespace etl TIterator next = middle; TIterator result = first; - std::advance(result, std::distance(middle, last)); + etl::advance(result, etl::distance(middle, last)); while (first != next) { From bb71b60496c4d7be2e9a8af70b2dd9bdfc7d314d Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 5 Jun 2024 17:33:16 +0100 Subject: [PATCH 3/5] Updated version and release --- include/etl/version.h | 2 +- library.json | 2 +- library.properties | 2 +- support/Release notes.txt | 5 +++++ version.txt | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/include/etl/version.h b/include/etl/version.h index adf1dd60..03eeaa26 100644 --- a/include/etl/version.h +++ b/include/etl/version.h @@ -40,7 +40,7 @@ SOFTWARE. #define ETL_VERSION_MAJOR 20 #define ETL_VERSION_MINOR 38 -#define ETL_VERSION_PATCH 16 +#define ETL_VERSION_PATCH 17 #define ETL_VERSION ETL_STRING(ETL_VERSION_MAJOR) "." ETL_STRING(ETL_VERSION_MINOR) "." ETL_STRING(ETL_VERSION_PATCH) #define ETL_VERSION_W ETL_WIDE_STRING(ETL_VERSION_MAJOR) L"." ETL_WIDE_STRING(ETL_VERSION_MINOR) L"." ETL_WIDE_STRING(ETL_VERSION_PATCH) diff --git a/library.json b/library.json index 38ab6fad..a2c651b0 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "Embedded Template Library", - "version": "20.38.16", + "version": "20.38.17", "authors": { "name": "John Wellbelove", "email": "john.wellbelove@etlcpp.com" diff --git a/library.properties b/library.properties index bf2326c9..5ce03aeb 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Embedded Template Library -version=20.38.16 +version=20.38.17 author= John Wellbelove maintainer=John Wellbelove license=MIT diff --git a/support/Release notes.txt b/support/Release notes.txt index 2d2cda54..cc50700d 100644 --- a/support/Release notes.txt +++ b/support/Release notes.txt @@ -1,4 +1,9 @@ =============================================================================== +20.38.17 + +#895 Removed std algorithm calls from algorithm.h + +=============================================================================== 20.38.16 Fixes: diff --git a/version.txt b/version.txt index 13e96238..0a76ef65 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -20.38.16 +20.38.17 From 6ced0630a948f5b3afe62ae82e135b7500ac8100 Mon Sep 17 00:00:00 2001 From: Tigran Khachatryan <39616689+tigran2008@users.noreply.github.com> Date: Tue, 11 Jun 2024 16:43:59 +0400 Subject: [PATCH 4/5] 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 --- include/etl/generators/type_traits_generator.h | 11 +++++++++++ include/etl/type_traits.h | 11 +++++++++++ test/test_type_traits.cpp | 12 ++++++++++++ 3 files changed, 34 insertions(+) diff --git a/include/etl/generators/type_traits_generator.h b/include/etl/generators/type_traits_generator.h index 35db7ea6..c1d73d10 100644 --- a/include/etl/generators/type_traits_generator.h +++ b/include/etl/generators/type_traits_generator.h @@ -2295,6 +2295,17 @@ typedef integral_constant true_type; template using signed_type_t = typename signed_type::type; #endif + +//********************************************* +// type_identity + +template +struct type_identity { typedef T type; }; + +#if ETL_USING_CPP11 + template + using type_identity_t = typename type_identity::type; +#endif } // Helper macros diff --git a/include/etl/type_traits.h b/include/etl/type_traits.h index 93730e5a..1a40f026 100644 --- a/include/etl/type_traits.h +++ b/include/etl/type_traits.h @@ -2288,6 +2288,17 @@ typedef integral_constant true_type; template using signed_type_t = typename signed_type::type; #endif + +//********************************************* +// type_identity + +template +struct type_identity { typedef T type; }; + +#if ETL_USING_CPP11 + template + using type_identity_t = typename type_identity::type; +#endif } // Helper macros diff --git a/test/test_type_traits.cpp b/test/test_type_traits.cpp index 129a5fa8..fc9e7070 100644 --- a/test/test_type_traits.cpp +++ b/test/test_type_traits.cpp @@ -122,6 +122,13 @@ namespace NotDefaultConstructible(NotDefaultConstructible&&) = delete; NotDefaultConstructible& operator =(NotDefaultConstructible&) = delete; }; + + // A function to test etl::type_identity. + template + T type_identity_test_add(T first, typename etl::type_identity::type second) + { + return first + second; + } } // Definitions for when the STL and compiler built-ins are not available. @@ -1320,4 +1327,9 @@ namespace CHECK_FALSE(bool(etl::is_base_of_all::value)); #endif } + + //************************************************************************* + TEST(test_type_identity) { + CHECK_CLOSE(type_identity_test_add(1.5f, 2), 3.5f, 0.01f); + } } From 76f2cfb4a2c7615ff57e3ff5ba60d0d9fbaf39c1 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Tue, 11 Jun 2024 13:47:43 +0100 Subject: [PATCH 5/5] Minor format change --- test/test_type_traits.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test_type_traits.cpp b/test/test_type_traits.cpp index fc9e7070..84a3a14b 100644 --- a/test/test_type_traits.cpp +++ b/test/test_type_traits.cpp @@ -1329,7 +1329,8 @@ namespace } //************************************************************************* - TEST(test_type_identity) { + TEST(test_type_identity) + { CHECK_CLOSE(type_identity_test_add(1.5f, 2), 3.5f, 0.01f); } }