diff --git a/aegisub/libaegisub/include/libaegisub/line_iterator.h b/aegisub/libaegisub/include/libaegisub/line_iterator.h index f5af819dc..4388a61d3 100644 --- a/aegisub/libaegisub/include/libaegisub/line_iterator.h +++ b/aegisub/libaegisub/include/libaegisub/line_iterator.h @@ -81,12 +81,14 @@ public: init(); ++(*this); } + /// @brief Invalid iterator constructor; use for end iterator line_iterator() : stream(0) , valid(false) { } + /// @brief Copy constructor /// @param that line_iterator to copy from line_iterator(line_iterator const& that) @@ -100,27 +102,22 @@ public: , width(that.width) { } - OutputType const& operator*() const { - return value; - } - OutputType const* operator->() const { - return &value; - } + + OutputType const& operator*() const { return value; } + OutputType const* operator->() const { return &value; } + line_iterator& operator++() { next(); return *this; } line_iterator operator++(int) { line_iterator tmp(*this); - ++(*this); + ++*this; return tmp; } - bool operator==(line_iterator const& rgt) const { - return valid == rgt.valid; - } - bool operator!=(line_iterator const& rgt) const { - return !operator==(rgt); - } + + bool operator==(line_iterator const& rgt) const { return valid == rgt.valid; } + bool operator!=(line_iterator const& rgt) const { return !operator==(rgt); } // typedefs needed by some stl algorithms typedef OutputType* pointer; @@ -133,6 +130,7 @@ public: swap(*this, that); return *this; } + void swap(line_iterator &that) throw() { using std::swap; swap(stream, that.stream);