noexcept for forward_list.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132461 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -61,22 +61,22 @@ public:
|
|||||||
void assign(size_type n, const value_type& v);
|
void assign(size_type n, const value_type& v);
|
||||||
void assign(initializer_list<value_type> il);
|
void assign(initializer_list<value_type> il);
|
||||||
|
|
||||||
allocator_type get_allocator() const;
|
allocator_type get_allocator() const noexcept;
|
||||||
|
|
||||||
iterator begin();
|
iterator begin() noexcept;
|
||||||
const_iterator begin() const;
|
const_iterator begin() const noexcept;
|
||||||
iterator end();
|
iterator end() noexcept;
|
||||||
const_iterator end() const;
|
const_iterator end() const noexcept;
|
||||||
|
|
||||||
const_iterator cbegin() const;
|
const_iterator cbegin() const noexcept;
|
||||||
const_iterator cend() const;
|
const_iterator cend() const noexcept;
|
||||||
|
|
||||||
iterator before_begin();
|
iterator before_begin() noexcept;
|
||||||
const_iterator before_begin() const;
|
const_iterator before_begin() const noexcept;
|
||||||
const_iterator cbefore_begin() const;
|
const_iterator cbefore_begin() const noexcept;
|
||||||
|
|
||||||
bool empty() const;
|
bool empty() const noexcept;
|
||||||
size_type max_size() const;
|
size_type max_size() const noexcept;
|
||||||
|
|
||||||
reference front();
|
reference front();
|
||||||
const_reference front() const;
|
const_reference front() const;
|
||||||
@@ -104,7 +104,7 @@ public:
|
|||||||
|
|
||||||
void resize(size_type n);
|
void resize(size_type n);
|
||||||
void resize(size_type n, const value_type& v);
|
void resize(size_type n, const value_type& v);
|
||||||
void clear();
|
void clear() noexcept;
|
||||||
|
|
||||||
void splice_after(const_iterator p, forward_list& x);
|
void splice_after(const_iterator p, forward_list& x);
|
||||||
void splice_after(const_iterator p, forward_list&& x);
|
void splice_after(const_iterator p, forward_list&& x);
|
||||||
@@ -124,7 +124,7 @@ public:
|
|||||||
template <class Compare> void merge(forward_list&& x, Compare comp);
|
template <class Compare> void merge(forward_list&& x, Compare comp);
|
||||||
void sort();
|
void sort();
|
||||||
template <class Compare> void sort(Compare comp);
|
template <class Compare> void sort(Compare comp);
|
||||||
void reverse();
|
void reverse() noexcept;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T, class Allocator>
|
template <class T, class Allocator>
|
||||||
@@ -211,7 +211,7 @@ class _LIBCPP_VISIBLE __forward_list_iterator
|
|||||||
__node_pointer __ptr_;
|
__node_pointer __ptr_;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
explicit __forward_list_iterator(__node_pointer __p) : __ptr_(__p) {}
|
explicit __forward_list_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
|
||||||
|
|
||||||
template<class, class> friend class forward_list;
|
template<class, class> friend class forward_list;
|
||||||
template<class> friend class __forward_list_const_iterator;
|
template<class> friend class __forward_list_const_iterator;
|
||||||
@@ -232,7 +232,7 @@ public:
|
|||||||
pointer;
|
pointer;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__forward_list_iterator() : __ptr_(nullptr) {}
|
__forward_list_iterator() _NOEXCEPT : __ptr_(nullptr) {}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
reference operator*() const {return __ptr_->__value_;}
|
reference operator*() const {return __ptr_->__value_;}
|
||||||
@@ -271,7 +271,7 @@ class _LIBCPP_VISIBLE __forward_list_const_iterator
|
|||||||
__node_const_pointer __ptr_;
|
__node_const_pointer __ptr_;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
explicit __forward_list_const_iterator(__node_const_pointer __p)
|
explicit __forward_list_const_iterator(__node_const_pointer __p) _NOEXCEPT
|
||||||
: __ptr_(__p) {}
|
: __ptr_(__p) {}
|
||||||
|
|
||||||
typedef typename remove_const
|
typedef typename remove_const
|
||||||
@@ -303,9 +303,9 @@ public:
|
|||||||
pointer;
|
pointer;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__forward_list_const_iterator() : __ptr_(nullptr) {}
|
__forward_list_const_iterator() _NOEXCEPT : __ptr_(nullptr) {}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__forward_list_const_iterator(__forward_list_iterator<__node_pointer> __p)
|
__forward_list_const_iterator(__forward_list_iterator<__node_pointer> __p) _NOEXCEPT
|
||||||
: __ptr_(__p.__ptr_) {}
|
: __ptr_(__p.__ptr_) {}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
@@ -361,18 +361,19 @@ protected:
|
|||||||
__compressed_pair<__begin_node, __node_allocator> __before_begin_;
|
__compressed_pair<__begin_node, __node_allocator> __before_begin_;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__node_pointer __before_begin()
|
__node_pointer __before_begin() _NOEXCEPT
|
||||||
{return pointer_traits<__node_pointer>::pointer_to(
|
{return pointer_traits<__node_pointer>::pointer_to(
|
||||||
static_cast<__node&>(__before_begin_.first()));}
|
static_cast<__node&>(__before_begin_.first()));}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__node_const_pointer __before_begin() const
|
__node_const_pointer __before_begin() const _NOEXCEPT
|
||||||
{return pointer_traits<__node_const_pointer>::pointer_to(
|
{return pointer_traits<__node_const_pointer>::pointer_to(
|
||||||
static_cast<const __node&>(__before_begin_.first()));}
|
static_cast<const __node&>(__before_begin_.first()));}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__node_allocator& __alloc() {return __before_begin_.second();}
|
__node_allocator& __alloc() {return __before_begin_.second();}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
const __node_allocator& __alloc() const {return __before_begin_.second();}
|
const __node_allocator& __alloc() const _NOEXCEPT
|
||||||
|
{return __before_begin_.second();}
|
||||||
|
|
||||||
typedef __forward_list_iterator<__node_pointer> iterator;
|
typedef __forward_list_iterator<__node_pointer> iterator;
|
||||||
typedef __forward_list_const_iterator<__node_const_pointer> const_iterator;
|
typedef __forward_list_const_iterator<__node_const_pointer> const_iterator;
|
||||||
@@ -407,7 +408,7 @@ protected:
|
|||||||
__node_traits::propagate_on_container_move_assignment::value>());}
|
__node_traits::propagate_on_container_move_assignment::value>());}
|
||||||
|
|
||||||
void swap(__forward_list_base& __x);
|
void swap(__forward_list_base& __x);
|
||||||
void clear();
|
void clear() _NOEXCEPT;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
@@ -486,7 +487,7 @@ __forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x)
|
|||||||
|
|
||||||
template <class _Tp, class _Alloc>
|
template <class _Tp, class _Alloc>
|
||||||
void
|
void
|
||||||
__forward_list_base<_Tp, _Alloc>::clear()
|
__forward_list_base<_Tp, _Alloc>::clear() _NOEXCEPT
|
||||||
{
|
{
|
||||||
__node_allocator& __a = __alloc();
|
__node_allocator& __a = __alloc();
|
||||||
for (__node_pointer __p = __before_begin()->__next_; __p != nullptr;)
|
for (__node_pointer __p = __before_begin()->__next_; __p != nullptr;)
|
||||||
@@ -563,33 +564,45 @@ public:
|
|||||||
void assign(initializer_list<value_type> __il);
|
void assign(initializer_list<value_type> __il);
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
allocator_type get_allocator() const {return allocator_type(base::__alloc());}
|
allocator_type get_allocator() const _NOEXCEPT
|
||||||
|
{return allocator_type(base::__alloc());}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
iterator begin() {return iterator(base::__before_begin()->__next_);}
|
iterator begin() _NOEXCEPT
|
||||||
|
{return iterator(base::__before_begin()->__next_);}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
const_iterator begin() const {return const_iterator(base::__before_begin()->__next_);}
|
const_iterator begin() const _NOEXCEPT
|
||||||
|
{return const_iterator(base::__before_begin()->__next_);}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
iterator end() {return iterator(nullptr);}
|
iterator end() _NOEXCEPT
|
||||||
|
{return iterator(nullptr);}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
const_iterator end() const {return const_iterator(nullptr);}
|
const_iterator end() const _NOEXCEPT
|
||||||
|
{return const_iterator(nullptr);}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
const_iterator cbegin() const {return const_iterator(base::__before_begin()->__next_);}
|
const_iterator cbegin() const _NOEXCEPT
|
||||||
|
{return const_iterator(base::__before_begin()->__next_);}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
const_iterator cend() const {return const_iterator(nullptr);}
|
const_iterator cend() const _NOEXCEPT
|
||||||
|
{return const_iterator(nullptr);}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
iterator before_begin() {return iterator(base::__before_begin());}
|
iterator before_begin() _NOEXCEPT
|
||||||
|
{return iterator(base::__before_begin());}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
const_iterator before_begin() const {return const_iterator(base::__before_begin());}
|
const_iterator before_begin() const _NOEXCEPT
|
||||||
|
{return const_iterator(base::__before_begin());}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
const_iterator cbefore_begin() const {return const_iterator(base::__before_begin());}
|
const_iterator cbefore_begin() const _NOEXCEPT
|
||||||
|
{return const_iterator(base::__before_begin());}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool empty() const {return base::__before_begin()->__next_ == nullptr;}
|
bool empty() const _NOEXCEPT
|
||||||
|
{return base::__before_begin()->__next_ == nullptr;}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
size_type max_size() const {return numeric_limits<size_type>::max();}
|
size_type max_size() const _NOEXCEPT
|
||||||
|
{return numeric_limits<size_type>::max();}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
reference front() {return base::__before_begin()->__next_->__value_;}
|
reference front() {return base::__before_begin()->__next_->__value_;}
|
||||||
@@ -635,7 +648,7 @@ public:
|
|||||||
void resize(size_type __n);
|
void resize(size_type __n);
|
||||||
void resize(size_type __n, const value_type& __v);
|
void resize(size_type __n, const value_type& __v);
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void clear() {base::clear();}
|
void clear() _NOEXCEPT {base::clear();}
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
@@ -669,7 +682,7 @@ public:
|
|||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void sort() {sort(__less<value_type>());}
|
void sort() {sort(__less<value_type>());}
|
||||||
template <class _Compare> void sort(_Compare __comp);
|
template <class _Compare> void sort(_Compare __comp);
|
||||||
void reverse();
|
void reverse() _NOEXCEPT;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef typename base::__node_allocator __node_allocator;
|
typedef typename base::__node_allocator __node_allocator;
|
||||||
@@ -1465,7 +1478,7 @@ forward_list<_Tp, _Alloc>::__sort(__node_pointer __f1, difference_type __sz,
|
|||||||
|
|
||||||
template <class _Tp, class _Alloc>
|
template <class _Tp, class _Alloc>
|
||||||
void
|
void
|
||||||
forward_list<_Tp, _Alloc>::reverse()
|
forward_list<_Tp, _Alloc>::reverse() _NOEXCEPT
|
||||||
{
|
{
|
||||||
__node_pointer __p = base::__before_begin()->__next_;
|
__node_pointer __p = base::__before_begin()->__next_;
|
||||||
if (__p != nullptr)
|
if (__p != nullptr)
|
||||||
|
Reference in New Issue
Block a user