-
Notifications
You must be signed in to change notification settings - Fork 70
Closed
Description
https://www.boost.org/doc/libs/1_85_0/libs/iterator/doc/transform_iterator.html says it typedefs iterator_category
based on the underlying iterator. However, nothing in https://github.com/boostorg/iterator/blob/develop/include/boost/iterator/transform_iterator.hpp seems to indicate that it's doing so.
With llvm/llvm-project#112102 disallowing std::prev(non_cpp17_bidi_iterator), we have code that breaks due to transform_iterator
not being bidi even though the underlying iterator is.
Example: https://godbolt.org/z/a6TzjGW91
#include <iostream>
#include <boost/iterator/transform_iterator.hpp>
int main() {
auto d = [](int i) { return i * 2; };
int a[] = {1, 2, 3};
auto begin = boost::make_transform_iterator(std::begin(a), d);
auto end = boost::make_transform_iterator(std::end(a), d);
static_assert(std::bidirectional_iterator<decltype(std::begin(a))>);
static_assert(std::bidirectional_iterator<decltype(begin)>); // this fails
for (auto i = begin; i != end; ++i) {
std::cout << *i << " ";
}
}
adding something like using iterator_category = std::iterator_traits<Iterator>::iterator_category;
around
transform_iterator() { } |
Metadata
Metadata
Assignees
Labels
No labels