diff options
Diffstat (limited to 'include/string')
-rw-r--r-- | include/string | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/include/string b/include/string index f1cfe93..6215bf3 100644 --- a/include/string +++ b/include/string @@ -31,6 +31,7 @@ #define ANDROID_ASTL_STRING__ #include <cstddef> +#include <iterator> namespace std { @@ -47,14 +48,21 @@ namespace std { // allocation parameter. // . The implementation is not optimized in any way (no copy on write support), // temporary instance may be expensive. -// . Currently there is no support for iterators. +// . Currently there is limited support for iterators. // class string { public: - typedef size_t size_type; - typedef char value_type; + typedef size_t size_type; + typedef char value_type; + typedef ptrdiff_t difference_type; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef __wrapper_iterator<pointer,string> iterator; + typedef __wrapper_iterator<const_pointer,string> const_iterator; static const size_type npos = static_cast<size_type>(-1); @@ -241,6 +249,12 @@ class string // starting position. size_type find(const value_type *str, size_type pos = 0) const; + // Iterators + iterator begin() {return iterator(mData);} + const_iterator begin() const {return const_iterator(mData);} + iterator end() {return iterator(mData + mLength);} + const_iterator end() const {return const_iterator(mData + mLength);} + private: bool SafeMalloc(size_type n); void SafeRealloc(size_type n); |