From 1e2c0906eeaf6050034a17d06c9d40c16a3f29cd Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Mon, 31 May 2010 14:14:42 +0000 Subject: basic_string.h (front, back): Add. 2010-05-31 Paolo Carlini * include/bits/basic_string.h (front, back): Add. * include/debug/string: Adjust. * include/ext/vstring.h (front, back): Tweak the implementation to follow more closely the letter of the specs. * testsuite/21_strings/basic_string/element_access/char/ front_back.cc: New. * testsuite/21_strings/basic_string/element_access/wchar_t/ front_back.cc: Likewise. * config/abi/pre/gnu.ver: Export new symbols. * testsuite/util/testsuite_abi.cc: Adjust. * configure.ac: Bump minor version to 6:15:0. * configure: Regenerate. From-SVN: r160071 --- libstdc++-v3/include/ext/vstring.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'libstdc++-v3/include/ext/vstring.h') diff --git a/libstdc++-v3/include/ext/vstring.h b/libstdc++-v3/include/ext/vstring.h index fc469cb..dffd35a 100644 --- a/libstdc++-v3/include/ext/vstring.h +++ b/libstdc++-v3/include/ext/vstring.h @@ -62,8 +62,8 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) typedef _Alloc allocator_type; typedef typename _CharT_alloc_type::size_type size_type; typedef typename _CharT_alloc_type::difference_type difference_type; - typedef typename _CharT_alloc_type::reference reference; - typedef typename _CharT_alloc_type::const_reference const_reference; + typedef value_type& reference; + typedef const value_type& const_reference; typedef typename _CharT_alloc_type::pointer pointer; typedef typename _CharT_alloc_type::const_pointer const_pointer; typedef __gnu_cxx::__normal_iterator iterator; @@ -598,7 +598,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) */ reference front() - { return *begin(); } + { return operator[](0); } /** * Returns a read-only (constant) reference to the data at the first @@ -606,7 +606,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) */ const_reference front() const - { return *begin(); } + { return operator[](0); } /** * Returns a read/write reference to the data at the last @@ -614,7 +614,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) */ reference back() - { return *(end() - 1); } + { return operator[](this->size() - 1); } /** * Returns a read-only (constant) reference to the data at the @@ -622,7 +622,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) */ const_reference back() const - { return *(end() - 1); } + { return operator[](this->size() - 1); } #endif // Modifiers: -- cgit v1.1