path: root/src/corelib/tools/qlinkedlist.h
diff options
authorMarc Mutz <>2011-08-29 17:49:48 +0200
committerQt by Nokia <>2012-03-17 09:10:57 +0100
commitd823646db3e9f72569717dc656e5b2e4d3ce7709 (patch)
tree734f7f11b381eb890d406b05f93424e3081795d6 /src/corelib/tools/qlinkedlist.h
parent7c7e47493edec987569a60e12456de5a2c62a230 (diff)
containers: add C++11-style c{begin,end}() as alias for const{Begin,End}()
C++11 adds cbegin()/cend() functions for the same reason Qt has constBegin()/constEnd(). This patch adds these functions to the Qt containers with the same implementation as constBegin()/constEnd(). It also fixes the return types in the documentation of existing constFind() functions (documentation only). C++11 only adds cbegin()/cend() (and crbegin()/crend(), which Qt doesn't have). In particular, it doesn't add cfind(), so I didn't supply these, even though Qt comes with constFind(). This is a forward-port of Change-Id: Ida086b64246b24e25254eafbcb06c8e33388502b Reviewed-by: Olivier Goffart <>
Diffstat (limited to 'src/corelib/tools/qlinkedlist.h')
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h
index 2e6d05ac35..2b23fc230c 100644
--- a/src/corelib/tools/qlinkedlist.h
+++ b/src/corelib/tools/qlinkedlist.h
@@ -180,9 +180,11 @@ public:
// stl style
inline iterator begin() { detach(); return e->n; }
inline const_iterator begin() const { return e->n; }
+ inline const_iterator cbegin() const { return e->n; }
inline const_iterator constBegin() const { return e->n; }
inline iterator end() { detach(); return e; }
inline const_iterator end() const { return e; }
+ inline const_iterator cend() const { return e; }
inline const_iterator constEnd() const { return e; }
iterator insert(iterator before, const T &t);
iterator erase(iterator pos);