Closed niekbouman closed 10 months ago
These two in class typedef are not required by the standard. And in fact,
by providing them will stop the iterator_traits auto generating them. You
will find most of the c++20 iterators not providing these typedef. Instead,
you should always query
typename iterator_traits
This typedef is generated from operator*
So I would argue it is a bug in boost lib( but it is likely boost lib was created pre-c++20 so it is still assuming the old iterator model)
Regarding pointer, we did it on propose that we don’t provide operator-> at all so iterator_trait::pointer will be void most likely. Note that operator-> is not required at all to be an iterator. And it does not make too much sense for concat iterator to provide one.
Cheers Hui
On Tue, 28 Nov 2023 at 22:04, niekbouman @.***> wrote:
hi Hui,
When using some boost lib with concat_view, I got a compiler errors about missing iterator::reference and iterator::pointer typedefs. After manually adding them (see below) things seem to work for my use case. Any particular reason for not exposing reference and pointer in the concat_view's iterator type?
// ... template
class iterator : public xo::iter_cat_base_t<Const, Views...> { public: using value_type = xo::concat_value_t<maybe_const<Const, Views>...>; using difference_type = common_type_t<range_difference_t<maybe_const<Const, Views>>...>; using iterator_concept = decltype(xo::iterator_concept_test<Const, Views...>()); // I added the two lines below using reference = xo::concat_reference_t<__maybe_const<Const, Views>...>; using pointer = xo::concat_pointer_t<__maybe_const<Const, Views>...>;
// ...
— Reply to this email directly, view it on GitHub https://github.com/huixie90/cpp_papers/issues/5, or unsubscribe https://github.com/notifications/unsubscribe-auth/APXDY5TWDXAM7LS3QPH7KPTYGZNXPAVCNFSM6AAAAAA76OZYECVHI2DSMVQWIX3LMV43ASLTON2WKOZSGAYTKNBQGI4TQMQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
ah I see, thanks a lot for your explanation..!
hi Hui,
When using some boost lib with concat_view, I got a compiler errors about missing
iterator::reference
anditerator::pointer
typedefs. After manually adding them (see below) things seem to work for my use case. Any particular reason for not exposingreference
andpointer
in the concat_view's iterator type?