aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/ext
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2011-05-31 12:50:31 +0000
committerPaolo Carlini <paolo.carlini@oracle.com>2011-05-31 12:50:31 +0000
commit448f49d4bdca2dae32004bf92cc0717b7078d1a9 (patch)
tree41026865ae3bf7df9b8b46f92059b682c8662da2 /libstdc++-v3/include/ext
parent313b7b7f22f046fdc9b952c020e3f8640be4e687 (diff)
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. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@174479 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/ext')
-rw-r--r--libstdc++-v3/include/ext/vstring.h65
-rw-r--r--libstdc++-v3/include/ext/vstring.tcc8
2 files changed, 40 insertions, 33 deletions
diff --git a/libstdc++-v3/include/ext/vstring.h b/libstdc++-v3/include/ext/vstring.h
index 442a3922579..08e85264655 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 588985bbe92..2e059e0764d 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)