[cfe-commits] [libcxx] r132461 - /libcxx/trunk/include/forward_list

Howard Hinnant hhinnant at apple.com
Thu Jun 2 09:44:28 PDT 2011


Author: hhinnant
Date: Thu Jun  2 11:44:28 2011
New Revision: 132461

URL: http://llvm.org/viewvc/llvm-project?rev=132461&view=rev
Log:
noexcept for forward_list.

Modified:
    libcxx/trunk/include/forward_list

Modified: libcxx/trunk/include/forward_list
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/forward_list?rev=132461&r1=132460&r2=132461&view=diff
==============================================================================
--- libcxx/trunk/include/forward_list (original)
+++ libcxx/trunk/include/forward_list Thu Jun  2 11:44:28 2011
@@ -61,22 +61,22 @@
     void assign(size_type n, const value_type& v);
     void assign(initializer_list<value_type> il);
 
-    allocator_type get_allocator() const;
+    allocator_type get_allocator() const noexcept;
 
-    iterator       begin();
-    const_iterator begin() const;
-    iterator       end();
-    const_iterator end() const;
-
-    const_iterator cbegin() const;
-    const_iterator cend() const;
-
-    iterator       before_begin();
-    const_iterator before_begin() const;
-    const_iterator cbefore_begin() const;
+    iterator       begin() noexcept;
+    const_iterator begin() const noexcept;
+    iterator       end() noexcept;
+    const_iterator end() const noexcept;
+
+    const_iterator cbegin() const noexcept;
+    const_iterator cend() const noexcept;
+
+    iterator       before_begin() noexcept;
+    const_iterator before_begin() const noexcept;
+    const_iterator cbefore_begin() const noexcept;
 
-    bool empty() const;
-    size_type max_size() const;
+    bool empty() const noexcept;
+    size_type max_size() const noexcept;
 
     reference       front();
     const_reference front() const;
@@ -104,7 +104,7 @@
 
     void resize(size_type n);
     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);
@@ -124,7 +124,7 @@
     template <class Compare> void merge(forward_list&& x, Compare comp);
     void sort();
     template <class Compare> void sort(Compare comp);
-    void reverse();
+    void reverse() noexcept;
 };
 
 template <class T, class Allocator>
@@ -211,7 +211,7 @@
     __node_pointer __ptr_;
 
     _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> friend class __forward_list_const_iterator;
@@ -232,7 +232,7 @@
                                                               pointer;
 
     _LIBCPP_INLINE_VISIBILITY
-    __forward_list_iterator() : __ptr_(nullptr) {}
+    __forward_list_iterator() _NOEXCEPT : __ptr_(nullptr) {}
 
     _LIBCPP_INLINE_VISIBILITY
     reference operator*() const {return __ptr_->__value_;}
@@ -271,7 +271,7 @@
     __node_const_pointer __ptr_;
 
     _LIBCPP_INLINE_VISIBILITY
-    explicit __forward_list_const_iterator(__node_const_pointer __p)
+    explicit __forward_list_const_iterator(__node_const_pointer __p) _NOEXCEPT
         : __ptr_(__p) {}
 
     typedef typename remove_const
@@ -303,9 +303,9 @@
                                                               pointer;
 
     _LIBCPP_INLINE_VISIBILITY
-    __forward_list_const_iterator() : __ptr_(nullptr) {}
+    __forward_list_const_iterator() _NOEXCEPT : __ptr_(nullptr) {}
     _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_) {}
 
     _LIBCPP_INLINE_VISIBILITY
@@ -361,18 +361,19 @@
     __compressed_pair<__begin_node, __node_allocator> __before_begin_;
 
     _LIBCPP_INLINE_VISIBILITY
-    __node_pointer        __before_begin()
+    __node_pointer        __before_begin() _NOEXCEPT
         {return pointer_traits<__node_pointer>::pointer_to(
                                 static_cast<__node&>(__before_begin_.first()));}
     _LIBCPP_INLINE_VISIBILITY
-    __node_const_pointer  __before_begin() const
+    __node_const_pointer  __before_begin() const _NOEXCEPT
         {return pointer_traits<__node_const_pointer>::pointer_to(
                           static_cast<const __node&>(__before_begin_.first()));}
 
     _LIBCPP_INLINE_VISIBILITY
           __node_allocator& __alloc()       {return __before_begin_.second();}
     _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_const_iterator<__node_const_pointer> const_iterator;
@@ -407,7 +408,7 @@
               __node_traits::propagate_on_container_move_assignment::value>());}
 
     void swap(__forward_list_base& __x);
-    void clear();
+    void clear() _NOEXCEPT;
 
 private:
     _LIBCPP_INLINE_VISIBILITY
@@ -486,7 +487,7 @@
 
 template <class _Tp, class _Alloc>
 void
-__forward_list_base<_Tp, _Alloc>::clear()
+__forward_list_base<_Tp, _Alloc>::clear() _NOEXCEPT
 {
     __node_allocator& __a = __alloc();
     for (__node_pointer __p = __before_begin()->__next_; __p != nullptr;)
@@ -563,33 +564,45 @@
     void assign(initializer_list<value_type> __il);
 
     _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
-    iterator       begin()       {return       iterator(base::__before_begin()->__next_);}
+    iterator       begin() _NOEXCEPT
+        {return       iterator(base::__before_begin()->__next_);}
     _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
-    iterator       end()         {return       iterator(nullptr);}
+    iterator       end() _NOEXCEPT
+        {return       iterator(nullptr);}
     _LIBCPP_INLINE_VISIBILITY
-    const_iterator end() const   {return const_iterator(nullptr);}
+    const_iterator end() const _NOEXCEPT
+        {return const_iterator(nullptr);}
 
     _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
-    const_iterator cend() const   {return const_iterator(nullptr);}
+    const_iterator cend() const _NOEXCEPT
+        {return const_iterator(nullptr);}
 
     _LIBCPP_INLINE_VISIBILITY
-    iterator       before_begin()        {return       iterator(base::__before_begin());}
+    iterator       before_begin() _NOEXCEPT
+        {return       iterator(base::__before_begin());}
     _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
-    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
-    bool empty() const {return base::__before_begin()->__next_ == nullptr;}
+    bool empty() const _NOEXCEPT
+        {return base::__before_begin()->__next_ == nullptr;}
     _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
     reference       front()       {return base::__before_begin()->__next_->__value_;}
@@ -635,7 +648,7 @@
     void resize(size_type __n);
     void resize(size_type __n, const value_type& __v);
     _LIBCPP_INLINE_VISIBILITY
-    void clear() {base::clear();}
+    void clear() _NOEXCEPT {base::clear();}
 
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     _LIBCPP_INLINE_VISIBILITY
@@ -669,7 +682,7 @@
     _LIBCPP_INLINE_VISIBILITY
     void sort() {sort(__less<value_type>());}
     template <class _Compare> void sort(_Compare __comp);
-    void reverse();
+    void reverse() _NOEXCEPT;
 
 private:
     typedef typename base::__node_allocator  __node_allocator;
@@ -1465,7 +1478,7 @@
 
 template <class _Tp, class _Alloc>
 void
-forward_list<_Tp, _Alloc>::reverse()
+forward_list<_Tp, _Alloc>::reverse() _NOEXCEPT
 {
     __node_pointer __p = base::__before_begin()->__next_;
     if (__p != nullptr)





More information about the cfe-commits mailing list