Closed jaskij closed 6 months ago
Thanks, I'll check that out.
That's odd, as the base etl::iterator
class defines it.
template <typename TCategory, typename T, typename TDistance = ptrdiff_t, typename TPointer = T* , typename TReference = T& >
struct iterator
{
typedef T value_type;
typedef TDistance difference_type;
typedef TPointer pointer;
typedef TReference reference;
typedef TCategory iterator_category;
};
That's odd, as the base
etl::iterator
class defines it.
Yes, and add_insert_iterator
passes void
for the TDistance
argument.
Of course! 👍
While we're at it, shouldn't value_type
be set to uint8_t
? Then TPointer
and TReference
can be entirely skipped for add_insert_iterator
.
Had some issues with my IDE earlier today, but finally went in and checked. Yup, this works as well.
diff --git a/include/etl/frame_check_sequence.h b/include/etl/frame_check_sequence.h
index dd639550..c040d77c 100644
--- a/include/etl/frame_check_sequence.h
+++ b/include/etl/frame_check_sequence.h
@@ -49,7 +49,7 @@ namespace etl
/// An output iterator used to add new values.
//***************************************************
template <typename TFCS>
- class add_insert_iterator : public etl::iterator<ETL_OR_STD::output_iterator_tag, void, void, void, void>
+ class add_insert_iterator : public etl::iterator<ETL_OR_STD::output_iterator_tag, uint8_t>
{
public:
I think the best solution is where the value type is derived from the frame check sequence template type.
template <typename TFCS>
class add_insert_iterator : public etl::iterator<ETL_OR_STD::output_iterator_tag, typename TFCS::value_type>
You're probably right, I'm not familiar with the internals of ETL and threw in what felt correct.
Have tried using TFCS::value_type
as you proposed, and it works at least in my setup.
Fixed 20.38.9
I have a function which accepts an
std::output_iterator
:Which I wanted to call like so:
But it didn't work due to an unsatisfied constraint:
After some messing around, I realized it's missing
difference_type
in the iterator and came up with this hacky patch: