Move definition of data() in iterator.h

Needs to be defined earlier.
This commit is contained in:
Roland Reichwein 2026-04-04 21:06:12 +02:00
parent ea67ec9a43
commit 95738f5674

View File

@ -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 <typename TContainer>
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 <typename TContainer>
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 <typename TValue, size_t Array_Size>
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 <typename TValue, size_t Array_Size>
ETL_CONSTEXPR const TValue* data(const TValue (&a)[Array_Size])
{
return a;
}
#endif
#if ETL_USING_CPP17
template <class T>
using iter_value_t = typename etl::iterator_traits<etl::remove_cvref_t<T>>::value_type;
@ -1962,52 +2008,6 @@ namespace etl
inline constexpr bool is_range_v = is_range<T>::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 <typename TContainer>
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 <typename TContainer>
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 <typename TValue, size_t Array_Size>
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 <typename TValue, size_t Array_Size>
ETL_CONSTEXPR const TValue* data(const TValue (&a)[Array_Size])
{
return a;
}
#endif
} // namespace etl
#endif