etl/include
Roland Reichwein af3944acdb
Fix iterator_traits: make SFINAE-friendly for iterators without nested typedefs (#1447)
The primary etl::iterator_traits template previously required all five
nested typedefs (iterator_category, value_type, difference_type,
pointer, reference) to exist, causing hard compilation errors with
iterators like std::common_iterator or ranges::common_iterator.

Changes:

1. Make primary template SFINAE-friendly: split into an empty primary
   template and a void_t-guarded partial specialization that only
   activates when all nested typedefs are present.

2. Add explicit std::common_iterator specialization (C++20/STL): a
   partial specialization that delegates to
   std::iterator_traits<std::common_iterator<I,S>>.

3. Fall through to std::iterator_traits: the empty primary template
   inherits from std::iterator_traits<TIterator> when building with
   STL and C++20, so any iterator with a std::iterator_traits
   specialization works automatically.

4. Remove iterator_traits dependency from etl::vector: assign() now
   uses decltype(*first) for the type-compatibility static assert,
   and insert() uses ptrdiff_t directly instead of querying
   iterator_traits<TIterator>::difference_type.
2026-05-26 09:11:24 +01:00
..
etl Fix iterator_traits: make SFINAE-friendly for iterators without nested typedefs (#1447) 2026-05-26 09:11:24 +01:00