38 typename C::iterator first_;
39 typename C::iterator last_;
42 using iterator_category = std::output_iterator_tag;
43 using value_type = void;
44 using difference_type = void;
46 using reference = void;
53 : first_(container.begin()), last_(container.end()) {}
58 throw std::out_of_range(
"assigning outside container limits.");
67 throw std::out_of_range(
"assigning outside container limits.");
69 *first_ = std::move(value);
75 bounds_checked_iterator& operator++() {
An output iterator that throws on writing past the end of a container.
Definition iterator.hh:36
bounds_checked_iterator & operator=(typename C::value_type &&value)
Move-assigns a value through the iterator, throwing if the end is exceeded.
Definition iterator.hh:65
bounds_checked_iterator & operator=(const typename C::value_type &value)
Assigns a value through the iterator, throwing if the end is exceeded.
Definition iterator.hh:56
bounds_checked_iterator(C &container)
Definition iterator.hh:52
bounds_checked_iterator< C > bounds_checked(C &container)
Convenience factory that creates a bounds-checked iterator.
Definition iterator.hh:92