aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/debug
diff options
context:
space:
mode:
authorPaolo Carlini <paolo@gcc.gnu.org>2005-05-24 10:58:22 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2005-05-24 10:58:22 +0000
commit561e7a36e38004d567ada2f0dac327b80d506009 (patch)
tree0175cad2a36b98bce2a07e455d894b5cfd122bff /libstdc++-v3/include/debug
parent89f9fe50b1185280cc8cfe89a248f7dac7727fee (diff)
downloadgcc-561e7a36e38004d567ada2f0dac327b80d506009.zip
gcc-561e7a36e38004d567ada2f0dac327b80d506009.tar.gz
gcc-561e7a36e38004d567ada2f0dac327b80d506009.tar.bz2
[multiple changes]
2005-05-24 Jonathan Wakely <redi@gcc.gnu.org> * include/debug/string (class basic_string): Add missing default template arguments; provide typedefs for char and wchar_t. (operator[]): Allow s[s.size()] in debug mode, but not pedantic mode. 2005-05-24 Paolo Carlini <pcarlini@suse.de> Port from libstdcxx_so_7-branch: 2005-04-25 Christopher Jefferson <chris@bubblescope.net> * include/bits/stl_algo.h (count): Correct concept checks. (search_n) : Likewise. * testsuite/25_algorithms/search_n/check_type.cc: New. * testsuite/testsuite_iterators.h (random_access_iterator_wrapper::operator+): Move out of class to external function, and add symmetric version. 2005-03-14 Christopher Jefferson <chris@bubblescope.net> * testsuite/testsuite_iterators.h (WritableObject::WritableObject): Add const. 2005-02-01 Christopher Jefferson <chris@bubblescope.net> * testsuite/testsuite_iterators.h (random_access_iterator_wrapper:: operator--): Fix typo. (OutputContainer::OutputContainer): Correct zeroing array. (WritableObject::operator==): Fix typo. (WritableObject::operator=): make operator= templated to allow differing types to be assigned. (WritableObject::operator++): Fix checking if iterator is written to multiple times. (random_access_iterator_wrapper::operator+): Add const. (random_access_iterator_wrapper::operator-): Likewise. (random_access_iterator_wrapper::operator[]): Add dereference. From-SVN: r100101
Diffstat (limited to 'libstdc++-v3/include/debug')
-rw-r--r--libstdc++-v3/include/debug/string21
1 files changed, 19 insertions, 2 deletions
diff --git a/libstdc++-v3/include/debug/string b/libstdc++-v3/include/debug/string
index a91c004..3893cd2 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,
@@ -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