I'm trying to replace this very succinct use of views (which compiles and passes tests):
```
auto LayersThatShouldPushProperties() const {
return std::views::transform(layers_that_should_push_properties_,
[this](int id) { return find(id)->get(); });
```
... with a custom iterator class, but hitting a compiler error I can't quite figure, and I'd appreciate any available help. Here's the code:
```
class DirtyLayerIterator {
public:
DirtyLayerIterator(const OwnedLayerImplList& layer_list,
SetType::const_iterator cur)
: layer_list_(layer_list), cur_(cur) {}
DirtyLayerIterator(const DirtyLayerIterator&) = default;
DirtyLayerIterator(DirtyLayerIterator&&) = default;
DirtyLayerIterator& operator=(const DirtyLayerIterator&) = default;
DirtyLayerIterator& operator=(DirtyLayerIterator&&) = default;
LayerImpl* operator*() { return layer_list_->find(*cur_)->get(); }
DirtyLayerIterator& operator++() {
++cur_;
return *this;
}
DirtyLayerIterator operator++(int) {
DirtyLayerIterator result(*this);
++*this;
return result;
}
private:
raw_ref<const OwnedLayerImplList> layer_list_;
SetType::const_iterator cur_;
};
class DirtyLayerRange {
public:
explicit DirtyLayerRange(const OwnedLayerImplList& layer_list)
: layer_list_(layer_list) {}
DirtyLayerRange(const DirtyLayerRange&) = default;
DirtyLayerRange(DirtyLayerRange&&) = default;
DirtyLayerRange& operator=(const DirtyLayerRange&) = default;
DirtyLayerRange& operator=(DirtyLayerRange&&) = default;
DirtyLayerIterator begin() const {
return {*layer_list_,
layer_list_->layers_that_should_push_properties_.begin()};
}
DirtyLayerIterator end() const {
return {*layer_list_,
layer_list_->layers_that_should_push_properties_.end()};
}
size_type size() const {
return layer_list_->layers_that_should_push_properties_.size();
}
private:
raw_ref<const OwnedLayerImplList> layer_list_;
};
static_assert(std::ranges::range<DirtyLayerRange>);
```
The `static_assert` fails with:
../../cc/layers/layer_collections.h:164:17: error: static assertion failed
164 | static_assert(std::ranges::range<DirtyLayerRange>);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../cc/layers/layer_collections.h:164:17: note: because 'DirtyLayerRange' does not satisfy 'range'
gen/third_party/libc++/src/include/__ranges/concepts.h:52:3: note: because 'ranges::begin(__t)' would be invalid: call to deleted function call operator in type 'const __begin::__fn'
52 | ranges::begin(__t); // sometimes equality-preserving
| ^
1 error generated.
SOS!