diff --git a/json/tree.cpp b/json/tree.cpp index badaf8d5..e5296ccd 100644 --- a/json/tree.cpp +++ b/json/tree.cpp @@ -528,6 +528,58 @@ json::tree::array::operator[] (unsigned int idx) const } +//----------------------------------------------------------------------------- +json::tree::array::iterator +json::tree::array::begin (void) +{ + return iterator (m_values.begin ()); +} + + + +//----------------------------------------------------------------------------- +json::tree::array::iterator +json::tree::array::end (void) +{ + return iterator (m_values.end ()); +} + + + +//----------------------------------------------------------------------------- +json::tree::array::const_iterator +json::tree::array::begin (void) const +{ + return const_iterator (m_values.begin ()); +} + + + +//----------------------------------------------------------------------------- +json::tree::array::const_iterator +json::tree::array::end (void) const +{ + return const_iterator (m_values.end ()); +} + + + +//----------------------------------------------------------------------------- +json::tree::array::const_iterator +json::tree::array::cbegin (void) const +{ + return const_iterator (m_values.cbegin ()); +} + + +//----------------------------------------------------------------------------- +json::tree::array::const_iterator +json::tree::array::cend (void) const +{ + return const_iterator (m_values.cend ()); +} + + //----------------------------------------------------------------------------- std::ostream& json::tree::array::write (std::ostream &os) const { diff --git a/json/tree.hpp b/json/tree.hpp index 4d0f14c1..dc3e2343 100644 --- a/json/tree.hpp +++ b/json/tree.hpp @@ -139,6 +139,8 @@ namespace json { namespace tree { virtual const_iterator begin (void) const; virtual const_iterator end (void) const; + virtual const_iterator cbegin (void) const { return begin (); } + virtual const_iterator cend (void) const { return end (); } virtual std::ostream& write (std::ostream &os) const; }; @@ -175,8 +177,12 @@ namespace json { namespace tree { virtual node& operator [](unsigned int idx); virtual const node& operator [](unsigned int idx) const; - virtual const_iterator begin (void) const { return const_iterator (m_values.begin ()); } - virtual const_iterator end (void) const { return const_iterator (m_values.end ()); } + virtual iterator begin (void); + virtual iterator end (void); + virtual const_iterator begin (void) const; + virtual const_iterator end (void) const; + virtual const_iterator cbegin (void) const; + virtual const_iterator cend (void) const; virtual void insert (std::unique_ptr &&_value);