aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2011-05-31 12:50:31 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2011-05-31 12:50:31 +0000
commitcea8c6deef9e4b39260a8c21091238c85eedc1eb (patch)
tree41026865ae3bf7df9b8b46f92059b682c8662da2
parent35979cc235b090b2607d17598f73e6b079142e23 (diff)
downloadgcc-cea8c6deef9e4b39260a8c21091238c85eedc1eb.zip
gcc-cea8c6deef9e4b39260a8c21091238c85eedc1eb.tar.gz
gcc-cea8c6deef9e4b39260a8c21091238c85eedc1eb.tar.bz2
basic_string.h: Use noexcept per the FDIS (minus compare(const string&)...
2011-05-31 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/basic_string.h: Use noexcept per the FDIS (minus compare(const string&), which uses char_traits::compare, which isn't noexcept; also no noexcept in the move assignment operator and move assign, see c++std-lib-30855). * include/bits/basic_string.tcc: Likewise. * include/ext/vstring.h: Likewise. * include/ext/vstring.tcc: Likewise. * include/debug/string: Likewise. From-SVN: r174479
-rw-r--r--libstdc++-v3/ChangeLog11
-rw-r--r--libstdc++-v3/include/bits/basic_string.h64
-rw-r--r--libstdc++-v3/include/bits/basic_string.tcc8
-rw-r--r--libstdc++-v3/include/debug/string65
-rw-r--r--libstdc++-v3/include/ext/vstring.h65
-rw-r--r--libstdc++-v3/include/ext/vstring.tcc8
6 files changed, 136 insertions, 85 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index bb05cc1..6fcf67f 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,14 @@
+2011-05-31 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/bits/basic_string.h: Use noexcept per the FDIS (minus
+ compare(const string&), which uses char_traits::compare, which
+ isn't noexcept; also no noexcept in the move assignment operator
+ and move assign, see c++std-lib-30855).
+ * include/bits/basic_string.tcc: Likewise.
+ * include/ext/vstring.h: Likewise.
+ * include/ext/vstring.tcc: Likewise.
+ * include/debug/string: Likewise.
+
2011-05-31 Jonathan Wakely <jwakely.gcc@gmail.com>
* doc/xml/manual/status_cxx200x.xml: Update.
diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h
index 102ef77..f82cfbb 100644
--- a/libstdc++-v3/include/bits/basic_string.h
+++ b/libstdc++-v3/include/bits/basic_string.h
@@ -499,7 +499,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* The newly-created string contains the exact contents of @a str.
* @a str is a valid, but unspecified string.
**/
- basic_string(basic_string&& __str)
+ basic_string(basic_string&& __str) noexcept
: _M_dataplus(__str._M_dataplus)
{
#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
@@ -597,7 +597,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* the %string. Unshares the string.
*/
iterator
- begin()
+ begin() _GLIBCXX_NOEXCEPT
{
_M_leak();
return iterator(_M_data());
@@ -608,7 +608,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* character in the %string.
*/
const_iterator
- begin() const
+ begin() const _GLIBCXX_NOEXCEPT
{ return const_iterator(_M_data()); }
/**
@@ -616,7 +616,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* character in the %string. Unshares the string.
*/
iterator
- end()
+ end() _GLIBCXX_NOEXCEPT
{
_M_leak();
return iterator(_M_data() + this->size());
@@ -627,7 +627,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* last character in the %string.
*/
const_iterator
- end() const
+ end() const _GLIBCXX_NOEXCEPT
{ return const_iterator(_M_data() + this->size()); }
/**
@@ -636,7 +636,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* order. Unshares the string.
*/
reverse_iterator
- rbegin()
+ rbegin() _GLIBCXX_NOEXCEPT
{ return reverse_iterator(this->end()); }
/**
@@ -645,7 +645,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* reverse element order.
*/
const_reverse_iterator
- rbegin() const
+ rbegin() const _GLIBCXX_NOEXCEPT
{ return const_reverse_iterator(this->end()); }
/**
@@ -654,7 +654,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* element order. Unshares the string.
*/
reverse_iterator
- rend()
+ rend() _GLIBCXX_NOEXCEPT
{ return reverse_iterator(this->begin()); }
/**
@@ -663,7 +663,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* is done in reverse element order.
*/
const_reverse_iterator
- rend() const
+ rend() const _GLIBCXX_NOEXCEPT
{ return const_reverse_iterator(this->begin()); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
@@ -672,7 +672,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* character in the %string.
*/
const_iterator
- cbegin() const
+ cbegin() const noexcept
{ return const_iterator(this->_M_data()); }
/**
@@ -680,7 +680,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* last character in the %string.
*/
const_iterator
- cend() const
+ cend() const noexcept
{ return const_iterator(this->_M_data() + this->size()); }
/**
@@ -689,7 +689,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* reverse element order.
*/
const_reverse_iterator
- crbegin() const
+ crbegin() const noexcept
{ return const_reverse_iterator(this->end()); }
/**
@@ -698,7 +698,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* is done in reverse element order.
*/
const_reverse_iterator
- crend() const
+ crend() const noexcept
{ return const_reverse_iterator(this->begin()); }
#endif
@@ -707,18 +707,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// Returns the number of characters in the string, not including any
/// null-termination.
size_type
- size() const
+ size() const _GLIBCXX_NOEXCEPT
{ return _M_rep()->_M_length; }
/// Returns the number of characters in the string, not including any
/// null-termination.
size_type
- length() const
+ length() const _GLIBCXX_NOEXCEPT
{ return _M_rep()->_M_length; }
/// Returns the size() of the largest possible %string.
size_type
- max_size() const
+ max_size() const _GLIBCXX_NOEXCEPT
{ return _Rep::_S_max_size; }
/**
@@ -765,7 +765,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* before needing to allocate more memory.
*/
size_type
- capacity() const
+ capacity() const _GLIBCXX_NOEXCEPT
{ return _M_rep()->_M_capacity; }
/**
@@ -792,7 +792,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* Erases the string, making it empty.
*/
void
- clear()
+ clear() _GLIBCXX_NOEXCEPT
{ _M_mutate(0, this->size(), 0); }
/**
@@ -800,7 +800,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* <code>*this == ""</code>.
*/
bool
- empty() const
+ empty() const _GLIBCXX_NOEXCEPT
{ return this->size() == 0; }
// Element access:
@@ -1763,7 +1763,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* happen.
*/
const _CharT*
- c_str() const
+ c_str() const _GLIBCXX_NOEXCEPT
{ return _M_data(); }
/**
@@ -1773,14 +1773,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* happen.
*/
const _CharT*
- data() const
+ data() const _GLIBCXX_NOEXCEPT
{ return _M_data(); }
/**
* @brief Return copy of allocator used to construct this string.
*/
allocator_type
- get_allocator() const
+ get_allocator() const _GLIBCXX_NOEXCEPT
{ return _M_dataplus; }
/**
@@ -1809,6 +1809,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
size_type
find(const basic_string& __str, size_type __pos = 0) const
+ _GLIBCXX_NOEXCEPT
{ return this->find(__str.data(), __pos, __str.size()); }
/**
@@ -1839,7 +1840,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* returns npos.
*/
size_type
- find(_CharT __c, size_type __pos = 0) const;
+ find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT;
/**
* @brief Find last position of a string.
@@ -1853,6 +1854,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
size_type
rfind(const basic_string& __str, size_type __pos = npos) const
+ _GLIBCXX_NOEXCEPT
{ return this->rfind(__str.data(), __pos, __str.size()); }
/**
@@ -1897,7 +1899,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* returns npos.
*/
size_type
- rfind(_CharT __c, size_type __pos = npos) const;
+ rfind(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT;
/**
* @brief Find position of a character of string.
@@ -1911,6 +1913,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
size_type
find_first_of(const basic_string& __str, size_type __pos = 0) const
+ _GLIBCXX_NOEXCEPT
{ return this->find_first_of(__str.data(), __pos, __str.size()); }
/**
@@ -1957,7 +1960,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* Note: equivalent to find(c, pos).
*/
size_type
- find_first_of(_CharT __c, size_type __pos = 0) const
+ find_first_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
{ return this->find(__c, __pos); }
/**
@@ -1972,6 +1975,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
size_type
find_last_of(const basic_string& __str, size_type __pos = npos) const
+ _GLIBCXX_NOEXCEPT
{ return this->find_last_of(__str.data(), __pos, __str.size()); }
/**
@@ -2018,7 +2022,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* Note: equivalent to rfind(c, pos).
*/
size_type
- find_last_of(_CharT __c, size_type __pos = npos) const
+ find_last_of(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT
{ return this->rfind(__c, __pos); }
/**
@@ -2033,6 +2037,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
size_type
find_first_not_of(const basic_string& __str, size_type __pos = 0) const
+ _GLIBCXX_NOEXCEPT
{ return this->find_first_not_of(__str.data(), __pos, __str.size()); }
/**
@@ -2078,7 +2083,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* If not found, returns npos.
*/
size_type
- find_first_not_of(_CharT __c, size_type __pos = 0) const;
+ find_first_not_of(_CharT __c, size_type __pos = 0) const
+ _GLIBCXX_NOEXCEPT;
/**
* @brief Find last position of a character not in string.
@@ -2092,6 +2098,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
size_type
find_last_not_of(const basic_string& __str, size_type __pos = npos) const
+ _GLIBCXX_NOEXCEPT
{ return this->find_last_not_of(__str.data(), __pos, __str.size()); }
/**
@@ -2137,7 +2144,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* found. If not found, returns npos.
*/
size_type
- find_last_not_of(_CharT __c, size_type __pos = npos) const;
+ find_last_not_of(_CharT __c, size_type __pos = npos) const
+ _GLIBCXX_NOEXCEPT;
/**
* @brief Get a substring.
diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/include/bits/basic_string.tcc
index d988334..056e265 100644
--- a/libstdc++-v3/include/bits/basic_string.tcc
+++ b/libstdc++-v3/include/bits/basic_string.tcc
@@ -759,7 +759,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _CharT, typename _Traits, typename _Alloc>
typename basic_string<_CharT, _Traits, _Alloc>::size_type
basic_string<_CharT, _Traits, _Alloc>::
- find(_CharT __c, size_type __pos) const
+ find(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT
{
size_type __ret = npos;
const size_type __size = this->size();
@@ -798,7 +798,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _CharT, typename _Traits, typename _Alloc>
typename basic_string<_CharT, _Traits, _Alloc>::size_type
basic_string<_CharT, _Traits, _Alloc>::
- rfind(_CharT __c, size_type __pos) const
+ rfind(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT
{
size_type __size = this->size();
if (__size)
@@ -863,7 +863,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _CharT, typename _Traits, typename _Alloc>
typename basic_string<_CharT, _Traits, _Alloc>::size_type
basic_string<_CharT, _Traits, _Alloc>::
- find_first_not_of(_CharT __c, size_type __pos) const
+ find_first_not_of(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT
{
for (; __pos < this->size(); ++__pos)
if (!traits_type::eq(_M_data()[__pos], __c))
@@ -895,7 +895,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _CharT, typename _Traits, typename _Alloc>
typename basic_string<_CharT, _Traits, _Alloc>::size_type
basic_string<_CharT, _Traits, _Alloc>::
- find_last_not_of(_CharT __c, size_type __pos) const
+ find_last_not_of(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT
{
size_type __size = this->size();
if (__size)
diff --git a/libstdc++-v3/include/debug/string b/libstdc++-v3/include/debug/string
index fe073f2..0af6901 100644
--- a/libstdc++-v3/include/debug/string
+++ b/libstdc++-v3/include/debug/string
@@ -1,6 +1,6 @@
// Debugging string implementation -*- C++ -*-
-// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -114,7 +114,7 @@ namespace __gnu_debug
{ }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- basic_string(basic_string&& __str)
+ basic_string(basic_string&& __str) noexcept
: _Base(std::move(__str))
{ }
@@ -171,37 +171,55 @@ namespace __gnu_debug
// 21.3.2 iterators:
iterator
- begin()
+ begin() _GLIBCXX_NOEXCEPT
{ return iterator(_Base::begin(), this); }
const_iterator
- begin() const
+ begin() const _GLIBCXX_NOEXCEPT
{ return const_iterator(_Base::begin(), this); }
iterator
- end()
+ end() _GLIBCXX_NOEXCEPT
{ return iterator(_Base::end(), this); }
const_iterator
- end() const
+ end() const _GLIBCXX_NOEXCEPT
{ return const_iterator(_Base::end(), this); }
reverse_iterator
- rbegin()
+ rbegin() _GLIBCXX_NOEXCEPT
{ return reverse_iterator(end()); }
const_reverse_iterator
- rbegin() const
+ rbegin() const _GLIBCXX_NOEXCEPT
{ return const_reverse_iterator(end()); }
reverse_iterator
- rend()
+ rend() _GLIBCXX_NOEXCEPT
{ return reverse_iterator(begin()); }
const_reverse_iterator
- rend() const
+ rend() const _GLIBCXX_NOEXCEPT
{ return const_reverse_iterator(begin()); }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ const_iterator
+ cbegin() const noexcept
+ { return const_iterator(_Base::begin(), this); }
+
+ const_iterator
+ cend() const noexcept
+ { return const_iterator(_Base::end(), this); }
+
+ const_reverse_iterator
+ crbegin() const noexcept
+ { return const_reverse_iterator(end()); }
+
+ const_reverse_iterator
+ crend() const noexcept
+ { return const_reverse_iterator(begin()); }
+#endif
+
// 21.3.3 capacity:
using _Base::size;
using _Base::length;
@@ -226,7 +244,7 @@ namespace __gnu_debug
using _Base::reserve;
void
- clear()
+ clear() _GLIBCXX_NOEXCEPT
{
_Base::clear();
this->_M_invalidate_all();
@@ -672,7 +690,7 @@ namespace __gnu_debug
// 21.3.6 string operations:
const _CharT*
- c_str() const
+ c_str() const _GLIBCXX_NOEXCEPT
{
const _CharT* __res = _Base::c_str();
this->_M_invalidate_all();
@@ -680,7 +698,7 @@ namespace __gnu_debug
}
const _CharT*
- data() const
+ data() const _GLIBCXX_NOEXCEPT
{
const _CharT* __res = _Base::data();
this->_M_invalidate_all();
@@ -691,6 +709,7 @@ namespace __gnu_debug
size_type
find(const basic_string& __str, size_type __pos = 0) const
+ _GLIBCXX_NOEXCEPT
{ return _Base::find(__str, __pos); }
size_type
@@ -708,11 +727,12 @@ namespace __gnu_debug
}
size_type
- find(_CharT __c, size_type __pos = 0) const
+ find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
{ return _Base::find(__c, __pos); }
size_type
rfind(const basic_string& __str, size_type __pos = _Base::npos) const
+ _GLIBCXX_NOEXCEPT
{ return _Base::rfind(__str, __pos); }
size_type
@@ -730,11 +750,12 @@ namespace __gnu_debug
}
size_type
- rfind(_CharT __c, size_type __pos = _Base::npos) const
+ rfind(_CharT __c, size_type __pos = _Base::npos) const _GLIBCXX_NOEXCEPT
{ return _Base::rfind(__c, __pos); }
size_type
find_first_of(const basic_string& __str, size_type __pos = 0) const
+ _GLIBCXX_NOEXCEPT
{ return _Base::find_first_of(__str, __pos); }
size_type
@@ -752,12 +773,12 @@ namespace __gnu_debug
}
size_type
- find_first_of(_CharT __c, size_type __pos = 0) const
+ find_first_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
{ return _Base::find_first_of(__c, __pos); }
size_type
find_last_of(const basic_string& __str,
- size_type __pos = _Base::npos) const
+ size_type __pos = _Base::npos) const _GLIBCXX_NOEXCEPT
{ return _Base::find_last_of(__str, __pos); }
size_type
@@ -776,10 +797,12 @@ namespace __gnu_debug
size_type
find_last_of(_CharT __c, size_type __pos = _Base::npos) const
+ _GLIBCXX_NOEXCEPT
{ return _Base::find_last_of(__c, __pos); }
size_type
find_first_not_of(const basic_string& __str, size_type __pos = 0) const
+ _GLIBCXX_NOEXCEPT
{ return _Base::find_first_not_of(__str, __pos); }
size_type
@@ -797,12 +820,13 @@ namespace __gnu_debug
}
size_type
- find_first_not_of(_CharT __c, size_type __pos = 0) const
+ find_first_not_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
{ return _Base::find_first_not_of(__c, __pos); }
size_type
find_last_not_of(const basic_string& __str,
size_type __pos = _Base::npos) const
+ _GLIBCXX_NOEXCEPT
{ return _Base::find_last_not_of(__str, __pos); }
size_type
@@ -821,6 +845,7 @@ namespace __gnu_debug
size_type
find_last_not_of(_CharT __c, size_type __pos = _Base::npos) const
+ _GLIBCXX_NOEXCEPT
{ return _Base::find_last_not_of(__c, __pos); }
basic_string
@@ -868,10 +893,10 @@ namespace __gnu_debug
}
_Base&
- _M_base() { return *this; }
+ _M_base() _GLIBCXX_NOEXCEPT { return *this; }
const _Base&
- _M_base() const { return *this; }
+ _M_base() const _GLIBCXX_NOEXCEPT { return *this; }
using _Safe_base::_M_invalidate_all;
};
diff --git a/libstdc++-v3/include/ext/vstring.h b/libstdc++-v3/include/ext/vstring.h
index 442a392..08e8526 100644
--- a/libstdc++-v3/include/ext/vstring.h
+++ b/libstdc++-v3/include/ext/vstring.h
@@ -156,7 +156,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @a str. The contents of @a str are a valid, but unspecified
* string.
*/
- __versa_string(__versa_string&& __str)
+ __versa_string(__versa_string&& __str) noexcept
: __vstring_base(std::move(__str)) { }
/**
@@ -309,7 +309,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* the %string. Unshares the string.
*/
iterator
- begin()
+ begin() _GLIBCXX_NOEXCEPT
{
this->_M_leak();
return iterator(this->_M_data());
@@ -320,7 +320,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* character in the %string.
*/
const_iterator
- begin() const
+ begin() const _GLIBCXX_NOEXCEPT
{ return const_iterator(this->_M_data()); }
/**
@@ -328,7 +328,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* character in the %string. Unshares the string.
*/
iterator
- end()
+ end() _GLIBCXX_NOEXCEPT
{
this->_M_leak();
return iterator(this->_M_data() + this->size());
@@ -339,7 +339,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* last character in the %string.
*/
const_iterator
- end() const
+ end() const _GLIBCXX_NOEXCEPT
{ return const_iterator(this->_M_data() + this->size()); }
/**
@@ -348,7 +348,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* order. Unshares the string.
*/
reverse_iterator
- rbegin()
+ rbegin() _GLIBCXX_NOEXCEPT
{ return reverse_iterator(this->end()); }
/**
@@ -357,7 +357,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* reverse element order.
*/
const_reverse_iterator
- rbegin() const
+ rbegin() const _GLIBCXX_NOEXCEPT
{ return const_reverse_iterator(this->end()); }
/**
@@ -366,7 +366,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* element order. Unshares the string.
*/
reverse_iterator
- rend()
+ rend() _GLIBCXX_NOEXCEPT
{ return reverse_iterator(this->begin()); }
/**
@@ -375,7 +375,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* is done in reverse element order.
*/
const_reverse_iterator
- rend() const
+ rend() const _GLIBCXX_NOEXCEPT
{ return const_reverse_iterator(this->begin()); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
@@ -384,7 +384,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* character in the %string.
*/
const_iterator
- cbegin() const
+ cbegin() const noexcept
{ return const_iterator(this->_M_data()); }
/**
@@ -392,7 +392,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* last character in the %string.
*/
const_iterator
- cend() const
+ cend() const noexcept
{ return const_iterator(this->_M_data() + this->size()); }
/**
@@ -401,7 +401,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* reverse element order.
*/
const_reverse_iterator
- crbegin() const
+ crbegin() const noexcept
{ return const_reverse_iterator(this->end()); }
/**
@@ -410,7 +410,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* is done in reverse element order.
*/
const_reverse_iterator
- crend() const
+ crend() const noexcept
{ return const_reverse_iterator(this->begin()); }
#endif
@@ -419,18 +419,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// Returns the number of characters in the string, not including any
/// null-termination.
size_type
- size() const
+ size() const _GLIBCXX_NOEXCEPT
{ return this->_M_length(); }
/// Returns the number of characters in the string, not including any
/// null-termination.
size_type
- length() const
+ length() const _GLIBCXX_NOEXCEPT
{ return this->_M_length(); }
/// Returns the size() of the largest possible %string.
size_type
- max_size() const
+ max_size() const _GLIBCXX_NOEXCEPT
{ return this->_M_max_size(); }
/**
@@ -477,7 +477,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* hold before needing to allocate more memory.
*/
size_type
- capacity() const
+ capacity() const _GLIBCXX_NOEXCEPT
{ return this->_M_capacity(); }
/**
@@ -505,7 +505,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* Erases the string, making it empty.
*/
void
- clear()
+ clear() _GLIBCXX_NOEXCEPT
{ this->_M_clear(); }
/**
@@ -513,7 +513,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* <code>*this == ""</code>.
*/
bool
- empty() const
+ empty() const _GLIBCXX_NOEXCEPT
{ return this->size() == 0; }
// Element access:
@@ -1484,7 +1484,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* happen.
*/
const _CharT*
- c_str() const
+ c_str() const _GLIBCXX_NOEXCEPT
{ return this->_M_data(); }
/**
@@ -1494,14 +1494,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* happen.
*/
const _CharT*
- data() const
+ data() const _GLIBCXX_NOEXCEPT
{ return this->_M_data(); }
/**
* @brief Return copy of allocator used to construct this string.
*/
allocator_type
- get_allocator() const
+ get_allocator() const _GLIBCXX_NOEXCEPT
{ return allocator_type(this->_M_get_allocator()); }
/**
@@ -1531,6 +1531,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
size_type
find(const __versa_string& __str, size_type __pos = 0) const
+ _GLIBCXX_NOEXCEPT
{ return this->find(__str.data(), __pos, __str.size()); }
/**
@@ -1561,7 +1562,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* found. If not found, returns npos.
*/
size_type
- find(_CharT __c, size_type __pos = 0) const;
+ find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT;
/**
* @brief Find last position of a string.
@@ -1575,6 +1576,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
size_type
rfind(const __versa_string& __str, size_type __pos = npos) const
+ _GLIBCXX_NOEXCEPT
{ return this->rfind(__str.data(), __pos, __str.size()); }
/**
@@ -1620,7 +1622,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* found. If not found, returns npos.
*/
size_type
- rfind(_CharT __c, size_type __pos = npos) const;
+ rfind(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT;
/**
* @brief Find position of a character of string.
@@ -1634,6 +1636,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
size_type
find_first_of(const __versa_string& __str, size_type __pos = 0) const
+ _GLIBCXX_NOEXCEPT
{ return this->find_first_of(__str.data(), __pos, __str.size()); }
/**
@@ -1681,7 +1684,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* Note: equivalent to find(c, pos).
*/
size_type
- find_first_of(_CharT __c, size_type __pos = 0) const
+ find_first_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
{ return this->find(__c, __pos); }
/**
@@ -1697,6 +1700,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
size_type
find_last_of(const __versa_string& __str, size_type __pos = npos) const
+ _GLIBCXX_NOEXCEPT
{ return this->find_last_of(__str.data(), __pos, __str.size()); }
/**
@@ -1744,7 +1748,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* Note: equivalent to rfind(c, pos).
*/
size_type
- find_last_of(_CharT __c, size_type __pos = npos) const
+ find_last_of(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT
{ return this->rfind(__c, __pos); }
/**
@@ -1759,6 +1763,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
size_type
find_first_not_of(const __versa_string& __str, size_type __pos = 0) const
+ _GLIBCXX_NOEXCEPT
{ return this->find_first_not_of(__str.data(), __pos, __str.size()); }
/**
@@ -1805,7 +1810,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* index where it was found. If not found, returns npos.
*/
size_type
- find_first_not_of(_CharT __c, size_type __pos = 0) const;
+ find_first_not_of(_CharT __c, size_type __pos = 0) const
+ _GLIBCXX_NOEXCEPT;
/**
* @brief Find last position of a character not in string.
@@ -1820,7 +1826,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
size_type
find_last_not_of(const __versa_string& __str,
- size_type __pos = npos) const
+ size_type __pos = npos) const _GLIBCXX_NOEXCEPT
{ return this->find_last_not_of(__str.data(), __pos, __str.size()); }
/**
@@ -1867,7 +1873,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* index where it was found. If not found, returns npos.
*/
size_type
- find_last_not_of(_CharT __c, size_type __pos = npos) const;
+ find_last_not_of(_CharT __c, size_type __pos = npos) const
+ _GLIBCXX_NOEXCEPT;
/**
* @brief Get a substring.
diff --git a/libstdc++-v3/include/ext/vstring.tcc b/libstdc++-v3/include/ext/vstring.tcc
index 588985b..2e059e0 100644
--- a/libstdc++-v3/include/ext/vstring.tcc
+++ b/libstdc++-v3/include/ext/vstring.tcc
@@ -291,7 +291,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template <typename, typename, typename> class _Base>
typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
__versa_string<_CharT, _Traits, _Alloc, _Base>::
- find(_CharT __c, size_type __pos) const
+ find(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT
{
size_type __ret = npos;
const size_type __size = this->size();
@@ -332,7 +332,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template <typename, typename, typename> class _Base>
typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
__versa_string<_CharT, _Traits, _Alloc, _Base>::
- rfind(_CharT __c, size_type __pos) const
+ rfind(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT
{
size_type __size = this->size();
if (__size)
@@ -402,7 +402,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template <typename, typename, typename> class _Base>
typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
__versa_string<_CharT, _Traits, _Alloc, _Base>::
- find_first_not_of(_CharT __c, size_type __pos) const
+ find_first_not_of(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT
{
for (; __pos < this->size(); ++__pos)
if (!traits_type::eq(this->_M_data()[__pos], __c))
@@ -436,7 +436,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template <typename, typename, typename> class _Base>
typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type
__versa_string<_CharT, _Traits, _Alloc, _Base>::
- find_last_not_of(_CharT __c, size_type __pos) const
+ find_last_not_of(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT
{
size_type __size = this->size();
if (__size)