7 #include "arg_router/parsing/token_type.hpp"
117 return {lhs.owner_, lhs.i_ - rhs.i_};
129 return lhs.i_ < rhs.i_;
213 const auto i = i_ - processed().size();
214 return unprocessed()[i];
217 return processed()[i_];
235 return *(*
this + offset);
247 const auto is_this_end = is_end();
248 const auto is_other_end = other.is_end();
251 if (is_this_end && is_other_end) {
254 if (is_this_end || is_other_end) {
258 return (owner_ == other.owner_) && (i_ == other.i_);
283 processed()[i_] = value;
289 iterator() : owner_{nullptr}, i_{0} {}
293 [[nodiscard]]
bool is_end() const noexcept
298 [[nodiscard]] vector<token_type>& processed()
const {
return *(owner_->processed_); }
300 [[nodiscard]] vector<token_type>& unprocessed()
const {
return *(owner_->unprocessed_); }
302 dynamic_token_adapter* owner_;
317 unprocessed_->reserve(
size());
329 return (processed_ == other.processed_) && (unprocessed_ == other.unprocessed_);
360 [[nodiscard]]
size_type size()
const {
return processed_->size() + unprocessed_->size(); }
364 [[nodiscard]]
bool empty()
const {
return processed_->empty() && unprocessed_->empty(); }
390 auto processed_it = it.is_end() ? processed_->end() :
391 processed_->begin() + it.i_;
393 processed_->insert(processed_it, value);
394 return {
this, it.i_};
404 template <
typename Iter>
410 auto processed_it = it.is_end() ? processed_->end() :
411 processed_->begin() + it.i_;
413 processed_->insert(processed_it, first, last);
414 return {
this, it.i_};
431 if (it.i_ < processed_size) {
432 processed_->erase(processed_->begin() + it.i_);
434 const auto offset = it.i_ - processed_size;
435 unprocessed_->erase(unprocessed_->begin() + offset);
458 const auto count = (it.i_ + 1) - processed_->size();
459 processed_->insert(processed_->end(), unprocessed_->begin(), unprocessed_->begin() + count);
460 unprocessed_->erase(unprocessed_->begin(), unprocessed_->begin() + count);
friend iterator operator+(difference_type offset, iterator it) noexcept
friend iterator operator-(iterator lhs, iterator rhs) noexcept
friend bool operator<=(iterator lhs, iterator rhs) noexcept
bool operator==(iterator other) const noexcept
iterator & operator+=(difference_type offset) noexcept
reference operator[](difference_type offset) const noexcept
bool operator!=(iterator other) const noexcept
iterator & operator--() noexcept
friend bool operator<(iterator lhs, iterator rhs) noexcept
iterator & operator-=(difference_type offset) noexcept
iterator operator++(int) noexcept
void set(value_type value)
friend bool operator>=(iterator lhs, iterator rhs) noexcept
friend iterator operator-(difference_type offset, iterator it) noexcept
reference operator*() const noexcept
iterator operator--(int) noexcept
std::ptrdiff_t difference_type
std::forward_iterator_tag iterator_category
friend iterator operator+(iterator it, difference_type offset) noexcept
pointer operator->() const noexcept
friend bool operator>(iterator lhs, iterator rhs) noexcept
friend iterator operator-(iterator it, difference_type offset) noexcept
iterator & operator++() noexcept
dynamic_token_adapter(vector< token_type > &processed, vector< token_type > &unprocessed)
bool operator!=(dynamic_token_adapter other) const
void transfer(iterator it)
iterator insert(iterator it, value_type value)
bool operator==(dynamic_token_adapter other) const
vector< value_type > & processed()
iterator erase(iterator it)
vector< value_type > & unprocessed()
iterator insert(iterator it, Iter first, Iter last)
std::vector< T, config::allocator< T > > vector