From 97d1ba950092760e2632cbe90efa252506a67a9e Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sat, 7 Sep 2024 18:41:51 +0100 Subject: [PATCH] Sync to 20.39.4 --- library.json | 2 +- library.properties | 2 +- src/etl/algorithm.h | 2 + src/etl/array.h | 2 +- src/etl/base64.h | 14 +- src/etl/base64_decoder.h | 26 +- src/etl/base64_encoder.h | 26 +- src/etl/deque.h | 2 +- src/etl/flat_map.h | 2 +- src/etl/flat_multimap.h | 2 +- src/etl/flat_multiset.h | 2 +- src/etl/flat_set.h | 2 +- src/etl/forward_list.h | 2 +- src/etl/generators/type_traits_generator.h | 60 ++- src/etl/histogram.h | 4 +- src/etl/indirect_vector.h | 3 +- src/etl/integral_limits.h | 63 +++ src/etl/intrusive_forward_list.h | 4 +- src/etl/intrusive_list.h | 4 +- src/etl/list.h | 2 +- src/etl/map.h | 2 +- src/etl/multi_span.h | 22 +- src/etl/multimap.h | 2 +- src/etl/multiset.h | 2 +- src/etl/observer.h | 172 ++++++--- src/etl/platform.h | 31 +- src/etl/private/delegate_cpp03.h | 104 ++++- src/etl/private/delegate_cpp11.h | 56 ++- .../private/diagnostic_cxx_20_compat_push.h | 2 +- .../determine_compiler_language_support.h | 6 + src/etl/queue.h | 2 +- src/etl/reference_flat_map.h | 2 +- src/etl/reference_flat_multimap.h | 2 +- src/etl/reference_flat_multiset.h | 2 +- src/etl/reference_flat_set.h | 2 +- src/etl/result.h | 4 +- src/etl/set.h | 2 +- src/etl/stack.h | 2 +- src/etl/type_traits.h | 63 ++- src/etl/unaligned_type.h | 365 ++++++++++++------ src/etl/unordered_map.h | 2 +- src/etl/unordered_multimap.h | 2 +- src/etl/unordered_multiset.h | 2 +- src/etl/unordered_set.h | 2 +- src/etl/vector.h | 1 + src/etl/version.h | 2 +- 46 files changed, 801 insertions(+), 281 deletions(-) diff --git a/library.json b/library.json index 8424981..f0a6376 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "Embedded Template Library ETL", - "version": "20.39.0", + "version": "20.39.4", "authors": { "name": "John Wellbelove", "email": "john.wellbelove@etlcpp.com" diff --git a/library.properties b/library.properties index 9689dd7..55f086e 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Embedded Template Library ETL -version=20.39.0 +version=20.39.4 author= John Wellbelove maintainer=John Wellbelove license=MIT diff --git a/src/etl/algorithm.h b/src/etl/algorithm.h index 59f8b9b..3929a57 100644 --- a/src/etl/algorithm.h +++ b/src/etl/algorithm.h @@ -342,6 +342,7 @@ namespace etl //*************************************************************************** // Pointers template + ETL_CONSTEXPR14 typename etl::enable_if::value, void>::type reverse(TIterator b, TIterator e) { @@ -357,6 +358,7 @@ namespace etl // Non-pointers template + ETL_CONSTEXPR14 typename etl::enable_if::value, void>::type reverse(TIterator b, TIterator e) { diff --git a/src/etl/array.h b/src/etl/array.h index 0a41fae..8615f5a 100644 --- a/src/etl/array.h +++ b/src/etl/array.h @@ -617,7 +617,7 @@ namespace etl template constexpr auto make_array(TValues&&... values) -> etl::array { - return { { etl::forward(values)... } }; + return { etl::forward(values)... }; } #endif diff --git a/src/etl/base64.h b/src/etl/base64.h index 21b2641..4034248 100644 --- a/src/etl/base64.h +++ b/src/etl/base64.h @@ -26,13 +26,13 @@ SOFTWARE. #ifndef ETL_BASE64_INCLUDED #define ETL_BASE64_INCLUDED -#include "etl/platform.h" -#include "etl/static_assert.h" -#include "etl/exception.h" -#include "etl/error_handler.h" -#include "etl/type_traits.h" -#include "etl/enum_type.h" -#include "etl/integral_limits.h" +#include "platform.h" +#include "static_assert.h" +#include "exception.h" +#include "error_handler.h" +#include "type_traits.h" +#include "enum_type.h" +#include "integral_limits.h" #include diff --git a/src/etl/base64_decoder.h b/src/etl/base64_decoder.h index 5ccc98a..848c7e3 100644 --- a/src/etl/base64_decoder.h +++ b/src/etl/base64_decoder.h @@ -28,19 +28,19 @@ SOFTWARE. #ifndef ETL_BASE64_DECODER_INCLUDED #define ETL_BASE64_DECODER_INCLUDED -#include "etl/platform.h" -#include "etl/static_assert.h" -#include "etl/error_handler.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/enum_type.h" -#include "etl/delegate.h" -#include "etl/span.h" - -#include "etl/base64.h" +#include "platform.h" +#include "static_assert.h" +#include "error_handler.h" +#include "type_traits.h" +#include "binary.h" +#include "algorithm.h" +#include "integral_limits.h" +#include "iterator.h" +#include "enum_type.h" +#include "delegate.h" +#include "span.h" + +#include "base64.h" #include diff --git a/src/etl/base64_encoder.h b/src/etl/base64_encoder.h index 4f6ea0b..cf4735e 100644 --- a/src/etl/base64_encoder.h +++ b/src/etl/base64_encoder.h @@ -28,19 +28,19 @@ SOFTWARE. #ifndef ETL_BASE64_ENCODER_INCLUDED #define ETL_BASE64_ENCODER_INCLUDED -#include "etl/platform.h" -#include "etl/static_assert.h" -#include "etl/error_handler.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/enum_type.h" -#include "etl/delegate.h" -#include "etl/span.h" - -#include "etl/base64.h" +#include "platform.h" +#include "static_assert.h" +#include "error_handler.h" +#include "type_traits.h" +#include "binary.h" +#include "algorithm.h" +#include "integral_limits.h" +#include "iterator.h" +#include "enum_type.h" +#include "delegate.h" +#include "span.h" + +#include "base64.h" #include diff --git a/src/etl/deque.h b/src/etl/deque.h index 8e7c357..606d894 100644 --- a/src/etl/deque.h +++ b/src/etl/deque.h @@ -2545,7 +2545,7 @@ namespace etl template constexpr auto make_deque(TValues&&... values) -> etl::deque { - return { { etl::forward(values)... } }; + return { etl::forward(values)... }; } #endif diff --git a/src/etl/flat_map.h b/src/etl/flat_map.h index e7fc5e6..c57856a 100644 --- a/src/etl/flat_map.h +++ b/src/etl/flat_map.h @@ -1253,7 +1253,7 @@ namespace etl template , typename... TPairs> constexpr auto make_flat_map(TPairs&&... pairs) -> etl::flat_map { - return { {etl::forward(pairs)...} }; + return { etl::forward(pairs)... }; } #endif } diff --git a/src/etl/flat_multimap.h b/src/etl/flat_multimap.h index 4863158..f261ab6 100644 --- a/src/etl/flat_multimap.h +++ b/src/etl/flat_multimap.h @@ -1062,7 +1062,7 @@ namespace etl template , typename... TPairs> constexpr auto make_flat_multimap(TPairs&&... pairs) -> etl::flat_multimap { - return { {etl::forward(pairs)...} }; + return { etl::forward(pairs)... }; } #endif } diff --git a/src/etl/flat_multiset.h b/src/etl/flat_multiset.h index 2ab5172..fec26c0 100644 --- a/src/etl/flat_multiset.h +++ b/src/etl/flat_multiset.h @@ -1030,7 +1030,7 @@ namespace etl template , typename... T> constexpr auto make_flat_multiset(T&&... keys) -> etl::flat_multiset { - return { {etl::forward(keys)...} }; + return { etl::forward(keys)... }; } #endif } diff --git a/src/etl/flat_set.h b/src/etl/flat_set.h index c24724c..005a1b7 100644 --- a/src/etl/flat_set.h +++ b/src/etl/flat_set.h @@ -1132,7 +1132,7 @@ namespace etl template , typename... T> constexpr auto make_flat_set(T&&... keys) -> etl::flat_set { - return { {etl::forward(keys)...} }; + return { etl::forward(keys)... }; } #endif } diff --git a/src/etl/forward_list.h b/src/etl/forward_list.h index 25b1748..13bf1e5 100644 --- a/src/etl/forward_list.h +++ b/src/etl/forward_list.h @@ -1796,7 +1796,7 @@ namespace etl template constexpr auto make_forward_list(T&&... t) -> etl::forward_list, sizeof...(T)> { - return { { etl::forward(t)... } }; + return { etl::forward(t)... }; } #endif diff --git a/src/etl/generators/type_traits_generator.h b/src/etl/generators/type_traits_generator.h index c1d73d1..f086b84 100644 --- a/src/etl/generators/type_traits_generator.h +++ b/src/etl/generators/type_traits_generator.h @@ -2296,16 +2296,68 @@ typedef integral_constant true_type; using signed_type_t = typename signed_type::type; #endif -//********************************************* -// type_identity + //********************************************* + // type_identity -template -struct type_identity { typedef T type; }; + template + struct type_identity { typedef T type; }; #if ETL_USING_CPP11 template using type_identity_t = typename type_identity::type; #endif + +#if ETL_USING_CPP11 + //********************************************* + // has_duplicates + template + struct has_duplicates; + + template + struct has_duplicates : etl::conditional_t::value, + etl::true_type, + has_duplicates> {}; + + template <> + struct has_duplicates<> : etl::false_type {}; +#endif + +#if ETL_USING_CPP17 + template + inline constexpr bool has_duplicates_v = etl::has_duplicates::value; +#endif + +#if ETL_USING_CPP11 + //********************************************* + // count_of + template + struct count_of; + + template + struct count_of : etl::integral_constant::value + + count_of::value> {}; + + template + struct count_of : etl::integral_constant {}; +#endif + +#if ETL_USING_CPP17 + template + inline constexpr size_t count_of_v = etl::count_of::value; +#endif + +#if ETL_USING_CPP11 + //********************************************* + // has_duplicates_of + template + struct has_duplicates_of : etl::bool_constant<(etl::count_of::value > 1U)> {}; +#endif + +#if ETL_USING_CPP17 + template + inline constexpr bool has_duplicates_of_v = etl::has_duplicates_of::value; +#endif } // Helper macros diff --git a/src/etl/histogram.h b/src/etl/histogram.h index 15d5422..ada5323 100644 --- a/src/etl/histogram.h +++ b/src/etl/histogram.h @@ -249,7 +249,7 @@ namespace etl //********************************* value_type operator [](key_type key) const { - return this->accumulator[key]; + return this->accumulator[key - Start_Index]; } }; @@ -373,7 +373,7 @@ namespace etl //********************************* value_type operator [](key_type key) const { - return this->accumulator[key]; + return this->accumulator[key - start_index]; } private: diff --git a/src/etl/indirect_vector.h b/src/etl/indirect_vector.h index b8806ca..0bc67ab 100644 --- a/src/etl/indirect_vector.h +++ b/src/etl/indirect_vector.h @@ -606,6 +606,7 @@ namespace etl //********************************************************************* void reserve(size_t n) { + (void)n; // Stop 'unused parameter' warning in release mode. ETL_ASSERT(n <= capacity(), ETL_ERROR(vector_out_of_bounds)); } @@ -1469,7 +1470,7 @@ namespace etl template constexpr auto make_indirect_vector(T&&... t) -> etl::indirect_vector, sizeof...(T)> { - return { { etl::forward(t)... } }; + return { etl::forward(t)... }; } #endif diff --git a/src/etl/integral_limits.h b/src/etl/integral_limits.h index f7b7c68..8ac9aa8 100644 --- a/src/etl/integral_limits.h +++ b/src/etl/integral_limits.h @@ -459,6 +459,54 @@ namespace etl template ETL_CONSTANT bool statics_char32_t::is_signed; #endif + +#if ETL_USING_20BIT_TYPES +template + struct statics___int20 + { + typedef __int20 value_type; + + static ETL_CONSTANT __int20 min = 0x80000; + static ETL_CONSTANT __int20 max = 0x7FFFF; + static ETL_CONSTANT int bits = 20; + static ETL_CONSTANT bool is_signed = true; + }; + + template + ETL_CONSTANT __int20 statics___int20::min; + + template + ETL_CONSTANT __int20 statics___int20::max; + + template + ETL_CONSTANT int statics___int20::bits; + + template + ETL_CONSTANT bool statics___int20::is_signed; + + template + struct statics_unsigned___int20 + { + typedef unsigned __int20 value_type; + + static ETL_CONSTANT unsigned __int20 min = 0; + static ETL_CONSTANT unsigned __int20 max = 0xFFFFF; + static ETL_CONSTANT int bits = 20; + static ETL_CONSTANT bool is_signed = false; + }; + + template + ETL_CONSTANT unsigned __int20 statics_unsigned___int20::min; + + template + ETL_CONSTANT unsigned __int20 statics_unsigned___int20::max; + + template + ETL_CONSTANT int statics_unsigned___int20::bits; + + template + ETL_CONSTANT bool statics_unsigned___int20::is_signed; +#endif } //*************************************************************************** @@ -556,6 +604,21 @@ namespace etl struct integral_limits : public private_integral_limits::statics_unsigned_long_long<> { }; + + #if ETL_USING_20BIT_TYPES + //*************************************************************************** + ///\ingroup integral_limits + //*************************************************************************** + template <> + struct integral_limits<__int20> : public private_integral_limits::statics___int20<> + { + }; + + template <> + struct integral_limits : public private_integral_limits::statics_unsigned___int20<> + { + }; + #endif } #include "private/minmax_pop.h" diff --git a/src/etl/intrusive_forward_list.h b/src/etl/intrusive_forward_list.h index a38cf43..84d0aa9 100644 --- a/src/etl/intrusive_forward_list.h +++ b/src/etl/intrusive_forward_list.h @@ -489,9 +489,9 @@ namespace etl reference operator *() const { -#include "etl/private/diagnostic_null_dereference_push.h" +#include "private/diagnostic_null_dereference_push.h" return *static_cast(p_value); -#include "etl/private/diagnostic_pop.h" +#include "private/diagnostic_pop.h" } pointer operator &() const diff --git a/src/etl/intrusive_list.h b/src/etl/intrusive_list.h index 58c976e..6bbd906 100644 --- a/src/etl/intrusive_list.h +++ b/src/etl/intrusive_list.h @@ -528,9 +528,9 @@ namespace etl reference operator *() const { -#include "etl/private/diagnostic_null_dereference_push.h" +#include "private/diagnostic_null_dereference_push.h" return *static_cast(p_value); -#include "etl/private/diagnostic_pop.h" +#include "private/diagnostic_pop.h" } pointer operator &() const diff --git a/src/etl/list.h b/src/etl/list.h index eefedf8..4a773bc 100644 --- a/src/etl/list.h +++ b/src/etl/list.h @@ -2229,7 +2229,7 @@ namespace etl template constexpr auto make_list(T... t) -> etl::list, sizeof...(T)> { - return { { etl::forward(t)... } }; + return { etl::forward(t)... }; } #endif diff --git a/src/etl/map.h b/src/etl/map.h index 88449df..482742b 100644 --- a/src/etl/map.h +++ b/src/etl/map.h @@ -2812,7 +2812,7 @@ namespace etl template , typename... TPairs> constexpr auto make_map(TPairs&&... pairs) -> etl::map { - return { {etl::forward(pairs)...} }; + return { etl::forward(pairs)... }; } #endif diff --git a/src/etl/multi_span.h b/src/etl/multi_span.h index 2838e00..8e974ee 100644 --- a/src/etl/multi_span.h +++ b/src/etl/multi_span.h @@ -199,7 +199,7 @@ namespace etl //************************************************************************* /// Constructor. //************************************************************************* - ETL_CONSTEXPR multi_span(span_list_type span_list_) + ETL_CONSTEXPR14 multi_span(span_list_type span_list_) : span_list(span_list_) { } @@ -209,7 +209,7 @@ namespace etl /// data() and size() member functions. //************************************************************************* template - ETL_CONSTEXPR multi_span(TContainer& a) ETL_NOEXCEPT + ETL_CONSTEXPR14 multi_span(TContainer& a) ETL_NOEXCEPT : span_list(a.data(), a.data() + a.size()) { } @@ -219,7 +219,7 @@ namespace etl /// data() and size() member functions. //************************************************************************* template - ETL_CONSTEXPR multi_span(const TContainer& a) ETL_NOEXCEPT + ETL_CONSTEXPR14 multi_span(const TContainer& a) ETL_NOEXCEPT : span_list(a.data(), a.data() + a.size()) { } @@ -228,7 +228,7 @@ namespace etl /// Constructor. //************************************************************************* template - ETL_CONSTEXPR multi_span(TIterator begin_, TIterator end_) + ETL_CONSTEXPR14 multi_span(TIterator begin_, TIterator end_) : span_list(etl::addressof(*begin_), etl::distance(begin_, end_)) { } @@ -237,7 +237,7 @@ namespace etl /// Constructor. //************************************************************************* template - ETL_CONSTEXPR multi_span(TIterator begin_, size_t length_) + ETL_CONSTEXPR14 multi_span(TIterator begin_, size_t length_) : span_list(etl::addressof(*begin_), length_) { } @@ -245,7 +245,7 @@ namespace etl //************************************************************************* /// Copy Constructor. //************************************************************************* - ETL_CONSTEXPR multi_span(const multi_span& other) + ETL_CONSTEXPR14 multi_span(const multi_span& other) : span_list(other.span_list) { } @@ -253,7 +253,7 @@ namespace etl //************************************************************************* /// Assignment operator //************************************************************************* - ETL_CONSTEXPR multi_span& operator = (const multi_span & other) + ETL_CONSTEXPR14 multi_span& operator = (const multi_span & other) { span_list = other.span_list; @@ -263,7 +263,7 @@ namespace etl //************************************************************************* /// //************************************************************************* - ETL_CONSTEXPR iterator begin() const + ETL_CONSTEXPR14 iterator begin() const { return iterator(span_list.begin(), span_list.end()); } @@ -271,7 +271,7 @@ namespace etl //************************************************************************* /// //************************************************************************* - ETL_CONSTEXPR iterator end() const + ETL_CONSTEXPR14 iterator end() const { return iterator(span_list.end(), span_list.end()); } @@ -296,7 +296,7 @@ namespace etl //************************************************************************* /// Returns true if the multi_span size is zero. //************************************************************************* - ETL_CONSTEXPR bool empty() const ETL_NOEXCEPT + ETL_CONSTEXPR14 bool empty() const ETL_NOEXCEPT { if (span_list.empty()) { @@ -328,7 +328,7 @@ namespace etl //************************************************************************* /// Returns the number of spans in the multi_span. //************************************************************************* - ETL_CONSTEXPR size_t size_spans() const ETL_NOEXCEPT + ETL_CONSTEXPR14 size_t size_spans() const ETL_NOEXCEPT { return span_list.size(); } diff --git a/src/etl/multimap.h b/src/etl/multimap.h index 6d9dfa6..5a586a5 100644 --- a/src/etl/multimap.h +++ b/src/etl/multimap.h @@ -2460,7 +2460,7 @@ namespace etl template , typename... TPairs> constexpr auto make_multimap(TPairs&&... pairs) -> etl::multimap { - return { {etl::forward(pairs)...} }; + return { etl::forward(pairs)... }; } #endif diff --git a/src/etl/multiset.h b/src/etl/multiset.h index 596c31d..ae024e3 100644 --- a/src/etl/multiset.h +++ b/src/etl/multiset.h @@ -2440,7 +2440,7 @@ namespace etl template , typename... T> constexpr auto make_multiset(T&&... keys) -> etl::multiset { - return { {etl::forward(keys)...} }; + return { etl::forward(keys)... }; } #endif diff --git a/src/etl/observer.h b/src/etl/observer.h index c09180c..e6da54b 100644 --- a/src/etl/observer.h +++ b/src/etl/observer.h @@ -147,10 +147,10 @@ namespace etl //***************************************************************** void add_observer(TObserver& observer) { - // See if we already have it in our list. + // See if we already have it in our list. typename Observer_List::iterator i_observer_item = find_observer(observer); - // Not there? + // Not there? if (i_observer_item == observer_list.end()) { // Is there enough room? @@ -253,6 +253,24 @@ namespace etl } } + //***************************************************************** + /// Notify all of the observers, sending them the notification. + //***************************************************************** + void notify_observers() + { + typename Observer_List::iterator i_observer_item = observer_list.begin(); + + while (i_observer_item != observer_list.end()) + { + if (i_observer_item->enabled) + { + i_observer_item->p_observer->notification(); + } + + ++i_observer_item; + } + } + protected: ~observable() @@ -275,18 +293,22 @@ namespace etl }; #if ETL_USING_CPP11 && !defined(ETL_OBSERVER_FORCE_CPP03_IMPLEMENTATION) + template + class observer; //***************************************************************** /// The observer class for N types. ///\ingroup observer //***************************************************************** - template - class observer : public observer, public observer + template + class observer : public observer, public observer { public: + ETL_STATIC_ASSERT((!etl::has_duplicates::value), "Observer has duplicate notification types"); + using observer::notification; - using observer::notification; + using observer::notification; }; //***************************************************************** @@ -303,6 +325,20 @@ namespace etl virtual void notification(T1) = 0; }; + //***************************************************************** + /// The specialised observer class for void type. + ///\ingroup observer + //***************************************************************** + template <> + class observer + { + public: + + virtual ~observer() = default; + + virtual void notification() = 0; + }; + #else //********************************************************************* @@ -317,18 +353,26 @@ namespace etl typename T6 = void, typename T7 = void, typename T8 = void> - class observer + class observer : public observer + , public observer + , public observer + , public observer + , public observer + , public observer + , public observer + , public observer { public: virtual ~observer() {} - virtual void notification(T1) = 0; - virtual void notification(T2) = 0; - virtual void notification(T3) = 0; - virtual void notification(T4) = 0; - virtual void notification(T5) = 0; - virtual void notification(T6) = 0; - virtual void notification(T7) = 0; - virtual void notification(T8) = 0; + + using observer::notification; + using observer::notification; + using observer::notification; + using observer::notification; + using observer::notification; + using observer::notification; + using observer::notification; + using observer::notification; }; //********************************************************************* @@ -342,18 +386,24 @@ namespace etl typename T5, typename T6, typename T7> - class observer + class observer : public observer + , public observer + , public observer + , public observer + , public observer + , public observer + , public observer { public: virtual ~observer() {} - virtual void notification(T1) = 0; - virtual void notification(T2) = 0; - virtual void notification(T3) = 0; - virtual void notification(T4) = 0; - virtual void notification(T5) = 0; - virtual void notification(T6) = 0; - virtual void notification(T7) = 0; + using observer::notification; + using observer::notification; + using observer::notification; + using observer::notification; + using observer::notification; + using observer::notification; + using observer::notification; }; //********************************************************************* @@ -366,17 +416,22 @@ namespace etl typename T4, typename T5, typename T6> - class observer + class observer : public observer + , public observer + , public observer + , public observer + , public observer + , public observer { public: virtual ~observer() {} - virtual void notification(T1) = 0; - virtual void notification(T2) = 0; - virtual void notification(T3) = 0; - virtual void notification(T4) = 0; - virtual void notification(T5) = 0; - virtual void notification(T6) = 0; + using observer::notification; + using observer::notification; + using observer::notification; + using observer::notification; + using observer::notification; + using observer::notification; }; //********************************************************************* @@ -388,16 +443,20 @@ namespace etl typename T3, typename T4, typename T5> - class observer + class observer : public observer + , public observer + , public observer + , public observer + , public observer { public: virtual ~observer() {} - virtual void notification(T1) = 0; - virtual void notification(T2) = 0; - virtual void notification(T3) = 0; - virtual void notification(T4) = 0; - virtual void notification(T5) = 0; + using observer::notification; + using observer::notification; + using observer::notification; + using observer::notification; + using observer::notification; }; //********************************************************************* @@ -408,15 +467,18 @@ namespace etl typename T2, typename T3, typename T4> - class observer + class observer : public observer + , public observer + , public observer + , public observer { public: virtual ~observer() {} - virtual void notification(T1) = 0; - virtual void notification(T2) = 0; - virtual void notification(T3) = 0; - virtual void notification(T4) = 0; + using observer::notification; + using observer::notification; + using observer::notification; + using observer::notification; }; //********************************************************************* @@ -426,14 +488,16 @@ namespace etl template - class observer + class observer : public observer + , public observer + , public observer { public: virtual ~observer() {} - virtual void notification(T1) = 0; - virtual void notification(T2) = 0; - virtual void notification(T3) = 0; + using observer::notification; + using observer::notification; + using observer::notification; }; //********************************************************************* @@ -442,13 +506,14 @@ namespace etl //********************************************************************* template - class observer + class observer : public observer + , public observer { public: virtual ~observer() {} - virtual void notification(T1) = 0; - virtual void notification(T2) = 0; + using observer::notification; + using observer::notification; }; //********************************************************************* @@ -464,6 +529,19 @@ namespace etl virtual void notification(T1) = 0; }; + //********************************************************************* + /// The observer interface for void argument notification type. + ///\ingroup observer + //********************************************************************* + template <> + class observer + { + public: + + virtual ~observer() {} + virtual void notification() = 0; + }; + #endif } diff --git a/src/etl/platform.h b/src/etl/platform.h index e6fe426..e66a0e0 100644 --- a/src/etl/platform.h +++ b/src/etl/platform.h @@ -117,6 +117,17 @@ SOFTWARE. #define ETL_8BIT_SUPPORT (CHAR_BIT == 8) // Deprecated +//************************************* +// Some targets support 20bit types. +#if defined(ETL_USE_20BIT_TYPES) + #define ETL_USING_20BIT_TYPES 1 + #define ETL_NOT_USING_20BIT_TYPES 0 +#else + #define ETL_USING_20BIT_TYPES 0 + #define ETL_NOT_USING_20BIT_TYPES 1 +#endif + + //************************************* // Helper macro for ETL_NO_64BIT_TYPES. #if defined(ETL_NO_64BIT_TYPES) @@ -127,16 +138,6 @@ SOFTWARE. #define ETL_NOT_USING_64BIT_TYPES 0 #endif -//************************************* -// Helper macro for variant selection. -#if defined(ETL_USE_LEGACY_VARIANT) - #define ETL_USING_LEGACY_VARIANT 1 - #define ETL_NOT_USING_LEGACY_VARIANT 0 -#else - #define ETL_USING_LEGACY_VARIANT 0 - #define ETL_NOT_USING_LEGACY_VARIANT 1 -#endif - //************************************* // Figure out things about the compiler, if haven't already done so in etl_profile.h #include "profiles/determine_compiler_version.h" @@ -146,6 +147,16 @@ SOFTWARE. // See if we can determine the OS we're compiling on, if haven't already done so in etl_profile.h #include "profiles/determine_development_os.h" +//************************************* +// Helper macro for choosing the variant type. +#if !ETL_USING_CPP11 || defined(ETL_USE_LEGACY_VARIANT) + #define ETL_USING_LEGACY_VARIANT 1 + #define ETL_NOT_USING_LEGACY_VARIANT 0 +#else + #define ETL_USING_LEGACY_VARIANT 0 + #define ETL_NOT_USING_LEGACY_VARIANT 1 +#endif + //************************************* // Check WCHAR_MIN and WCHAR_MAX #if !defined(WCHAR_MIN) diff --git a/src/etl/private/delegate_cpp03.h b/src/etl/private/delegate_cpp03.h index 78a8440..74da0e4 100644 --- a/src/etl/private/delegate_cpp03.h +++ b/src/etl/private/delegate_cpp03.h @@ -273,7 +273,17 @@ namespace etl template static delegate create() { - return delegate(method_instance_stub); + return delegate(method_instance_stub); + } + + //************************************************************************* + /// Create from instance method (Compile time). + /// New API + //************************************************************************* + template + static delegate create() + { + return delegate(method_instance_stub); } //************************************************************************* @@ -282,7 +292,17 @@ namespace etl template static delegate create() { - return delegate(const_method_instance_stub); + return delegate(const_method_instance_stub); + } + + //************************************************************************* + /// Create from const instance method (Compile time). + /// New API + //************************************************************************* + template + static delegate create() + { + return delegate(const_method_instance_stub); } #if !(defined(ETL_COMPILER_GCC) && (__GNUC__ <= 8)) @@ -350,7 +370,17 @@ namespace etl template void set() { - assign(ETL_NULLPTR, method_instance_stub); + assign(ETL_NULLPTR, method_instance_stub); + } + + //************************************************************************* + /// Set from instance method (Compile time). + /// New API + //************************************************************************* + template + void set() + { + assign(ETL_NULLPTR, method_instance_stub); } //************************************************************************* @@ -359,7 +389,17 @@ namespace etl template void set() { - assign(ETL_NULLPTR, const_method_instance_stub); + assign(ETL_NULLPTR, const_method_instance_stub); + } + + //************************************************************************* + /// Set from const instance method (Compile time). + /// New API + //************************************************************************* + template + void set() + { + assign(ETL_NULLPTR, const_method_instance_stub); } //************************************************************************* @@ -571,7 +611,7 @@ namespace etl //************************************************************************* /// Stub call for a member function. Compile time instance. //************************************************************************* - template + template static TReturn method_instance_stub(void*, TParam param) { return (Instance.*Method)(param); @@ -580,7 +620,7 @@ namespace etl //************************************************************************* /// Stub call for a const member function. Compile time instance. //************************************************************************* - template + template static TReturn const_method_instance_stub(void*, TParam param) { return (Instance.*Method)(param); @@ -734,7 +774,17 @@ namespace etl template static delegate create() { - return delegate(method_instance_stub); + return delegate(method_instance_stub); + } + + //************************************************************************* + /// Create from instance method (Compile time). + /// New API + //************************************************************************* + template + static delegate create() + { + return delegate(method_instance_stub); } //************************************************************************* @@ -743,7 +793,17 @@ namespace etl template static delegate create() { - return delegate(const_method_instance_stub); + return delegate(const_method_instance_stub); + } + + //************************************************************************* + /// Create from const instance method (Compile time). + /// New API + //************************************************************************* + template + static delegate create() + { + return delegate(const_method_instance_stub); } #if !(defined(ETL_COMPILER_GCC) && (__GNUC__ <= 8)) @@ -811,7 +871,17 @@ namespace etl template void set() { - assign(ETL_NULLPTR, method_instance_stub); + assign(ETL_NULLPTR, method_instance_stub); + } + + //************************************************************************* + /// Set from instance method (Compile time). + /// New API + //************************************************************************* + template + void set() + { + assign(ETL_NULLPTR, method_instance_stub); } //************************************************************************* @@ -820,7 +890,17 @@ namespace etl template void set() { - assign(ETL_NULLPTR, const_method_instance_stub); + assign(ETL_NULLPTR, const_method_instance_stub); + } + + //************************************************************************* + /// Set from const instance method (Compile time). + /// New API + //************************************************************************* + template + void set() + { + assign(ETL_NULLPTR, const_method_instance_stub); } //************************************************************************* @@ -1032,7 +1112,7 @@ namespace etl //************************************************************************* /// Stub call for a member function. Compile time instance. //************************************************************************* - template + template static TReturn method_instance_stub(void*) { return (Instance.*Method)(); @@ -1041,7 +1121,7 @@ namespace etl //************************************************************************* /// Stub call for a const member function. Compile time instance. //************************************************************************* - template + template static TReturn const_method_instance_stub(void*) { return (Instance.*Method)(); diff --git a/src/etl/private/delegate_cpp11.h b/src/etl/private/delegate_cpp11.h index f904926..8f43860 100644 --- a/src/etl/private/delegate_cpp11.h +++ b/src/etl/private/delegate_cpp11.h @@ -197,7 +197,18 @@ namespace etl ETL_NODISCARD static ETL_CONSTEXPR14 delegate create() { - return delegate(method_instance_stub); + return delegate(method_instance_stub); + } + + //************************************************************************* + /// Create from instance method (Compile time). + /// New API + //************************************************************************* + template + ETL_NODISCARD + static ETL_CONSTEXPR14 delegate create() + { + return delegate(method_instance_stub); } //************************************************************************* @@ -207,7 +218,18 @@ namespace etl ETL_NODISCARD static ETL_CONSTEXPR14 delegate create() { - return delegate(const_method_instance_stub); + return delegate(const_method_instance_stub); + } + + //************************************************************************* + /// Create from const instance method (Compile time). + /// New API + //************************************************************************* + template + ETL_NODISCARD + static ETL_CONSTEXPR14 delegate create() + { + return delegate(const_method_instance_stub); } #if !(defined(ETL_COMPILER_GCC) && (__GNUC__ <= 8)) @@ -217,7 +239,7 @@ namespace etl //************************************************************************* template ETL_NODISCARD - static ETL_CONSTEXPR14 delegate create() + static ETL_CONSTEXPR14 delegate create() { return delegate(operator_instance_stub); } @@ -274,7 +296,17 @@ namespace etl template ETL_CONSTEXPR14 void set() { - assign(ETL_NULLPTR, method_instance_stub); + assign(ETL_NULLPTR, method_instance_stub); + } + + //************************************************************************* + /// Set from instance method (Compile time). + /// New API + //************************************************************************* + template + ETL_CONSTEXPR14 void set() + { + assign(ETL_NULLPTR, method_instance_stub); } //************************************************************************* @@ -283,7 +315,17 @@ namespace etl template ETL_CONSTEXPR14 void set() { - assign(ETL_NULLPTR, const_method_instance_stub); + assign(ETL_NULLPTR, const_method_instance_stub); + } + + //************************************************************************* + /// Set from const instance method (Compile time). + /// New API + //************************************************************************* + template + ETL_CONSTEXPR14 void set() + { + assign(ETL_NULLPTR, const_method_instance_stub); } //************************************************************************* @@ -525,7 +567,7 @@ namespace etl //************************************************************************* /// Stub call for a member function. Compile time instance. //************************************************************************* - template + template static ETL_CONSTEXPR14 TReturn method_instance_stub(void*, TParams... params) { return (Instance.*Method)(etl::forward(params)...); @@ -534,7 +576,7 @@ namespace etl //************************************************************************* /// Stub call for a const member function. Compile time instance. //************************************************************************* - template + template static ETL_CONSTEXPR14 TReturn const_method_instance_stub(void*, TParams... params) { return (Instance.*Method)(etl::forward(params)...); diff --git a/src/etl/private/diagnostic_cxx_20_compat_push.h b/src/etl/private/diagnostic_cxx_20_compat_push.h index 49a0346..85c864b 100644 --- a/src/etl/private/diagnostic_cxx_20_compat_push.h +++ b/src/etl/private/diagnostic_cxx_20_compat_push.h @@ -33,7 +33,7 @@ SOFTWARE. * This file is intended to evaluated multiple times by design. */ -#if defined(__GNUC__) && !defined(__clang__) && !defined(__llvm__) +#if defined(__GNUC__) && (__GNUC__ >= 10) && !defined(__clang__) && !defined(__llvm__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wc++20-compat" #endif diff --git a/src/etl/profiles/determine_compiler_language_support.h b/src/etl/profiles/determine_compiler_language_support.h index e8a0044..d2841d7 100644 --- a/src/etl/profiles/determine_compiler_language_support.h +++ b/src/etl/profiles/determine_compiler_language_support.h @@ -58,6 +58,12 @@ SOFTWARE. #endif #elif defined(ETL_COMPILER_ARM5) #define ETL_CPP20_SUPPORTED 0 + #elif defined(ETL_COMPILER_GCC) + #if (__GNUC__ == 10) + #define ETL_CPP20_SUPPORTED (__cplusplus >= 201709L) + #else + #define ETL_CPP20_SUPPORTED (__cplusplus >= 202002L) + #endif #else #define ETL_CPP20_SUPPORTED (__cplusplus >= 202002L) #endif diff --git a/src/etl/queue.h b/src/etl/queue.h index 0f66cef..b704d8a 100644 --- a/src/etl/queue.h +++ b/src/etl/queue.h @@ -454,7 +454,7 @@ namespace etl void pop() { #if defined(ETL_CHECK_PUSH_POP) - ETL_ASSERT(!empty(), ETL_ERROR(queue_empty)); + ETL_ASSERT_OR_RETURN(!empty(), ETL_ERROR(queue_empty)); #endif p_buffer[out].~T(); del_out(); diff --git a/src/etl/reference_flat_map.h b/src/etl/reference_flat_map.h index e9d7b74..4aa8e1f 100644 --- a/src/etl/reference_flat_map.h +++ b/src/etl/reference_flat_map.h @@ -1168,7 +1168,7 @@ namespace etl template , typename... TPairs> constexpr auto make_reference_flat_map(TPairs&&... pairs) -> etl::reference_flat_map { - return { {etl::forward(pairs)...} }; + return { etl::forward(pairs)... }; } #endif } diff --git a/src/etl/reference_flat_multimap.h b/src/etl/reference_flat_multimap.h index 605a9b3..1fb8d82 100644 --- a/src/etl/reference_flat_multimap.h +++ b/src/etl/reference_flat_multimap.h @@ -1061,7 +1061,7 @@ namespace etl template , typename... TPairs> constexpr auto make_reference_flat_multimap(TPairs&&... pairs) -> etl::reference_flat_multimap { - return { {etl::forward(pairs)...} }; + return { etl::forward(pairs)... }; } #endif } diff --git a/src/etl/reference_flat_multiset.h b/src/etl/reference_flat_multiset.h index 0ee841c..9d43848 100644 --- a/src/etl/reference_flat_multiset.h +++ b/src/etl/reference_flat_multiset.h @@ -1009,7 +1009,7 @@ namespace etl template , typename... T> constexpr auto make_reference_flat_multiset(T&&... keys) -> etl::reference_flat_multiset { - return { {etl::forward(keys)...} }; + return { etl::forward(keys)... }; } #endif diff --git a/src/etl/reference_flat_set.h b/src/etl/reference_flat_set.h index 22943c6..dfb6542 100644 --- a/src/etl/reference_flat_set.h +++ b/src/etl/reference_flat_set.h @@ -999,7 +999,7 @@ namespace etl template , typename... T> constexpr auto make_reference_flat_set(T&&... keys) -> etl::reference_flat_set { - return { {etl::forward(keys)...} }; + return { etl::forward(keys)... }; } #endif diff --git a/src/etl/result.h b/src/etl/result.h index 2955a08..496667c 100644 --- a/src/etl/result.h +++ b/src/etl/result.h @@ -468,12 +468,12 @@ namespace etl { return etl::move(data.value()); } -#endif private: etl::optional data; }; -} +} // namespace etl +#endif #endif diff --git a/src/etl/set.h b/src/etl/set.h index 6dac5d5..ccca856 100644 --- a/src/etl/set.h +++ b/src/etl/set.h @@ -2691,7 +2691,7 @@ namespace etl template , typename... T> constexpr auto make_set(T&&... keys) -> etl::set { - return { {etl::forward(keys)...} }; + return { etl::forward(keys)... }; } #endif diff --git a/src/etl/stack.h b/src/etl/stack.h index f7c2bd6..a292218 100644 --- a/src/etl/stack.h +++ b/src/etl/stack.h @@ -401,7 +401,7 @@ namespace etl void pop() { #if defined(ETL_CHECK_PUSH_POP) - ETL_ASSERT(!empty(), ETL_ERROR(stack_empty)); + ETL_ASSERT_OR_RETURN(!empty(), ETL_ERROR(stack_empty)); #endif p_buffer[top_index].~T(); base_t::del_out(); diff --git a/src/etl/type_traits.h b/src/etl/type_traits.h index 1a40f02..47489c2 100644 --- a/src/etl/type_traits.h +++ b/src/etl/type_traits.h @@ -2289,16 +2289,71 @@ typedef integral_constant true_type; using signed_type_t = typename signed_type::type; #endif -//********************************************* -// type_identity + //********************************************* + // type_identity -template -struct type_identity { typedef T type; }; + template + struct type_identity { typedef T type; }; #if ETL_USING_CPP11 template using type_identity_t = typename type_identity::type; #endif + +#if ETL_USING_CPP11 + //********************************************* + // has_duplicates + template + struct has_duplicates; + + template + struct has_duplicates : etl::conditional_t::value, + etl::true_type, + has_duplicates> {}; + + template + struct has_duplicates : etl::false_type {}; + + template <> + struct has_duplicates<> : etl::false_type {}; +#endif + +#if ETL_USING_CPP17 + template + inline constexpr bool has_duplicates_v = etl::has_duplicates::value; +#endif + +#if ETL_USING_CPP11 + //********************************************* + // count_of + template + struct count_of; + + template + struct count_of : etl::integral_constant::value + + count_of::value> {}; + + template + struct count_of : etl::integral_constant {}; +#endif + +#if ETL_USING_CPP17 + template + inline constexpr size_t count_of_v = etl::count_of::value; +#endif + +#if ETL_USING_CPP11 + //********************************************* + // has_duplicates_of + template + struct has_duplicates_of : etl::bool_constant<(etl::count_of::value > 1U)> {}; +#endif + +#if ETL_USING_CPP17 + template + inline constexpr bool has_duplicates_of_v = etl::has_duplicates_of::value; +#endif } // Helper macros diff --git a/src/etl/unaligned_type.h b/src/etl/unaligned_type.h index 87204d4..9b4ae66 100644 --- a/src/etl/unaligned_type.h +++ b/src/etl/unaligned_type.h @@ -40,6 +40,7 @@ SOFTWARE. #include "endianness.h" #include "iterator.h" #include "algorithm.h" +#include "bit.h" #include @@ -290,56 +291,6 @@ namespace etl return *this; } - //************************************************************************* - /// Equality operator - //************************************************************************* - friend ETL_CONSTEXPR14 bool operator ==(const unaligned_type& lhs, const unaligned_type& rhs) - { - return etl::equal(lhs.data(), lhs.data() + lhs.Size, rhs.data()); - } - - //************************************************************************* - /// Equality operator - //************************************************************************* - friend ETL_CONSTEXPR14 bool operator ==(const unaligned_type& lhs, T rhs) - { - T lhs_value = lhs; - return (lhs_value == rhs); - } - - //************************************************************************* - /// Equality operator - //************************************************************************* - friend ETL_CONSTEXPR14 bool operator ==(T lhs, const unaligned_type& rhs) - { - T rhs_value = rhs; - return (lhs == rhs_value); - } - - //************************************************************************* - /// Inequality operator - //************************************************************************* - friend ETL_CONSTEXPR14 bool operator !=(const unaligned_type& lhs, T rhs) - { - return !(lhs == rhs); - } - - //************************************************************************* - /// Inequality operator - //************************************************************************* - friend ETL_CONSTEXPR14 bool operator !=(const unaligned_type& lhs, const unaligned_type& rhs) - { - return !(lhs == rhs); - } - - //************************************************************************* - /// Inequality operator - //************************************************************************* - friend ETL_CONSTEXPR14 bool operator !=(T lhs, const unaligned_type& rhs) - { - return !(lhs == rhs); - } - //************************************************************************* /// Conversion operator //************************************************************************* @@ -367,7 +318,7 @@ namespace etl //************************************************************************* /// Unaligned copy //************************************************************************* - template + template struct unaligned_copy; //******************************************* @@ -375,7 +326,7 @@ namespace etl /// Size == 1 //******************************************* template - struct unaligned_copy + struct unaligned_copy { //******************************* static ETL_CONSTEXPR14 void copy(T value, pointer store) @@ -401,7 +352,7 @@ namespace etl /// Size == 2 //******************************************* template - struct unaligned_copy + struct unaligned_copy::value>::type> { //******************************* static ETL_CONSTEXPR14 void copy(T value, unsigned char* store) @@ -452,9 +403,10 @@ namespace etl //******************************************* /// Unaligned copy /// Size == 4 + /// Integrals //******************************************* template - struct unaligned_copy + struct unaligned_copy::value>::type> { static ETL_CONSTEXPR14 void copy(T value, unsigned char* store) { @@ -513,12 +465,57 @@ namespace etl } }; + //******************************************* + /// Unaligned copy + /// Size == 4 + /// Floating point + //******************************************* + template + struct unaligned_copy::value>::type> + { + static void copy(T value, unsigned char* store) + { + memcpy(store, &value, 4U); + + if (Endian != etl::endianness::value()) + { + etl::reverse(store, store + 4U); + } + } + + //******************************* + static void copy(const_pointer store, T& value) + { + unsigned char temp[4U]; + memcpy(temp, store, 4U); + + if (Endian != etl::endianness::value()) + { + etl::reverse(temp, temp + 4U); + } + + memcpy(&value, temp, 4U); + } + + //******************************* + static ETL_CONSTEXPR14 void copy(const_pointer src, int endian_src, unsigned char* dst) + { + memcpy(dst, src, 4U); + + if (Endian != endian_src) + { + etl::reverse(dst, dst + 4U); + } + } + }; + //******************************************* /// Unaligned copy /// Size == 8 + /// Integrals //******************************************* template - struct unaligned_copy + struct unaligned_copy::value>::type> { static ETL_CONSTEXPR14 void copy(T value, unsigned char* store) { @@ -600,6 +597,138 @@ namespace etl } } }; + + //******************************************* + /// Unaligned copy + /// Size == 8 + /// Floating point + //******************************************* + template + struct unaligned_copy::value>::type> + { + static void copy(T value, unsigned char* store) + { + memcpy(store, &value, 8U); + + if (Endian != etl::endianness::value()) + { + etl::reverse(store, store + 8U); + } + } + + //******************************* + static void copy(const_pointer store, T& value) + { + unsigned char temp[8U]; + memcpy(temp, store, 8U); + + if (Endian != etl::endianness::value()) + { + etl::reverse(temp, temp + 8U); + } + + memcpy(&value, temp, 8U); + } + + //******************************* + static ETL_CONSTEXPR14 void copy(const_pointer src, int endian_src, unsigned char* dst) + { + memcpy(dst, src, 8U); + + if (Endian != endian_src) + { + etl::reverse(dst, dst + 8U); + } + } + }; + + //******************************************* + /// Unaligned copy + /// Size == 12 + /// Floating point + //******************************************* + template + struct unaligned_copy::value>::type> + { + static void copy(T value, unsigned char* store) + { + memcpy(store, &value, 12U); + + if (Endian != etl::endianness::value()) + { + etl::reverse(store, store + 12U); + } + } + + //******************************* + static void copy(const_pointer store, T& value) + { + unsigned char temp[12U]; + memcpy(temp, store, 12U); + + if (Endian != etl::endianness::value()) + { + etl::reverse(temp, temp + 12U); + } + + memcpy(&value, temp, 12U); + } + + //******************************* + static ETL_CONSTEXPR14 void copy(const_pointer src, int endian_src, unsigned char* dst) + { + memcpy(dst, src, 12U); + + if (Endian != endian_src) + { + etl::reverse(dst, dst + 12U); + } + } + }; + + //******************************************* + /// Unaligned copy + /// Size == 16 + /// Floating point + //******************************************* + template + struct unaligned_copy::value>::type> + { + static void copy(T value, unsigned char* store) + { + memcpy(store, &value, 16U); + + if (Endian != etl::endianness::value()) + { + etl::reverse(store, store + 16U); + } + } + + //******************************* + static void copy(const_pointer store, T& value) + { + unsigned char temp[16U]; + memcpy(temp, store, 16U); + + if (Endian != etl::endianness::value()) + { + etl::reverse(temp, temp + 16U); + } + + memcpy(&value, temp, 16U); + } + + //******************************* + static ETL_CONSTEXPR14 void copy(const_pointer src, int endian_src, unsigned char* dst) + { + memcpy(dst, src, 16U); + + if (Endian != endian_src) + { + etl::reverse(dst, dst + 16U); + } + } + }; }; template @@ -610,89 +739,89 @@ namespace etl #if ETL_HAS_CONSTEXPR_ENDIANNESS // Host order - typedef unaligned_type host_char_t; - typedef unaligned_type host_schar_t; - typedef unaligned_type host_uchar_t; - typedef unaligned_type host_short_t; - typedef unaligned_type host_ushort_t; - typedef unaligned_type host_int_t; - typedef unaligned_type host_uint_t; - typedef unaligned_type host_long_t; - typedef unaligned_type host_ulong_t; - typedef unaligned_type host_long_long_t; + typedef unaligned_type host_char_t; + typedef unaligned_type host_schar_t; + typedef unaligned_type host_uchar_t; + typedef unaligned_type host_short_t; + typedef unaligned_type host_ushort_t; + typedef unaligned_type host_int_t; + typedef unaligned_type host_uint_t; + typedef unaligned_type host_long_t; + typedef unaligned_type host_ulong_t; + typedef unaligned_type host_long_long_t; typedef unaligned_type host_ulong_long_t; #if ETL_USING_8BIT_TYPES - typedef unaligned_type host_int8_t; - typedef unaligned_type host_uint8_t; + typedef unaligned_type host_int8_t; + typedef unaligned_type host_uint8_t; #endif - typedef unaligned_type host_int16_t; - typedef unaligned_type host_uint16_t; - typedef unaligned_type host_int32_t; - typedef unaligned_type host_uint32_t; + typedef unaligned_type host_int16_t; + typedef unaligned_type host_uint16_t; + typedef unaligned_type host_int32_t; + typedef unaligned_type host_uint32_t; #if ETL_USING_64BIT_TYPES - typedef unaligned_type host_int64_t; - typedef unaligned_type host_uint64_t; + typedef unaligned_type host_int64_t; + typedef unaligned_type host_uint64_t; #endif - typedef unaligned_type host_float_t; - typedef unaligned_type host_double_t; - typedef unaligned_type host_long_double_t; + typedef unaligned_type host_float_t; + typedef unaligned_type host_double_t; + typedef unaligned_type host_long_double_t; #endif // Little Endian - typedef unaligned_type le_char_t; - typedef unaligned_type le_schar_t; - typedef unaligned_type le_uchar_t; - typedef unaligned_type le_short_t; - typedef unaligned_type le_ushort_t; - typedef unaligned_type le_int_t; - typedef unaligned_type le_uint_t; - typedef unaligned_type le_long_t; - typedef unaligned_type le_ulong_t; - typedef unaligned_type le_long_long_t; + typedef unaligned_type le_char_t; + typedef unaligned_type le_schar_t; + typedef unaligned_type le_uchar_t; + typedef unaligned_type le_short_t; + typedef unaligned_type le_ushort_t; + typedef unaligned_type le_int_t; + typedef unaligned_type le_uint_t; + typedef unaligned_type le_long_t; + typedef unaligned_type le_ulong_t; + typedef unaligned_type le_long_long_t; typedef unaligned_type le_ulong_long_t; #if ETL_USING_8BIT_TYPES - typedef unaligned_type le_int8_t; - typedef unaligned_type le_uint8_t; + typedef unaligned_type le_int8_t; + typedef unaligned_type le_uint8_t; #endif - typedef unaligned_type le_int16_t; - typedef unaligned_type le_uint16_t; - typedef unaligned_type le_int32_t; - typedef unaligned_type le_uint32_t; + typedef unaligned_type le_int16_t; + typedef unaligned_type le_uint16_t; + typedef unaligned_type le_int32_t; + typedef unaligned_type le_uint32_t; #if ETL_USING_64BIT_TYPES - typedef unaligned_type le_int64_t; - typedef unaligned_type le_uint64_t; + typedef unaligned_type le_int64_t; + typedef unaligned_type le_uint64_t; #endif - typedef unaligned_type le_float_t; - typedef unaligned_type le_double_t; - typedef unaligned_type le_long_double_t; + typedef unaligned_type le_float_t; + typedef unaligned_type le_double_t; + typedef unaligned_type le_long_double_t; // Big Endian - typedef unaligned_type be_char_t; - typedef unaligned_type be_schar_t; - typedef unaligned_type be_uchar_t; - typedef unaligned_type be_short_t; - typedef unaligned_type be_ushort_t; - typedef unaligned_type be_int_t; - typedef unaligned_type be_uint_t; - typedef unaligned_type be_long_t; - typedef unaligned_type be_ulong_t; - typedef unaligned_type be_long_long_t; + typedef unaligned_type be_char_t; + typedef unaligned_type be_schar_t; + typedef unaligned_type be_uchar_t; + typedef unaligned_type be_short_t; + typedef unaligned_type be_ushort_t; + typedef unaligned_type be_int_t; + typedef unaligned_type be_uint_t; + typedef unaligned_type be_long_t; + typedef unaligned_type be_ulong_t; + typedef unaligned_type be_long_long_t; typedef unaligned_type be_ulong_long_t; #if ETL_USING_8BIT_TYPES - typedef unaligned_type be_int8_t; - typedef unaligned_type be_uint8_t; + typedef unaligned_type be_int8_t; + typedef unaligned_type be_uint8_t; #endif - typedef unaligned_type be_int16_t; - typedef unaligned_type be_uint16_t; - typedef unaligned_type be_int32_t; - typedef unaligned_type be_uint32_t; + typedef unaligned_type be_int16_t; + typedef unaligned_type be_uint16_t; + typedef unaligned_type be_int32_t; + typedef unaligned_type be_uint32_t; #if ETL_USING_64BIT_TYPES - typedef unaligned_type be_int64_t; - typedef unaligned_type be_uint64_t; + typedef unaligned_type be_int64_t; + typedef unaligned_type be_uint64_t; #endif - typedef unaligned_type be_float_t; - typedef unaligned_type be_double_t; - typedef unaligned_type be_long_double_t; + typedef unaligned_type be_float_t; + typedef unaligned_type be_double_t; + typedef unaligned_type be_long_double_t; // Network Order typedef be_char_t net_char_t; diff --git a/src/etl/unordered_map.h b/src/etl/unordered_map.h index fab74e8..d8ed62a 100644 --- a/src/etl/unordered_map.h +++ b/src/etl/unordered_map.h @@ -1748,7 +1748,7 @@ namespace etl template , typename TKeyEqual = etl::equal_to, typename... TPairs> constexpr auto make_unordered_map(TPairs&&... pairs) -> etl::unordered_map { - return { {etl::forward(pairs)...} }; + return { etl::forward(pairs)... }; } #endif } diff --git a/src/etl/unordered_multimap.h b/src/etl/unordered_multimap.h index 53d9f43..bb1ac4b 100644 --- a/src/etl/unordered_multimap.h +++ b/src/etl/unordered_multimap.h @@ -1616,7 +1616,7 @@ namespace etl template , typename TKeyEqual = etl::equal_to, typename... TPairs> constexpr auto make_unordered_multimap(TPairs&&... pairs) -> etl::unordered_multimap { - return { {etl::forward(pairs)...} }; + return { etl::forward(pairs)... }; } #endif } diff --git a/src/etl/unordered_multiset.h b/src/etl/unordered_multiset.h index a24eb3f..212344b 100644 --- a/src/etl/unordered_multiset.h +++ b/src/etl/unordered_multiset.h @@ -1593,7 +1593,7 @@ namespace etl template , typename TKeyEqual = etl::equal_to, typename... T> constexpr auto make_unordered_multiset(T&&... keys) -> etl::unordered_multiset { - return { {etl::forward(keys)...} }; + return { etl::forward(keys)... }; } #endif } diff --git a/src/etl/unordered_set.h b/src/etl/unordered_set.h index 28e6360..2b426ac 100644 --- a/src/etl/unordered_set.h +++ b/src/etl/unordered_set.h @@ -1610,7 +1610,7 @@ namespace etl template , typename TKeyEqual = etl::equal_to, typename... T> constexpr auto make_unordered_set(T&&... keys) -> etl::unordered_set { - return { {etl::forward(keys)...} }; + return { etl::forward(keys)... }; } #endif } diff --git a/src/etl/vector.h b/src/etl/vector.h index 970f82a..80994bd 100644 --- a/src/etl/vector.h +++ b/src/etl/vector.h @@ -269,6 +269,7 @@ namespace etl //********************************************************************* void reserve(size_t n) { + (void)n; // Stop 'unused parameter' warning in release mode. ETL_ASSERT(n <= CAPACITY, ETL_ERROR(vector_out_of_bounds)); } diff --git a/src/etl/version.h b/src/etl/version.h index 34db9c9..db5ed6d 100644 --- a/src/etl/version.h +++ b/src/etl/version.h @@ -40,7 +40,7 @@ SOFTWARE. #define ETL_VERSION_MAJOR 20 #define ETL_VERSION_MINOR 39 -#define ETL_VERSION_PATCH 0 +#define ETL_VERSION_PATCH 4 #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)