diff options
author | Bernd Schmidt <bernd.schmidt@analog.com> | 2006-02-06 16:36:35 +0000 |
---|---|---|
committer | Bernd Schmidt <bernd.schmidt@analog.com> | 2006-02-06 16:36:35 +0000 |
commit | b3d13cd7ae392041004db6b9bf5098372048c00e (patch) | |
tree | 2adf45987dc9f88c26eeb95b0071647ebb5c87ec /libstdc++-v3/include/debug/string | |
parent | 337db89251de80f8ff7a00b2d71bc333c630b6e4 (diff) |
Merge reload-branch up to revision 101000reload-branch
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/reload-branch@110651 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/debug/string')
-rw-r--r-- | libstdc++-v3/include/debug/string | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/libstdc++-v3/include/debug/string b/libstdc++-v3/include/debug/string index a91c004e937..26a1582d3d8 100644 --- a/libstdc++-v3/include/debug/string +++ b/libstdc++-v3/include/debug/string @@ -1,6 +1,6 @@ // Debugging string implementation -*- C++ -*- -// Copyright (C) 2003 +// Copyright (C) 2003, 2005 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -37,7 +37,8 @@ namespace __gnu_debug { - template<typename _CharT, typename _Traits, typename _Allocator> +template<typename _CharT, typename _Traits = std::char_traits<_CharT>, + typename _Allocator = std::allocator<_CharT> > class basic_string : public std::basic_string<_CharT, _Traits, _Allocator>, public __gnu_debug::_Safe_sequence<basic_string<_CharT, _Traits, @@ -51,12 +52,12 @@ namespace __gnu_debug typedef _Traits traits_type; typedef typename _Traits::char_type value_type; typedef _Allocator allocator_type; - typedef typename _Allocator::size_type size_type; - typedef typename _Allocator::difference_type difference_type; - typedef typename _Allocator::reference reference; - typedef typename _Allocator::const_reference const_reference; - typedef typename _Allocator::pointer pointer; - typedef typename _Allocator::const_pointer const_pointer; + typedef typename _Base::size_type size_type; + typedef typename _Base::difference_type difference_type; + typedef typename _Base::reference reference; + typedef typename _Base::const_reference const_reference; + typedef typename _Base::pointer pointer; + typedef typename _Base::const_pointer const_pointer; typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, basic_string> iterator; @@ -213,7 +214,16 @@ namespace __gnu_debug reference operator[](size_type __pos) { +#ifdef _GLIBCXX_DEBUG_PEDANTIC __glibcxx_check_subscript(__pos); +#else + // as an extension v3 allows s[s.size()] when s is non-const. + _GLIBCXX_DEBUG_VERIFY(__pos <= this->size(), + _M_message(::__gnu_debug::__msg_subscript_oob) + ._M_sequence(*this, "this") + ._M_integer(__pos, "__pos") + ._M_integer(this->size(), "size")); +#endif return _M_base()[__pos]; } @@ -996,6 +1006,13 @@ namespace __gnu_debug __str._M_invalidate_all(); return __res; } + + typedef basic_string<char> string; + +#ifdef _GLIBCXX_USE_WCHAR_T + typedef basic_string<wchar_t> wstring; +#endif + } // namespace __gnu_debug #endif |