From cf7d548d176d411fbd0a6eef6e7b8aad59d17de5 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Fri, 7 Jun 2013 20:04:38 -0700 Subject: [PATCH] Cosmetics in line_iterator --- .../include/libaegisub/line_iterator.h | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) 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);