added noexcept to some functions in const_list.h
This commit is contained in:
parent
fc59dd2404
commit
a497cfbb22
|
|
@ -52,7 +52,7 @@ namespace cc {
|
||||||
constexpr _const_list_iterator operator--(int) noexcept { auto tmp = *this; _node = _node->_prev; return tmp; }
|
constexpr _const_list_iterator operator--(int) noexcept { auto tmp = *this; _node = _node->_prev; return tmp; }
|
||||||
|
|
||||||
template<bool _const_other>
|
template<bool _const_other>
|
||||||
[[nodiscard]] constexpr bool operator==(const _const_list_iterator<N, _const_other> &other) const { return _node == other._node; }
|
[[nodiscard]] constexpr bool operator==(const _const_list_iterator<N, _const_other> &other) const noexcept { return _node == other._node; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
constexpr _const_list_iterator<N, false> _const_cast() const noexcept
|
constexpr _const_list_iterator<N, false> _const_cast() const noexcept
|
||||||
|
|
@ -103,7 +103,7 @@ namespace cc {
|
||||||
|
|
||||||
constexpr void assign(std::initializer_list<std::reference_wrapper<value_type>> init) noexcept;
|
constexpr void assign(std::initializer_list<std::reference_wrapper<value_type>> init) noexcept;
|
||||||
|
|
||||||
[[nodiscard]] constexpr reference front() noexcept{ return *dynamic_cast<Node*>(_tail._next); }
|
[[nodiscard]] constexpr reference front() noexcept { return *dynamic_cast<Node*>(_tail._next); }
|
||||||
[[nodiscard]] constexpr const_reference front() const noexcept { return *dynamic_cast<Node*>(_tail._next); }
|
[[nodiscard]] constexpr const_reference front() const noexcept { return *dynamic_cast<Node*>(_tail._next); }
|
||||||
|
|
||||||
[[nodiscard]] constexpr reference back() noexcept { return *dynamic_cast<Node*>(_tail._prev); }
|
[[nodiscard]] constexpr reference back() noexcept { return *dynamic_cast<Node*>(_tail._prev); }
|
||||||
|
|
@ -131,20 +131,17 @@ namespace cc {
|
||||||
|
|
||||||
void clear() noexcept;
|
void clear() noexcept;
|
||||||
|
|
||||||
constexpr iterator insert(const_iterator pos, value_type& value);
|
constexpr iterator insert(const_iterator pos, value_type& value) noexcept;
|
||||||
constexpr iterator insert(const_iterator pos, std::initializer_list<std::reference_wrapper<value_type>> values);
|
constexpr iterator insert(const_list::const_iterator pos, std::initializer_list<std::reference_wrapper<value_type>> values) noexcept;
|
||||||
|
|
||||||
constexpr iterator erase(const_iterator pos);
|
constexpr iterator erase(const_list::const_iterator pos) noexcept;
|
||||||
constexpr iterator erase(const_iterator first, const_iterator last);
|
constexpr iterator erase(const_list::const_iterator first, const_list::const_iterator last) noexcept;
|
||||||
|
|
||||||
constexpr void push_back(value_type& value);
|
constexpr void push_back(value_type& value) noexcept;
|
||||||
constexpr void pop_back();
|
constexpr void pop_back() noexcept;
|
||||||
|
|
||||||
constexpr void push_front(value_type& value);
|
constexpr void push_front(value_type& value) noexcept;
|
||||||
constexpr void pop_front();
|
constexpr void pop_front() noexcept;
|
||||||
|
|
||||||
constexpr void resize(size_type count);
|
|
||||||
constexpr void resize(size_type count, const value_type& value);
|
|
||||||
|
|
||||||
constexpr void swap(const_list& other) noexcept;
|
constexpr void swap(const_list& other) noexcept;
|
||||||
|
|
||||||
|
|
@ -316,7 +313,7 @@ namespace cc {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Node>
|
template<typename Node>
|
||||||
constexpr const_list<Node>::iterator const_list<Node>::insert(const_iterator pos, value_type &value)
|
constexpr const_list<Node>::iterator const_list<Node>::insert(const_iterator pos, value_type &value) noexcept
|
||||||
{
|
{
|
||||||
auto it = pos._const_cast();
|
auto it = pos._const_cast();
|
||||||
|
|
||||||
|
|
@ -328,7 +325,7 @@ namespace cc {
|
||||||
|
|
||||||
template<typename Node>
|
template<typename Node>
|
||||||
constexpr const_list<Node>::iterator const_list<Node>::insert(const_list::const_iterator pos,
|
constexpr const_list<Node>::iterator const_list<Node>::insert(const_list::const_iterator pos,
|
||||||
std::initializer_list<std::reference_wrapper<value_type>> values)
|
std::initializer_list<std::reference_wrapper<value_type>> values) noexcept
|
||||||
{
|
{
|
||||||
auto it = pos._const_cast();
|
auto it = pos._const_cast();
|
||||||
|
|
||||||
|
|
@ -344,7 +341,7 @@ namespace cc {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Node>
|
template<typename Node>
|
||||||
constexpr const_list<Node>::iterator const_list<Node>::erase(const_list::const_iterator pos)
|
constexpr const_list<Node>::iterator const_list<Node>::erase(const_list::const_iterator pos) noexcept
|
||||||
{
|
{
|
||||||
auto it = pos._const_cast();
|
auto it = pos._const_cast();
|
||||||
auto next = std::next(it);
|
auto next = std::next(it);
|
||||||
|
|
@ -356,7 +353,7 @@ namespace cc {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Node>
|
template<typename Node>
|
||||||
constexpr const_list<Node>::iterator const_list<Node>::erase(const_list::const_iterator first, const_list::const_iterator last)
|
constexpr const_list<Node>::iterator const_list<Node>::erase(const_list::const_iterator first, const_list::const_iterator last) noexcept
|
||||||
{
|
{
|
||||||
auto nc_last = last._const_cast();
|
auto nc_last = last._const_cast();
|
||||||
|
|
||||||
|
|
@ -378,28 +375,28 @@ namespace cc {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Node>
|
template<typename Node>
|
||||||
constexpr void const_list<Node>::push_back(value_type &value)
|
constexpr void const_list<Node>::push_back(value_type &value) noexcept
|
||||||
{
|
{
|
||||||
_tail.push_before(std::addressof(value));
|
_tail.push_before(std::addressof(value));
|
||||||
++_size;
|
++_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Node>
|
template<typename Node>
|
||||||
constexpr void const_list<Node>::pop_back()
|
constexpr void const_list<Node>::pop_back() noexcept
|
||||||
{
|
{
|
||||||
_tail._prev->unlink();
|
_tail._prev->unlink();
|
||||||
--_size;
|
--_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Node>
|
template<typename Node>
|
||||||
constexpr void const_list<Node>::push_front(value_type &value)
|
constexpr void const_list<Node>::push_front(value_type &value) noexcept
|
||||||
{
|
{
|
||||||
_tail._next->push_before(std::addressof(value));
|
_tail._next->push_before(std::addressof(value));
|
||||||
++_size;
|
++_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Node>
|
template<typename Node>
|
||||||
constexpr void const_list<Node>::pop_front()
|
constexpr void const_list<Node>::pop_front() noexcept
|
||||||
{
|
{
|
||||||
_tail._next->unlink();
|
_tail._next->unlink();
|
||||||
--_size;
|
--_size;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue