From f405352fee01c167226990a5b871c515942f7938 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 31 Mar 2015 00:14:24 +0200 Subject: QByteArray: add {const_,reverse_iterator}, {c,}r{begin,end}() Had to mark {,c,const}{begin,end}() inline, since they are, and mingw complains about inconsistent dllimport attributes. [ChangeLog][QtCore][QByteArray] Added rbegin(), crbegin(), rend(), crend(), and reverse_iterator and const_reverse_iterator typedefs. Task-number: QTBUG-25919 Change-Id: Id5aefb52635f029305135afcd99db0b036a7af82 Reviewed-by: Thiago Macieira --- src/corelib/tools/qbytearray.h | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'src/corelib/tools/qbytearray.h') diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h index 7388c4eee5..f0032227e8 100644 --- a/src/corelib/tools/qbytearray.h +++ b/src/corelib/tools/qbytearray.h @@ -43,6 +43,7 @@ #include #include +#include #ifdef truncate #error qbytearray.h must be included before any header file that defines truncate @@ -390,14 +391,22 @@ public: typedef const char *const_iterator; typedef iterator Iterator; typedef const_iterator ConstIterator; - iterator begin(); - const_iterator begin() const; - const_iterator cbegin() const; - const_iterator constBegin() const; - iterator end(); - const_iterator end() const; - const_iterator cend() const; - const_iterator constEnd() const; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + inline iterator begin(); + inline const_iterator begin() const; + inline const_iterator cbegin() const; + inline const_iterator constBegin() const; + inline iterator end(); + inline const_iterator end() const; + inline const_iterator cend() const; + inline const_iterator constEnd() const; + reverse_iterator rbegin() { return reverse_iterator(end()); } + reverse_iterator rend() { return reverse_iterator(begin()); } + const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } + const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } + const_reverse_iterator crbegin() const { return const_reverse_iterator(end()); } + const_reverse_iterator crend() const { return const_reverse_iterator(begin()); } // stl compatibility typedef int size_type; -- cgit v1.2.3