From 77428f9d81db8b895816ada58d4437e0bc37cdf1 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 26 May 2019 14:04:36 +0100 Subject: [PATCH 1/2] Merge remote-tracking branch 'origin/development' --- include/etl/generate_smallest.bat | 2 +- include/etl/largest.h | 110 +++++++++++++++++++++++++++- include/etl/largest_generator.h | 110 +++++++++++++++++++++++++++- include/etl/smallest.h | 64 ++++++++++++++-- include/etl/smallest_generator.h | 64 ++++++++++++++-- include/etl/type_traits.h | 53 +++++++++----- include/etl/type_traits_generator.h | 43 ++++++++--- include/etl/version.h | 4 +- support/Release notes.txt | 5 ++ test/etl_profile.h | 1 + test/test_largest.cpp | 4 +- test/test_type_traits.cpp | 19 ++--- 12 files changed, 416 insertions(+), 63 deletions(-) diff --git a/include/etl/generate_smallest.bat b/include/etl/generate_smallest.bat index fe53e938..65e4edf9 100644 --- a/include/etl/generate_smallest.bat +++ b/include/etl/generate_smallest.bat @@ -1 +1 @@ -python -m cogapp -d -e -olargest.h -DNTypes=16 largest_generator.h +python -m cogapp -d -e -osmallest.h -DNTypes=16 smallest_generator.h diff --git a/include/etl/largest.h b/include/etl/largest.h index 4ab26e80..556db65b 100644 --- a/include/etl/largest.h +++ b/include/etl/largest.h @@ -61,8 +61,55 @@ SOFTWARE. #include "smallest.h" #include "static_assert.h" -namespace etl +namespace etl { +#if ETL_CPP11_SUPPORTED && !defined(ETL_LARGEST_TYPE_FORCE_CPP03) + //*************************************************************************** + /// Template to determine the largest type and size. + /// Defines 'value_type' which is the type of the largest parameter. + /// Defines 'size' which is the size of the largest parameter. + ///\ingroup largest + //*************************************************************************** + template + class largest_type + { + private: + + // Define 'largest_other' as 'largest_type' with all but the first parameter. + using largest_other = typename largest_type::type; + + public: + + // Set 'type' to be the largest of the first parameter and any of the others. + // This is recursive. + using type = typename etl::conditional<(etl::size_of() > etl::size_of()), // Boolean + T1, // TrueType + largest_other> // FalseType + ::type; // The largest type of the two. + + // The size of the largest type. + enum + { + size = etl::size_of() + }; + }; + + //*************************************************************************** + // Specialisation for one template parameter. + //*************************************************************************** + template + class largest_type + { + public: + + using type = T1; + + enum + { + size = etl::size_of() + }; + }; +#else //*************************************************************************** /// Template to determine the largest type and size. /// Supports up to 16 types. @@ -107,7 +154,48 @@ namespace etl size = sizeof(type) }; }; +#endif +#if ETL_CPP11_SUPPORTED && !defined(ETL_LARGEST_ALIGNMENT_FORCE_CPP03) + //*************************************************************************** + /// Template to determine the largest alignment. + /// Defines value which is the largest alignment of all the parameters. + ///\ingroup largest + //*************************************************************************** + template + struct largest_alignment + { + // Define 'largest_other' as 'largest_type' with all but the first parameter. + using largest_other = typename largest_alignment::type; + + // Set 'type' to be the largest of the first parameter and any of the others. + // This is recursive. + using type = typename etl::conditional<(etl::alignment_of::value > etl::alignment_of::value), // Boolean + T1, // TrueType + largest_other> // FalseType + ::type; // The largest type of the two. + + // The largest alignment. + enum + { + value = etl::alignment_of::value + }; + }; + + //*************************************************************************** + // Specialisation for one template parameter. + //*************************************************************************** + template + struct largest_alignment + { + typedef T1 type; + + enum + { + value = etl::alignment_of::value + }; + }; +#else //*************************************************************************** /// Template to determine the largest alignment. /// Supports up to 16 types. @@ -151,6 +239,7 @@ namespace etl value = etl::alignment_of::value }; }; +#endif //*************************************************************************** /// Defines a type that is as larger or larger than the specified type. @@ -203,6 +292,24 @@ namespace etl typedef typename etl::smallest_int_for_bits::bits + 1>::type type; }; +#if ETL_CPP11_SUPPORTED && !defined(ETL_LARGEST_FORCE_CPP03) + //*************************************************************************** + /// Template to determine the largest type, size and alignment. + /// Defines value which is the largest type, size and alignment of all the parameters. + ///\ingroup largest + //*************************************************************************** + template + struct largest + { + using type = typename etl::largest_type::type; + + enum + { + size = etl::largest_type::size, + alignment = etl::largest_alignment::value + }; + }; +#else //*************************************************************************** /// Template to determine the largest type, size and alignment. /// Supports up to 16 types. @@ -223,6 +330,7 @@ namespace etl alignment = etl::largest_alignment::value }; }; +#endif } #endif diff --git a/include/etl/largest_generator.h b/include/etl/largest_generator.h index 13b6d58d..0dd78c85 100644 --- a/include/etl/largest_generator.h +++ b/include/etl/largest_generator.h @@ -73,8 +73,55 @@ cog.outl("//******************************************************************** #include "smallest.h" #include "static_assert.h" -namespace etl +namespace etl { +#if ETL_CPP11_SUPPORTED && !defined(ETL_LARGEST_TYPE_FORCE_CPP03) + //*************************************************************************** + /// Template to determine the largest type and size. + /// Defines 'value_type' which is the type of the largest parameter. + /// Defines 'size' which is the size of the largest parameter. + ///\ingroup largest + //*************************************************************************** + template + class largest_type + { + private: + + // Define 'largest_other' as 'largest_type' with all but the first parameter. + using largest_other = typename largest_type::type; + + public: + + // Set 'type' to be the largest of the first parameter and any of the others. + // This is recursive. + using type = typename etl::conditional<(etl::size_of() > etl::size_of()), // Boolean + T1, // TrueType + largest_other> // FalseType + ::type; // The largest type of the two. + + // The size of the largest type. + enum + { + size = etl::size_of() + }; + }; + + //*************************************************************************** + // Specialisation for one template parameter. + //*************************************************************************** + template + class largest_type + { + public: + + using type = T1; + + enum + { + size = etl::size_of() + }; + }; +#else /*[[[cog import cog cog.outl("//***************************************************************************") @@ -137,7 +184,48 @@ namespace etl cog.outl("};") ]]]*/ /*[[[end]]]*/ +#endif +#if ETL_CPP11_SUPPORTED && !defined(ETL_LARGEST_ALIGNMENT_FORCE_CPP03) + //*************************************************************************** + /// Template to determine the largest alignment. + /// Defines value which is the largest alignment of all the parameters. + ///\ingroup largest + //*************************************************************************** + template + struct largest_alignment + { + // Define 'largest_other' as 'largest_type' with all but the first parameter. + using largest_other = typename largest_alignment::type; + + // Set 'type' to be the largest of the first parameter and any of the others. + // This is recursive. + using type = typename etl::conditional<(etl::alignment_of::value > etl::alignment_of::value), // Boolean + T1, // TrueType + largest_other> // FalseType + ::type; // The largest type of the two. + + // The largest alignment. + enum + { + value = etl::alignment_of::value + }; + }; + + //*************************************************************************** + // Specialisation for one template parameter. + //*************************************************************************** + template + struct largest_alignment + { + typedef T1 type; + + enum + { + value = etl::alignment_of::value + }; + }; +#else /*[[[cog import cog cog.outl("//***************************************************************************") @@ -199,6 +287,7 @@ namespace etl cog.outl("};") ]]]*/ /*[[[end]]]*/ +#endif //*************************************************************************** /// Defines a type that is as larger or larger than the specified type. @@ -251,6 +340,24 @@ namespace etl typedef typename etl::smallest_int_for_bits::bits + 1>::type type; }; +#if ETL_CPP11_SUPPORTED && !defined(ETL_LARGEST_FORCE_CPP03) + //*************************************************************************** + /// Template to determine the largest type, size and alignment. + /// Defines value which is the largest type, size and alignment of all the parameters. + ///\ingroup largest + //*************************************************************************** + template + struct largest + { + using type = typename etl::largest_type::type; + + enum + { + size = etl::largest_type::size, + alignment = etl::largest_alignment::value + }; + }; +#else /*[[[cog import cog cog.outl("//***************************************************************************") @@ -296,6 +403,7 @@ namespace etl cog.outl("};") ]]]*/ /*[[[end]]]*/ +#endif } #endif diff --git a/include/etl/smallest.h b/include/etl/smallest.h index 8b1337e1..b0e79020 100644 --- a/include/etl/smallest.h +++ b/include/etl/smallest.h @@ -63,6 +63,53 @@ SOFTWARE. namespace etl { +#if ETL_CPP11_SUPPORTED && !defined(ETL_SMALLEST_TYPE_FORCE_CPP03) + //*************************************************************************** + /// Template to determine the largest type and size. + /// Defines 'value_type' which is the type of the largest parameter. + /// Defines 'size' which is the size of the largest parameter. + ///\ingroup largest + //*************************************************************************** + template + class smallest_type + { + private: + + // Define 'smallest_other' as 'smallest_type' with all but the first parameter. + using smallest_other = typename smallest_type::type; + + public: + + // Set 'type' to be the smallest of the first parameter and any of the others. + // This is recursive. + using type = typename etl::conditional<(etl::size_of() < etl::size_of()), // Boolean + T1, // TrueType + smallest_other> // FalseType + ::type; // The smallest type of the two. + + // The size of the smallest type. + enum + { + size = etl::size_of() + }; + }; + + //*************************************************************************** + // Specialisation for one template parameter. + //*************************************************************************** + template + class smallest_type + { + public: + + using type = T1; + + enum + { + size = etl::size_of() + }; + }; +#else //*************************************************************************** /// Template to determine the smallest type and size. /// Supports up to 16 types. @@ -131,7 +178,8 @@ namespace etl size = sizeof(type) }; }; - +#endif + namespace private_smallest { //************************************************************************* @@ -139,7 +187,7 @@ namespace etl //************************************************************************* template struct best_fit_uint_type; - + //************************************************************************* // Less than or equal to 8 bits. //************************************************************************* @@ -220,7 +268,7 @@ namespace etl } //*************************************************************************** - /// Template to determine the smallest unsigned int type that can contain a + /// Template to determine the smallest unsigned int type that can contain a /// value with the specified number of bits. /// Defines 'type' which is the type of the smallest unsigned integer. ///\ingroup smallest @@ -229,9 +277,9 @@ namespace etl struct smallest_uint_for_bits { private: - + // Determines the index of the best unsigned type for the required number of bits. - static const int TYPE_INDEX = ((NBITS > 8) ? 1 : 0) + + static const int TYPE_INDEX = ((NBITS > 8) ? 1 : 0) + ((NBITS > 16) ? 1 : 0) + ((NBITS > 32) ? 1 : 0); @@ -241,7 +289,7 @@ namespace etl }; //*************************************************************************** - /// Template to determine the smallest signed int type that can contain a + /// Template to determine the smallest signed int type that can contain a /// value with the specified number of bits. /// Defines 'type' which is the type of the smallest signed integer. ///\ingroup smallest @@ -274,7 +322,7 @@ namespace etl // Determines the index of the best unsigned type for the required value. static const int TYPE_INDEX = ((VALUE > UINT_LEAST8_MAX) ? 1 : 0) + - ((VALUE > UINT16_MAX) ? 1 : 0) + + ((VALUE > UINT16_MAX) ? 1 : 0) + ((VALUE > UINT32_MAX) ? 1 : 0); public: @@ -294,7 +342,7 @@ namespace etl private: // Determines the index of the best signed type for the required value. - static const int TYPE_INDEX = (((VALUE > INT_LEAST8_MAX) || (VALUE < INT_LEAST8_MIN)) ? 1 : 0) + + static const int TYPE_INDEX = (((VALUE > INT_LEAST8_MAX) || (VALUE < INT_LEAST8_MIN)) ? 1 : 0) + (((VALUE > INT16_MAX) || (VALUE < INT16_MIN)) ? 1 : 0) + (((VALUE > INT32_MAX) || (VALUE < INT32_MIN)) ? 1 : 0); diff --git a/include/etl/smallest_generator.h b/include/etl/smallest_generator.h index dcc955a2..3b5c6d2c 100644 --- a/include/etl/smallest_generator.h +++ b/include/etl/smallest_generator.h @@ -75,6 +75,53 @@ cog.outl("//******************************************************************** namespace etl { +#if ETL_CPP11_SUPPORTED && !defined(ETL_SMALLEST_TYPE_FORCE_CPP03) + //*************************************************************************** + /// Template to determine the largest type and size. + /// Defines 'value_type' which is the type of the largest parameter. + /// Defines 'size' which is the size of the largest parameter. + ///\ingroup largest + //*************************************************************************** + template + class smallest_type + { + private: + + // Define 'smallest_other' as 'smallest_type' with all but the first parameter. + using smallest_other = typename smallest_type::type; + + public: + + // Set 'type' to be the smallest of the first parameter and any of the others. + // This is recursive. + using type = typename etl::conditional<(etl::size_of() < etl::size_of()), // Boolean + T1, // TrueType + smallest_other> // FalseType + ::type; // The smallest type of the two. + + // The size of the smallest type. + enum + { + size = etl::size_of() + }; + }; + + //*************************************************************************** + // Specialisation for one template parameter. + //*************************************************************************** + template + class smallest_type + { + public: + + using type = T1; + + enum + { + size = etl::size_of() + }; + }; +#else /*[[[cog import cog cog.outl("//***************************************************************************") @@ -161,7 +208,8 @@ namespace etl cog.outl("};") ]]]*/ /*[[[end]]]*/ - +#endif + namespace private_smallest { //************************************************************************* @@ -169,7 +217,7 @@ namespace etl //************************************************************************* template struct best_fit_uint_type; - + //************************************************************************* // Less than or equal to 8 bits. //************************************************************************* @@ -250,7 +298,7 @@ namespace etl } //*************************************************************************** - /// Template to determine the smallest unsigned int type that can contain a + /// Template to determine the smallest unsigned int type that can contain a /// value with the specified number of bits. /// Defines 'type' which is the type of the smallest unsigned integer. ///\ingroup smallest @@ -259,9 +307,9 @@ namespace etl struct smallest_uint_for_bits { private: - + // Determines the index of the best unsigned type for the required number of bits. - static const int TYPE_INDEX = ((NBITS > 8) ? 1 : 0) + + static const int TYPE_INDEX = ((NBITS > 8) ? 1 : 0) + ((NBITS > 16) ? 1 : 0) + ((NBITS > 32) ? 1 : 0); @@ -271,7 +319,7 @@ namespace etl }; //*************************************************************************** - /// Template to determine the smallest signed int type that can contain a + /// Template to determine the smallest signed int type that can contain a /// value with the specified number of bits. /// Defines 'type' which is the type of the smallest signed integer. ///\ingroup smallest @@ -304,7 +352,7 @@ namespace etl // Determines the index of the best unsigned type for the required value. static const int TYPE_INDEX = ((VALUE > UINT_LEAST8_MAX) ? 1 : 0) + - ((VALUE > UINT16_MAX) ? 1 : 0) + + ((VALUE > UINT16_MAX) ? 1 : 0) + ((VALUE > UINT32_MAX) ? 1 : 0); public: @@ -324,7 +372,7 @@ namespace etl private: // Determines the index of the best signed type for the required value. - static const int TYPE_INDEX = (((VALUE > INT_LEAST8_MAX) || (VALUE < INT_LEAST8_MIN)) ? 1 : 0) + + static const int TYPE_INDEX = (((VALUE > INT_LEAST8_MAX) || (VALUE < INT_LEAST8_MIN)) ? 1 : 0) + (((VALUE > INT16_MAX) || (VALUE < INT16_MIN)) ? 1 : 0) + (((VALUE > INT32_MAX) || (VALUE < INT32_MIN)) ? 1 : 0); diff --git a/include/etl/type_traits.h b/include/etl/type_traits.h index 359ed911..77216e90 100644 --- a/include/etl/type_traits.h +++ b/include/etl/type_traits.h @@ -487,19 +487,40 @@ namespace etl ///\ingroup type_traits template <> struct alignment_of : integral_constant {}; +#if ETL_CPP11_SUPPORTED + + //***************************************************************************" + /// Template to determine if a type is one of a specified list. + ///\ingroup types + //***************************************************************************" + template + struct is_one_of + { + static const bool value = etl::is_same::value || + etl::is_one_of::value; + }; + + template + struct is_one_of + { + static const bool value = etl::is_same::value; + }; + +#else + //*************************************************************************** /// Template to determine if a type is one of a specified list. ///\ingroup types //*************************************************************************** template struct is_one_of { - static const bool value = + static const bool value = etl::is_same::value || etl::is_same::value || etl::is_same::value || @@ -519,6 +540,8 @@ namespace etl etl::is_same::value; }; +#endif + //*************************************************************************** // A set of templates to allow related types to be derived. //*************************************************************************** @@ -597,23 +620,19 @@ namespace etl //*************************************************************************** // size_of //*************************************************************************** +#if ETL_CPP11_SUPPORTED template - struct size_of + constexpr size_t size_of() { - enum - { - size = sizeof(T) - }; - }; + return sizeof(T); + } template <> - struct size_of + constexpr size_t size_of() { - enum - { - size = 1 - }; - }; + return 1; + } +#endif } #endif diff --git a/include/etl/type_traits_generator.h b/include/etl/type_traits_generator.h index c45d1ea3..b1cff3eb 100644 --- a/include/etl/type_traits_generator.h +++ b/include/etl/type_traits_generator.h @@ -499,6 +499,27 @@ namespace etl ///\ingroup type_traits template <> struct alignment_of : integral_constant {}; +#if ETL_CPP11_SUPPORTED + + //***************************************************************************" + /// Template to determine if a type is one of a specified list. + ///\ingroup types + //***************************************************************************" + template + struct is_one_of + { + static const bool value = etl::is_same::value || + etl::is_one_of::value; + }; + + template + struct is_one_of + { + static const bool value = etl::is_same::value; + }; + +#else + /*[[[cog import cog cog.outl("//***************************************************************************") @@ -524,6 +545,8 @@ namespace etl ]]]*/ /*[[[end]]]*/ +#endif + //*************************************************************************** // A set of templates to allow related types to be derived. //*************************************************************************** @@ -602,23 +625,19 @@ namespace etl //*************************************************************************** // size_of //*************************************************************************** +#if ETL_CPP11_SUPPORTED template - struct size_of + constexpr size_t size_of() { - enum - { - size = sizeof(T) - }; - }; + return sizeof(T); + } template <> - struct size_of + constexpr size_t size_of() { - enum - { - size = 1 - }; - }; + return 1; + } +#endif } #endif diff --git a/include/etl/version.h b/include/etl/version.h index 4d6f366a..970ebd80 100644 --- a/include/etl/version.h +++ b/include/etl/version.h @@ -38,8 +38,8 @@ SOFTWARE. ///\ingroup utilities #define ETL_VERSION_MAJOR 14 -#define ETL_VERSION_MINOR 24 -#define ETL_VERSION_PATCH 2 +#define ETL_VERSION_MINOR 25 +#define ETL_VERSION_PATCH 0 #define ETL_VERSION ETL_STRINGIFY(ETL_VERSION_MAJOR) ETL_STRINGIFY(ETL_VERSION_MINOR) ETL_STRINGIFY(ETL_VERSION_PATCH) #define ETL_VERSION_W ETL_WIDE_STRING(ETL_CONCAT(ETL_CONCAT(ETL_VERSION_MAJOR, ETL_VERSION_MINOR), ETL_VERSION_PATCH)) diff --git a/support/Release notes.txt b/support/Release notes.txt index 1578bab8..0d23f4a8 100644 --- a/support/Release notes.txt +++ b/support/Release notes.txt @@ -1,3 +1,8 @@ +=============================================================================== +14.25.0 +Added variadic template versions of etl::largest, etl::largest_type, +etl::largest_alignment and etl::smallest + =============================================================================== 14.24.2 Fixed bug in 'vector of pointers' move constructor. diff --git a/test/etl_profile.h b/test/etl_profile.h index ffcbee75..4fd138ab 100644 --- a/test/etl_profile.h +++ b/test/etl_profile.h @@ -86,6 +86,7 @@ SOFTWARE. //#define ETL_QUEUE_ISR_FORCE_CPP03 //#define ETL_QUEUE_LOCKED_FORCE_CPP03 //#define ETL_OPTIONAL_FORCE_CPP03 +//#define ETL_LARGEST_TYPE_FORCE_CPP03 #ifdef _MSC_VER #include "etl/profiles/msvc_x86.h" diff --git a/test/test_largest.cpp b/test/test_largest.cpp index f420ede1..932015f6 100644 --- a/test/test_largest.cpp +++ b/test/test_largest.cpp @@ -33,7 +33,7 @@ SOFTWARE. #include namespace -{ +{ SUITE(test_largest) { //************************************************************************* @@ -92,7 +92,7 @@ namespace struct S1 { char a; char b; char c; }; struct S2 { char a; short b; char c; }; struct S3 { int a; short b; char c; }; - + size_t size = etl::largest_alignment::value; CHECK_EQUAL(std::alignment_of::value, size); diff --git a/test/test_type_traits.cpp b/test/test_type_traits.cpp index 630dd230..b1055e22 100644 --- a/test/test_type_traits.cpp +++ b/test/test_type_traits.cpp @@ -49,13 +49,10 @@ namespace namespace etl { template <> - struct size_of + constexpr size_t size_of() { - enum - { - size = 20 - }; - }; + return 20; + } } namespace @@ -749,10 +746,10 @@ namespace //************************************************************************* TEST(size_of) { - CHECK_EQUAL(1, etl::size_of::size); - CHECK_EQUAL(1, etl::size_of::size); - CHECK_EQUAL(2, etl::size_of::size); - CHECK_EQUAL(4, etl::size_of::size); - CHECK_EQUAL(20, etl::size_of::size); + CHECK_EQUAL(1, etl::size_of()); + CHECK_EQUAL(1, etl::size_of()); + CHECK_EQUAL(2, etl::size_of()); + CHECK_EQUAL(4, etl::size_of()); + CHECK_EQUAL(20, etl::size_of()); } } From c4d4e305c074f3a27bb69df61e74824bfb5d7f82 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Tue, 28 May 2019 18:28:09 +0100 Subject: [PATCH 2/2] Simplified 'to_string' templates --- include/etl/to_string.h | 12 ++++++------ include/etl/to_u16string.h | 12 ++++++------ include/etl/to_u32string.h | 12 ++++++------ include/etl/to_wstring.h | 12 ++++++------ include/etl/version.h | 2 +- support/Release notes.txt | 4 ++++ 6 files changed, 29 insertions(+), 25 deletions(-) diff --git a/include/etl/to_string.h b/include/etl/to_string.h index 9bb0e6a1..575cb452 100644 --- a/include/etl/to_string.h +++ b/include/etl/to_string.h @@ -46,21 +46,21 @@ namespace etl //*************************************************************************** /// Default format spec. //*************************************************************************** - template - const etl::istring& to_string(const T value, etl::string& str, const bool append = false) + template + const etl::istring& to_string(const T value, etl::istring& str, const bool append = false) { etl::format_spec format; - return private_to_string::to_string(value, static_cast(str), format, append); + return private_to_string::to_string(value, str, format, append); } //*************************************************************************** /// Supplied format spec.. //*************************************************************************** - template - const etl::istring& to_string(const T value, etl::string& str, const etl::format_spec& format, const bool append = false) + template + const etl::istring& to_string(const T value, etl::istring& str, const etl::format_spec& format, const bool append = false) { - return private_to_string::to_string(value, static_cast(str), format, append); + return private_to_string::to_string(value, str, format, append); } } diff --git a/include/etl/to_u16string.h b/include/etl/to_u16string.h index be9dcbd8..b87eb7e4 100644 --- a/include/etl/to_u16string.h +++ b/include/etl/to_u16string.h @@ -44,21 +44,21 @@ namespace etl //*************************************************************************** /// Default format spec. //*************************************************************************** - template - const etl::iu16string& to_string(const T value, etl::u16string& str, const bool append = false) + template + const etl::iu16string& to_string(const T value, etl::iu16string& str, const bool append = false) { etl::u16format_spec format; - return private_to_string::to_string(value, static_cast(str), format, append); + return private_to_string::to_string(value, str, format, append); } //*************************************************************************** /// Supplied format spec. //*************************************************************************** - template - const etl::iu16string& to_string(const T value, etl::u16string& str, const etl::u16format_spec& format, const bool append = false) + template + const etl::iu16string& to_string(const T value, etl::iu16string& str, const etl::u16format_spec& format, const bool append = false) { - return private_to_string::to_string(value, static_cast(str), format, append); + return private_to_string::to_string(value, str, format, append); } } diff --git a/include/etl/to_u32string.h b/include/etl/to_u32string.h index 8b95a367..88b7e3cf 100644 --- a/include/etl/to_u32string.h +++ b/include/etl/to_u32string.h @@ -44,21 +44,21 @@ namespace etl //*************************************************************************** /// Default format spec. //*************************************************************************** - template - const etl::iu32string& to_string(const T value, etl::u32string& str, const bool append = false) + template + const etl::iu32string& to_string(const T value, etl::iu32string& str, const bool append = false) { etl::u32format_spec format; - return private_to_string::to_string(value, static_cast(str), format, append); + return private_to_string::to_string(value, str, format, append); } //*************************************************************************** /// Supplied format spec. //*************************************************************************** - template - const etl::iu32string& to_string(const T value, etl::u32string& str, const etl::u32format_spec& format, const bool append = false) + template + const etl::iu32string& to_string(const T value, etl::iu32string& str, const etl::u32format_spec& format, const bool append = false) { - return private_to_string::to_string(value, static_cast(str), format, append); + return private_to_string::to_string(value, str, format, append); } } diff --git a/include/etl/to_wstring.h b/include/etl/to_wstring.h index ad7283f2..fcbe728a 100644 --- a/include/etl/to_wstring.h +++ b/include/etl/to_wstring.h @@ -44,21 +44,21 @@ namespace etl //*************************************************************************** /// Default format spec. //*************************************************************************** - template - const etl::iwstring& to_string(const T value, etl::wstring& str, const bool append = false) + template + const etl::iwstring& to_string(const T value, etl::iwstring& str, const bool append = false) { etl::wformat_spec format; - return private_to_string::to_string(value, static_cast(str), format, append); + return private_to_string::to_string(value, str, format, append); } //*************************************************************************** /// Supplied format spec. //*************************************************************************** - template - const etl::iwstring& to_string(const T value, etl::wstring& str, const etl::wformat_spec& format, const bool append = false) + template + const etl::iwstring& to_string(const T value, etl::iwstring& str, const etl::wformat_spec& format, const bool append = false) { - return private_to_string::to_string(value, static_cast(str), format, append); + return private_to_string::to_string(value, str, format, append); } } diff --git a/include/etl/version.h b/include/etl/version.h index 269c6153..f16dc919 100644 --- a/include/etl/version.h +++ b/include/etl/version.h @@ -39,7 +39,7 @@ SOFTWARE. #define ETL_VERSION_MAJOR 14 #define ETL_VERSION_MINOR 26 -#define ETL_VERSION_PATCH 0 +#define ETL_VERSION_PATCH 1 #define ETL_VERSION ETL_STRINGIFY(ETL_VERSION_MAJOR) ETL_STRINGIFY(ETL_VERSION_MINOR) ETL_STRINGIFY(ETL_VERSION_PATCH) #define ETL_VERSION_W ETL_WIDE_STRING(ETL_CONCAT(ETL_CONCAT(ETL_VERSION_MAJOR, ETL_VERSION_MINOR), ETL_VERSION_PATCH)) diff --git a/support/Release notes.txt b/support/Release notes.txt index 5ac382ca..9f49f169 100644 --- a/support/Release notes.txt +++ b/support/Release notes.txt @@ -1,3 +1,7 @@ +=============================================================================== +14.26.1 +Simplified 'to_string' templates. + =============================================================================== 14.26.0 Simplified message framework internal code.