summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/experimental
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2021-09-17 12:28:35 +0100
committerJonathan Wakely <jwakely@redhat.com>2021-09-17 20:43:34 +0100
commit42eff613d0c10f88dc7a44b14981876401a09981 (patch)
tree91f12bb0a71483c788058ed74bb572f47fa85262 /libstdc++-v3/include/experimental
parent1fa2c5a695bb962ffcf8abed49f69cdcc59d0e61 (diff)
libstdc++: Add 'noexcept' to path::iterator members
All path::iterator operations are non-throwing. Signed-off-by: Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * include/bits/fs_path.h (path::iterator): Add noexcept to all member functions and friend functions. (distance): Add noexcept. (advance): Add noexcept and inline. * include/experimental/bits/fs_path.h (path::iterator): Add noexcept to all member functions.
Diffstat (limited to 'libstdc++-v3/include/experimental')
-rw-r--r--libstdc++-v3/include/experimental/bits/fs_path.h42
1 files changed, 24 insertions, 18 deletions
diff --git a/libstdc++-v3/include/experimental/bits/fs_path.h b/libstdc++-v3/include/experimental/bits/fs_path.h
index a2bc931c696..b26b84c37ab 100644
--- a/libstdc++-v3/include/experimental/bits/fs_path.h
+++ b/libstdc++-v3/include/experimental/bits/fs_path.h
@@ -864,38 +864,44 @@ namespace __detail
using pointer = const path*;
using iterator_category = std::bidirectional_iterator_tag;
- iterator() : _M_path(nullptr), _M_cur(), _M_at_end() { }
+ iterator() noexcept : _M_path(nullptr), _M_cur(), _M_at_end() { }
iterator(const iterator&) = default;
iterator& operator=(const iterator&) = default;
- reference operator*() const;
- pointer operator->() const { return std::__addressof(**this); }
+ reference operator*() const noexcept;
+ pointer operator->() const noexcept { return std::__addressof(**this); }
- iterator& operator++();
- iterator operator++(int) { auto __tmp = *this; ++*this; return __tmp; }
+ iterator& operator++() noexcept;
- iterator& operator--();
- iterator operator--(int) { auto __tmp = *this; --*this; return __tmp; }
+ iterator operator++(int) noexcept
+ { auto __tmp = *this; ++*this; return __tmp; }
- friend bool operator==(const iterator& __lhs, const iterator& __rhs)
+ iterator& operator--() noexcept;
+
+ iterator operator--(int) noexcept
+ { auto __tmp = *this; --*this; return __tmp; }
+
+ friend bool
+ operator==(const iterator& __lhs, const iterator& __rhs) noexcept
{ return __lhs._M_equals(__rhs); }
- friend bool operator!=(const iterator& __lhs, const iterator& __rhs)
+ friend bool
+ operator!=(const iterator& __lhs, const iterator& __rhs) noexcept
{ return !__lhs._M_equals(__rhs); }
private:
friend class path;
- iterator(const path* __path, path::_List::const_iterator __iter)
+ iterator(const path* __path, path::_List::const_iterator __iter) noexcept
: _M_path(__path), _M_cur(__iter), _M_at_end()
{ }
- iterator(const path* __path, bool __at_end)
+ iterator(const path* __path, bool __at_end) noexcept
: _M_path(__path), _M_cur(), _M_at_end(__at_end)
{ }
- bool _M_equals(iterator) const;
+ bool _M_equals(iterator) const noexcept;
const path* _M_path;
path::_List::const_iterator _M_cur;
@@ -1206,7 +1212,7 @@ namespace __detail
}
inline path::iterator
- path::begin() const
+ path::begin() const noexcept
{
if (_M_type == _Type::_Multi)
return iterator(this, _M_cmpts.begin());
@@ -1214,7 +1220,7 @@ namespace __detail
}
inline path::iterator
- path::end() const
+ path::end() const noexcept
{
if (_M_type == _Type::_Multi)
return iterator(this, _M_cmpts.end());
@@ -1222,7 +1228,7 @@ namespace __detail
}
inline path::iterator&
- path::iterator::operator++()
+ path::iterator::operator++() noexcept
{
__glibcxx_assert(_M_path != nullptr);
if (_M_path->_M_type == _Type::_Multi)
@@ -1239,7 +1245,7 @@ namespace __detail
}
inline path::iterator&
- path::iterator::operator--()
+ path::iterator::operator--() noexcept
{
__glibcxx_assert(_M_path != nullptr);
if (_M_path->_M_type == _Type::_Multi)
@@ -1256,7 +1262,7 @@ namespace __detail
}
inline path::iterator::reference
- path::iterator::operator*() const
+ path::iterator::operator*() const noexcept
{
__glibcxx_assert(_M_path != nullptr);
if (_M_path->_M_type == _Type::_Multi)
@@ -1268,7 +1274,7 @@ namespace __detail
}
inline bool
- path::iterator::_M_equals(iterator __rhs) const
+ path::iterator::_M_equals(iterator __rhs) const noexcept
{
if (_M_path != __rhs._M_path)
return false;