From 95738f56743a4a7d25987df543e9536b7c93fa18 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sat, 4 Apr 2026 21:06:12 +0200 Subject: [PATCH] Move definition of data() in iterator.h Needs to be defined earlier. --- include/etl/iterator.h | 92 +++++++++++++++++++++--------------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/include/etl/iterator.h b/include/etl/iterator.h index fb62de80..8a09e7c0 100644 --- a/include/etl/iterator.h +++ b/include/etl/iterator.h @@ -1218,6 +1218,52 @@ namespace etl #define ETL_ARRAY_SIZE(a) sizeof(etl::array_size(a)) +#if ETL_NOT_USING_STL || ETL_CPP17_NOT_SUPPORTED + //************************************************************************** + /// Returns a pointer to the block of memory containing the elements of the + /// range. + ///\ingroup container + //************************************************************************** + template + ETL_CONSTEXPR typename TContainer::pointer data(TContainer& container) + { + return container.data(); + } + + //************************************************************************** + /// Returns a const_pointer to the block of memory containing the elements of + /// the range. + ///\ingroup container + //************************************************************************** + template + ETL_CONSTEXPR typename TContainer::const_pointer data(const TContainer& container) + { + return container.data(); + } + + ///************************************************************************** + /// Returns a pointer to the block of memory containing the elements of the + /// range. + ///\ingroup container + ///************************************************************************** + template + ETL_CONSTEXPR TValue* data(TValue (&a)[Array_Size]) + { + return a; + } + + ///************************************************************************** + /// Returns a const pointer to the block of memory containing the elements of + /// the range. + ///\ingroup container + ///************************************************************************** + template + ETL_CONSTEXPR const TValue* data(const TValue (&a)[Array_Size]) + { + return a; + } +#endif + #if ETL_USING_CPP17 template using iter_value_t = typename etl::iterator_traits>::value_type; @@ -1962,52 +2008,6 @@ namespace etl inline constexpr bool is_range_v = is_range::value; #endif #endif - -#if ETL_NOT_USING_STL || ETL_CPP17_NOT_SUPPORTED - //************************************************************************** - /// Returns a pointer to the block of memory containing the elements of the - /// range. - ///\ingroup container - //************************************************************************** - template - ETL_CONSTEXPR typename TContainer::pointer data(TContainer& container) - { - return container.data(); - } - - //************************************************************************** - /// Returns a const_pointer to the block of memory containing the elements of - /// the range. - ///\ingroup container - //************************************************************************** - template - ETL_CONSTEXPR typename TContainer::const_pointer data(const TContainer& container) - { - return container.data(); - } - - ///************************************************************************** - /// Returns a pointer to the block of memory containing the elements of the - /// range. - ///\ingroup container - ///************************************************************************** - template - ETL_CONSTEXPR TValue* data(TValue (&a)[Array_Size]) - { - return a; - } - - ///************************************************************************** - /// Returns a const pointer to the block of memory containing the elements of - /// the range. - ///\ingroup container - ///************************************************************************** - template - ETL_CONSTEXPR const TValue* data(const TValue (&a)[Array_Size]) - { - return a; - } -#endif } // namespace etl #endif