@@ -49,9 +49,9 @@ class blocking_iterator {
4949 * @param chan Reference to the channel this iterator will iterate over.
5050 * @param is_end If true, the iterator is in an end state (no elements to read).
5151 */
52- explicit blocking_iterator (Channel& chan, bool is_end = false ) : chan_{chan}, is_end_{is_end}
52+ explicit blocking_iterator (Channel& chan, bool is_end = false ) : chan_{& chan}, is_end_{is_end}
5353 {
54- if (!is_end_ && !chan_. read (value_)) {
54+ if (!is_end_ && !chan_-> read (value_)) {
5555 is_end_ = true ;
5656 }
5757 }
@@ -63,7 +63,7 @@ class blocking_iterator {
6363 */
6464 blocking_iterator<Channel> operator ++() noexcept
6565 {
66- if (!chan_. read (value_)) {
66+ if (!chan_-> read (value_)) {
6767 is_end_ = true ;
6868 }
6969 return *this ;
@@ -87,7 +87,7 @@ class blocking_iterator {
8787 bool operator !=(const blocking_iterator& other) { return is_end_ != other.is_end_ ; }
8888
8989 private:
90- Channel& chan_;
90+ Channel* chan_;
9191 value_type value_{};
9292 bool is_end_{false };
9393};
@@ -132,7 +132,7 @@ class blocking_writer_iterator {
132132 *
133133 * @param chan Reference to the channel this iterator will write into.
134134 */
135- explicit blocking_writer_iterator (Channel& chan) : chan_{chan} {}
135+ explicit blocking_writer_iterator (Channel& chan) : chan_{& chan} {}
136136
137137 /* *
138138 * @brief Writes an element into the channel, blocking until space is available.
@@ -143,7 +143,7 @@ class blocking_writer_iterator {
143143 */
144144 blocking_writer_iterator& operator =(const value_type& val)
145145 {
146- chan_. write (val);
146+ chan_-> write (val);
147147 return *this ;
148148 }
149149
@@ -169,7 +169,7 @@ class blocking_writer_iterator {
169169 blocking_writer_iterator operator ++(int ) { return *this ; }
170170
171171 private:
172- Channel& chan_;
172+ Channel* chan_;
173173};
174174
175175/* *
0 commit comments