Ticket #7523: noexcept.patch
File noexcept.patch, 25.2 KB (added by , 10 years ago) |
---|
-
detail/operator_bool.hpp
8 8 9 9 #if ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, < 0x570) ) || defined(__CINT__) 10 10 11 operator bool () const 11 operator bool () const BOOST_NOEXCEPT 12 12 { 13 13 return px != 0; 14 14 } … … 21 21 22 22 typedef void (*unspecified_bool_type)( this_type*** ); 23 23 24 operator unspecified_bool_type() const // never throws24 operator unspecified_bool_type() const BOOST_NOEXCEPT 25 25 { 26 26 return px == 0? 0: unspecified_bool; 27 27 } … … 33 33 34 34 typedef element_type * (this_type::*unspecified_bool_type)() const; 35 35 36 operator unspecified_bool_type() const // never throws36 operator unspecified_bool_type() const BOOST_NOEXCEPT 37 37 { 38 38 return px == 0? 0: &this_type::get; 39 39 } … … 42 42 43 43 typedef element_type * this_type::*unspecified_bool_type; 44 44 45 operator unspecified_bool_type() const // never throws45 operator unspecified_bool_type() const BOOST_NOEXCEPT 46 46 { 47 47 return px == 0? 0: &this_type::px; 48 48 } … … 50 50 #endif 51 51 52 52 // operator! is redundant, but some compilers need it 53 bool operator! () const // never throws53 bool operator! () const BOOST_NOEXCEPT 54 54 { 55 55 return px == 0; 56 56 } -
weak_ptr.hpp
31 31 32 32 typedef typename boost::detail::sp_element< T >::type element_type; 33 33 34 weak_ptr() : px(0), pn() // never throws in 1.30+34 weak_ptr() BOOST_NOEXCEPT : px(0), pn() // never throws in 1.30+ 35 35 { 36 36 } 37 37 … … 41 41 42 42 // ... except in C++0x, move disables the implicit copy 43 43 44 weak_ptr( weak_ptr const & r ) : px( r.px ), pn( r.pn ) // never throws44 weak_ptr( weak_ptr const & r ) BOOST_NOEXCEPT : px( r.px ), pn( r.pn ) 45 45 { 46 46 } 47 47 48 weak_ptr & operator=( weak_ptr const & r ) // never throws48 weak_ptr & operator=( weak_ptr const & r ) BOOST_NOEXCEPT 49 49 { 50 50 px = r.px; 51 51 pn = r.pn; … … 81 81 weak_ptr( weak_ptr<Y> const & r ) 82 82 83 83 #endif 84 : px(r.lock().get()), pn(r.pn) // never throws84 BOOST_NOEXCEPT : px(r.lock().get()), pn(r.pn) 85 85 { 86 86 boost::detail::sp_assert_convertible< Y, T >(); 87 87 } … … 98 98 weak_ptr( weak_ptr<Y> && r ) 99 99 100 100 #endif 101 : px( r.lock().get() ), pn( static_cast< boost::detail::weak_count && >( r.pn ) ) // never throws101 BOOST_NOEXCEPT : px( r.lock().get() ), pn( static_cast< boost::detail::weak_count && >( r.pn ) ) 102 102 { 103 103 boost::detail::sp_assert_convertible< Y, T >(); 104 104 r.px = 0; 105 105 } 106 106 107 107 // for better efficiency in the T == Y case 108 weak_ptr( weak_ptr && r ): px( r.px ), pn( static_cast< boost::detail::weak_count && >( r.pn ) ) // never throws 108 weak_ptr( weak_ptr && r ) 109 BOOST_NOEXCEPT : px( r.px ), pn( static_cast< boost::detail::weak_count && >( r.pn ) ) 109 110 { 110 111 r.px = 0; 111 112 } 112 113 113 114 // for better efficiency in the T == Y case 114 weak_ptr & operator=( weak_ptr && r ) // never throws115 weak_ptr & operator=( weak_ptr && r ) BOOST_NOEXCEPT 115 116 { 116 117 this_type( static_cast< weak_ptr && >( r ) ).swap( *this ); 117 118 return *this; … … 130 131 weak_ptr( shared_ptr<Y> const & r ) 131 132 132 133 #endif 133 : px( r.px ), pn( r.pn ) // never throws134 BOOST_NOEXCEPT : px( r.px ), pn( r.pn ) 134 135 { 135 136 boost::detail::sp_assert_convertible< Y, T >(); 136 137 } … … 138 139 #if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1300) 139 140 140 141 template<class Y> 141 weak_ptr & operator=( weak_ptr<Y> const & r ) // never throws142 weak_ptr & operator=( weak_ptr<Y> const & r ) BOOST_NOEXCEPT 142 143 { 143 144 boost::detail::sp_assert_convertible< Y, T >(); 144 145 … … 151 152 #if defined( BOOST_HAS_RVALUE_REFS ) 152 153 153 154 template<class Y> 154 weak_ptr & operator=( weak_ptr<Y> && r ) 155 weak_ptr & operator=( weak_ptr<Y> && r ) BOOST_NOEXCEPT 155 156 { 156 157 this_type( static_cast< weak_ptr<Y> && >( r ) ).swap( *this ); 157 158 return *this; … … 160 161 #endif 161 162 162 163 template<class Y> 163 weak_ptr & operator=( shared_ptr<Y> const & r ) // never throws164 weak_ptr & operator=( shared_ptr<Y> const & r ) BOOST_NOEXCEPT 164 165 { 165 166 boost::detail::sp_assert_convertible< Y, T >(); 166 167 … … 172 173 173 174 #endif 174 175 175 shared_ptr<T> lock() const // never throws176 shared_ptr<T> lock() const BOOST_NOEXCEPT 176 177 { 177 178 return shared_ptr<T>( *this, boost::detail::sp_nothrow_tag() ); 178 179 } 179 180 180 long use_count() const // never throws181 long use_count() const BOOST_NOEXCEPT 181 182 { 182 183 return pn.use_count(); 183 184 } 184 185 185 bool expired() const // never throws186 bool expired() const BOOST_NOEXCEPT 186 187 { 187 188 return pn.use_count() == 0; 188 189 } … … 192 193 return pn.empty(); 193 194 } 194 195 195 void reset() // never throws in 1.30+196 void reset() BOOST_NOEXCEPT // never throws in 1.30+ 196 197 { 197 198 this_type().swap(*this); 198 199 } 199 200 200 void swap(this_type & other) // never throws201 void swap(this_type & other) BOOST_NOEXCEPT 201 202 { 202 203 std::swap(px, other.px); 203 204 pn.swap(other.pn); … … 210 211 pn = r.pn; 211 212 } 212 213 213 template<class Y> bool owner_before( weak_ptr<Y> const & rhs ) const 214 template<class Y> bool owner_before( weak_ptr<Y> const & rhs ) const BOOST_NOEXCEPT 214 215 { 215 216 return pn < rhs.pn; 216 217 } 217 218 218 template<class Y> bool owner_before( shared_ptr<Y> const & rhs ) const 219 template<class Y> bool owner_before( shared_ptr<Y> const & rhs ) const BOOST_NOEXCEPT 219 220 { 220 221 return pn < rhs.pn; 221 222 } … … 237 238 238 239 }; // weak_ptr 239 240 240 template<class T, class U> inline bool operator<(weak_ptr<T> const & a, weak_ptr<U> const & b) 241 template<class T, class U> inline bool operator<(weak_ptr<T> const & a, weak_ptr<U> const & b) BOOST_NOEXCEPT 241 242 { 242 243 return a.owner_before( b ); 243 244 } 244 245 245 template<class T> void swap(weak_ptr<T> & a, weak_ptr<T> & b) 246 template<class T> void swap(weak_ptr<T> & a, weak_ptr<T> & b) BOOST_NOEXCEPT 246 247 { 247 248 a.swap(b); 248 249 } -
intrusive_ptr.hpp
58 58 59 59 typedef T element_type; 60 60 61 intrusive_ptr() : px( 0 )61 intrusive_ptr() BOOST_NOEXCEPT : px( 0 ) 62 62 { 63 63 } 64 64 … … 110 110 111 111 #if defined( BOOST_HAS_RVALUE_REFS ) 112 112 113 intrusive_ptr(intrusive_ptr && rhs) : px( rhs.px )113 intrusive_ptr(intrusive_ptr && rhs) BOOST_NOEXCEPT : px( rhs.px ) 114 114 { 115 115 rhs.px = 0; 116 116 } 117 117 118 intrusive_ptr & operator=(intrusive_ptr && rhs) 118 intrusive_ptr & operator=(intrusive_ptr && rhs) BOOST_NOEXCEPT 119 119 { 120 120 this_type( static_cast< intrusive_ptr && >( rhs ) ).swap(*this); 121 121 return *this; … … 135 135 return *this; 136 136 } 137 137 138 void reset() 138 void reset() BOOST_NOEXCEPT 139 139 { 140 140 this_type().swap( *this ); 141 141 } … … 145 145 this_type( rhs ).swap( *this ); 146 146 } 147 147 148 T * get() const 148 T * get() const BOOST_NOEXCEPT 149 149 { 150 150 return px; 151 151 } … … 165 165 // implicit conversion to "bool" 166 166 #include <boost/smart_ptr/detail/operator_bool.hpp> 167 167 168 void swap(intrusive_ptr & rhs) 168 void swap(intrusive_ptr & rhs) BOOST_NOEXCEPT 169 169 { 170 170 T * tmp = px; 171 171 px = rhs.px; -
enable_shared_from_this.hpp
25 25 { 26 26 protected: 27 27 28 enable_shared_from_this() 28 enable_shared_from_this() BOOST_NOEXCEPT 29 29 { 30 30 } 31 31 32 enable_shared_from_this(enable_shared_from_this const &) 32 enable_shared_from_this(enable_shared_from_this const &) BOOST_NOEXCEPT 33 33 { 34 34 } 35 35 36 enable_shared_from_this & operator=(enable_shared_from_this const &) 36 enable_shared_from_this & operator=(enable_shared_from_this const &) BOOST_NOEXCEPT 37 37 { 38 38 return *this; 39 39 } 40 40 41 ~enable_shared_from_this() 41 ~enable_shared_from_this() BOOST_NOEXCEPT // ~weak_ptr<T> newer throws, so this call also must not throw 42 42 { 43 43 } 44 44 -
make_shared_object.hpp
67 67 68 68 public: 69 69 70 sp_ms_deleter() : initialized_( false )70 sp_ms_deleter() BOOST_NOEXCEPT : initialized_( false ) 71 71 { 72 72 } 73 73 74 74 // optimization: do not copy storage_ 75 sp_ms_deleter( sp_ms_deleter const & ) : initialized_( false )75 sp_ms_deleter( sp_ms_deleter const & ) BOOST_NOEXCEPT : initialized_( false ) 76 76 { 77 77 } 78 78 … … 86 86 destroy(); 87 87 } 88 88 89 void * address() 89 void * address() BOOST_NOEXCEPT 90 90 { 91 91 return storage_.data_; 92 92 } 93 93 94 void set_initialized() 94 void set_initialized() BOOST_NOEXCEPT 95 95 { 96 96 initialized_ = true; 97 97 } … … 99 99 100 100 #if defined( BOOST_HAS_RVALUE_REFS ) 101 101 102 template< class T > T&& sp_forward( T & t ) 102 template< class T > T&& sp_forward( T & t ) BOOST_NOEXCEPT 103 103 { 104 104 return static_cast< T&& >( t ); 105 105 } -
shared_ptr.hpp
324 324 325 325 typedef typename boost::detail::sp_element< T >::type element_type; 326 326 327 shared_ptr() : px( 0 ), pn() // never throws in 1.30+327 shared_ptr() BOOST_NOEXCEPT : px( 0 ), pn() // never throws in 1.30+ 328 328 { 329 329 } 330 330 … … 358 358 359 359 // ... except in C++0x, move disables the implicit copy 360 360 361 shared_ptr( shared_ptr const & r ) : px( r.px ), pn( r.pn ) // never throws361 shared_ptr( shared_ptr const & r ) BOOST_NOEXCEPT : px( r.px ), pn( r.pn ) 362 362 { 363 363 } 364 364 … … 374 374 } 375 375 376 376 template<class Y> 377 shared_ptr( weak_ptr<Y> const & r, boost::detail::sp_nothrow_tag ): px( 0 ), pn( r.pn, boost::detail::sp_nothrow_tag() ) // never throws 377 shared_ptr( weak_ptr<Y> const & r, boost::detail::sp_nothrow_tag ) 378 BOOST_NOEXCEPT : px( 0 ), pn( r.pn, boost::detail::sp_nothrow_tag() ) 378 379 { 379 380 if( !pn.empty() ) 380 381 { … … 392 393 shared_ptr( shared_ptr<Y> const & r ) 393 394 394 395 #endif 395 : px( r.px ), pn( r.pn ) // never throws396 BOOST_NOEXCEPT : px( r.px ), pn( r.pn ) 396 397 { 397 398 boost::detail::sp_assert_convertible< Y, T >(); 398 399 } 399 400 400 401 // aliasing 401 402 template< class Y > 402 shared_ptr( shared_ptr<Y> const & r, element_type * p ) : px( p ), pn( r.pn ) // never throws403 shared_ptr( shared_ptr<Y> const & r, element_type * p ) BOOST_NOEXCEPT : px( p ), pn( r.pn ) 403 404 { 404 405 } 405 406 406 407 template<class Y> 407 shared_ptr(shared_ptr<Y> const & r, boost::detail::static_cast_tag): px(static_cast<element_type *>(r.px)), pn(r.pn) 408 shared_ptr(shared_ptr<Y> const & r, boost::detail::static_cast_tag) 409 BOOST_NOEXCEPT : px(static_cast<element_type *>(r.px)), pn(r.pn) 408 410 { 409 411 } 410 412 411 413 template<class Y> 412 shared_ptr(shared_ptr<Y> const & r, boost::detail::const_cast_tag): px(const_cast<element_type *>(r.px)), pn(r.pn) 414 shared_ptr(shared_ptr<Y> const & r, boost::detail::const_cast_tag) 415 BOOST_NOEXCEPT : px(const_cast<element_type *>(r.px)), pn(r.pn) 413 416 { 414 417 } 415 418 … … 480 483 481 484 // assignment 482 485 483 shared_ptr & operator=( shared_ptr const & r ) // never throws486 shared_ptr & operator=( shared_ptr const & r ) BOOST_NOEXCEPT 484 487 { 485 488 this_type(r).swap(*this); 486 489 return *this; … … 489 492 #if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1400) 490 493 491 494 template<class Y> 492 shared_ptr & operator=(shared_ptr<Y> const & r) // never throws495 shared_ptr & operator=(shared_ptr<Y> const & r) BOOST_NOEXCEPT 493 496 { 494 497 this_type(r).swap(*this); 495 498 return *this; … … 523 526 524 527 #if defined( BOOST_HAS_RVALUE_REFS ) 525 528 526 shared_ptr( shared_ptr && r ) : px( r.px ), pn() // never throws529 shared_ptr( shared_ptr && r ) BOOST_NOEXCEPT : px( r.px ), pn() 527 530 { 528 531 pn.swap( r.pn ); 529 532 r.px = 0; … … 539 542 shared_ptr( shared_ptr<Y> && r ) 540 543 541 544 #endif 542 : px( r.px ), pn() // never throws545 BOOST_NOEXCEPT : px( r.px ), pn() 543 546 { 544 547 boost::detail::sp_assert_convertible< Y, T >(); 545 548 … … 547 550 r.px = 0; 548 551 } 549 552 550 shared_ptr & operator=( shared_ptr && r ) // never throws553 shared_ptr & operator=( shared_ptr && r ) BOOST_NOEXCEPT 551 554 { 552 555 this_type( static_cast< shared_ptr && >( r ) ).swap( *this ); 553 556 return *this; 554 557 } 555 558 556 559 template<class Y> 557 shared_ptr & operator=( shared_ptr<Y> && r ) // never throws560 shared_ptr & operator=( shared_ptr<Y> && r ) BOOST_NOEXCEPT 558 561 { 559 562 this_type( static_cast< shared_ptr<Y> && >( r ) ).swap( *this ); 560 563 return *this; … … 562 565 563 566 #endif 564 567 565 void reset() // never throws in 1.30+568 void reset() BOOST_NOEXCEPT // never throws in 1.30+ 566 569 { 567 570 this_type().swap(*this); 568 571 } … … 587 590 { 588 591 this_type( r, p ).swap( *this ); 589 592 } 590 591 typename boost::detail::sp_dereference< T >::type operator* () const // never throws 593 594 // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT) 595 typename boost::detail::sp_dereference< T >::type operator* () const 592 596 { 593 597 BOOST_ASSERT( px != 0 ); 594 598 return *px; 595 599 } 596 597 typename boost::detail::sp_member_access< T >::type operator-> () const // never throws 600 601 // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT) 602 typename boost::detail::sp_member_access< T >::type operator-> () const 598 603 { 599 604 BOOST_ASSERT( px != 0 ); 600 605 return px; 601 606 } 602 603 typename boost::detail::sp_array_access< T >::type operator[] ( std::ptrdiff_t i ) const // never throws 607 608 // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT) 609 typename boost::detail::sp_array_access< T >::type operator[] ( std::ptrdiff_t i ) const 604 610 { 605 611 BOOST_ASSERT( px != 0 ); 606 612 BOOST_ASSERT( i >= 0 && ( i < boost::detail::sp_extent< T >::value || boost::detail::sp_extent< T >::value == 0 ) ); … … 608 614 return px[ i ]; 609 615 } 610 616 611 element_type * get() const // never throws617 element_type * get() const BOOST_NOEXCEPT 612 618 { 613 619 return px; 614 620 } … … 616 622 // implicit conversion to "bool" 617 623 #include <boost/smart_ptr/detail/operator_bool.hpp> 618 624 619 bool unique() const // never throws625 bool unique() const BOOST_NOEXCEPT 620 626 { 621 627 return pn.unique(); 622 628 } 623 629 624 long use_count() const // never throws630 long use_count() const BOOST_NOEXCEPT 625 631 { 626 632 return pn.use_count(); 627 633 } 628 634 629 void swap( shared_ptr & other ) // never throws635 void swap( shared_ptr & other ) BOOST_NOEXCEPT 630 636 { 631 637 std::swap(px, other.px); 632 638 pn.swap(other.pn); 633 639 } 634 640 635 template<class Y> bool owner_before( shared_ptr<Y> const & rhs ) const 641 template<class Y> bool owner_before( shared_ptr<Y> const & rhs ) const BOOST_NOEXCEPT 636 642 { 637 643 return pn < rhs.pn; 638 644 } 639 645 640 template<class Y> bool owner_before( weak_ptr<Y> const & rhs ) const 646 template<class Y> bool owner_before( weak_ptr<Y> const & rhs ) const BOOST_NOEXCEPT 641 647 { 642 648 return pn < rhs.pn; 643 649 } … … 647 653 return pn.get_deleter( ti ); 648 654 } 649 655 650 bool _internal_equiv( shared_ptr const & r ) const 656 bool _internal_equiv( shared_ptr const & r ) const BOOST_NOEXCEPT 651 657 { 652 658 return px == r.px && pn == r.pn; 653 659 } … … 670 676 671 677 }; // shared_ptr 672 678 673 template<class T, class U> inline bool operator==(shared_ptr<T> const & a, shared_ptr<U> const & b) 679 template<class T, class U> inline bool operator==(shared_ptr<T> const & a, shared_ptr<U> const & b) BOOST_NOEXCEPT 674 680 { 675 681 return a.get() == b.get(); 676 682 } 677 683 678 template<class T, class U> inline bool operator!=(shared_ptr<T> const & a, shared_ptr<U> const & b) 684 template<class T, class U> inline bool operator!=(shared_ptr<T> const & a, shared_ptr<U> const & b) BOOST_NOEXCEPT 679 685 { 680 686 return a.get() != b.get(); 681 687 } … … 684 690 685 691 // Resolve the ambiguity between our op!= and the one in rel_ops 686 692 687 template<class T> inline bool operator!=(shared_ptr<T> const & a, shared_ptr<T> const & b) 693 template<class T> inline bool operator!=(shared_ptr<T> const & a, shared_ptr<T> const & b) BOOST_NOEXCEPT 688 694 { 689 695 return a.get() != b.get(); 690 696 } 691 697 692 698 #endif 693 699 694 template<class T, class U> inline bool operator<(shared_ptr<T> const & a, shared_ptr<U> const & b) 700 template<class T, class U> inline bool operator<(shared_ptr<T> const & a, shared_ptr<U> const & b) BOOST_NOEXCEPT 695 701 { 696 702 return a.owner_before( b ); 697 703 } 698 704 699 template<class T> inline void swap(shared_ptr<T> & a, shared_ptr<T> & b) 705 template<class T> inline void swap(shared_ptr<T> & a, shared_ptr<T> & b) BOOST_NOEXCEPT 700 706 { 701 707 a.swap(b); 702 708 } … … 741 747 742 748 // get_pointer() enables boost::mem_fn to recognize shared_ptr 743 749 744 template<class T> inline T * get_pointer(shared_ptr<T> const & p) 750 template<class T> inline T * get_pointer(shared_ptr<T> const & p) BOOST_NOEXCEPT 745 751 { 746 752 return p.get(); 747 753 } … … 854 860 855 861 #if !defined(BOOST_SP_NO_ATOMIC_ACCESS) 856 862 857 template<class T> inline bool atomic_is_lock_free( shared_ptr<T> const * /*p*/ ) 863 template<class T> inline bool atomic_is_lock_free( shared_ptr<T> const * /*p*/ ) BOOST_NOEXCEPT 858 864 { 859 865 return false; 860 866 } … … 933 939 934 940 template< class T > struct hash; 935 941 936 template< class T > std::size_t hash_value( boost::shared_ptr<T> const & p ) 942 template< class T > std::size_t hash_value( boost::shared_ptr<T> const & p ) BOOST_NOEXCEPT 937 943 { 938 944 return boost::hash< T* >()( p.get() ); 939 945 } -
scoped_ptr.hpp
63 63 64 64 #ifndef BOOST_NO_AUTO_PTR 65 65 66 explicit scoped_ptr( std::auto_ptr<T> p ) : px( p.release() ) // never throws66 explicit scoped_ptr( std::auto_ptr<T> p ) BOOST_NOEXCEPT : px( p.release() ) 67 67 { 68 68 #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) 69 69 boost::sp_scalar_constructor_hook( px ); … … 98 98 return px; 99 99 } 100 100 101 T * get() const // never throws101 T * get() const BOOST_NOEXCEPT 102 102 { 103 103 return px; 104 104 } … … 106 106 // implicit conversion to "bool" 107 107 #include <boost/smart_ptr/detail/operator_bool.hpp> 108 108 109 void swap(scoped_ptr & b) // never throws109 void swap(scoped_ptr & b) BOOST_NOEXCEPT 110 110 { 111 111 T * tmp = b.px; 112 112 b.px = px; … … 114 114 } 115 115 }; 116 116 117 template<class T> inline void swap(scoped_ptr<T> & a, scoped_ptr<T> & b) // never throws117 template<class T> inline void swap(scoped_ptr<T> & a, scoped_ptr<T> & b) BOOST_NOEXCEPT 118 118 { 119 119 a.swap(b); 120 120 } 121 121 122 122 // get_pointer(p) is a generic way to say p.get() 123 123 124 template<class T> inline T * get_pointer(scoped_ptr<T> const & p) 124 template<class T> inline T * get_pointer(scoped_ptr<T> const & p) BOOST_NOEXCEPT 125 125 { 126 126 return p.get(); 127 127 } -
shared_array.hpp
56 56 57 57 typedef T element_type; 58 58 59 shared_array() : px( 0 ), pn() // never throws59 shared_array() BOOST_NOEXCEPT : px( 0 ), pn() 60 60 { 61 61 } 62 62 … … 90 90 91 91 // ... except in C++0x, move disables the implicit copy 92 92 93 shared_array( shared_array const & r ) : px( r.px ), pn( r.pn ) // never throws93 shared_array( shared_array const & r ) BOOST_NOEXCEPT : px( r.px ), pn( r.pn ) 94 94 { 95 95 } 96 96 97 shared_array( shared_array && r ) : px( r.px ), pn() // never throws97 shared_array( shared_array && r ) BOOST_NOEXCEPT : px( r.px ), pn() 98 98 { 99 99 pn.swap( r.pn ); 100 100 r.px = 0; … … 114 114 shared_array( shared_array<Y> const & r ) 115 115 116 116 #endif 117 : px( r.px ), pn( r.pn ) // never throws117 BOOST_NOEXCEPT : px( r.px ), pn( r.pn ) // never throws 118 118 { 119 119 boost::detail::sp_assert_convertible< Y[], T[] >(); 120 120 } … … 122 122 // aliasing 123 123 124 124 template< class Y > 125 shared_array( shared_array<Y> const & r, element_type * p ) : px( p ), pn( r.pn ) // never throws125 shared_array( shared_array<Y> const & r, element_type * p ) BOOST_NOEXCEPT : px( p ), pn( r.pn ) 126 126 { 127 127 } 128 128 129 129 // assignment 130 130 131 shared_array & operator=( shared_array const & r ) // never throws131 shared_array & operator=( shared_array const & r ) BOOST_NOEXCEPT 132 132 { 133 133 this_type( r ).swap( *this ); 134 134 return *this; … … 137 137 #if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1400) 138 138 139 139 template<class Y> 140 shared_array & operator=( shared_array<Y> const & r ) // never throws140 shared_array & operator=( shared_array<Y> const & r ) BOOST_NOEXCEPT 141 141 { 142 142 this_type( r ).swap( *this ); 143 143 return *this; … … 147 147 148 148 #if defined( BOOST_HAS_RVALUE_REFS ) 149 149 150 shared_array & operator=( shared_array && r ) // never throws150 shared_array & operator=( shared_array && r ) BOOST_NOEXCEPT 151 151 { 152 152 this_type( static_cast< shared_array && >( r ) ).swap( *this ); 153 153 return *this; 154 154 } 155 155 156 156 template<class Y> 157 shared_array & operator=( shared_array<Y> && r ) // never throws157 shared_array & operator=( shared_array<Y> && r ) BOOST_NOEXCEPT 158 158 { 159 159 this_type( static_cast< shared_array<Y> && >( r ) ).swap( *this ); 160 160 return *this; … … 162 162 163 163 #endif 164 164 165 void reset() // never throws165 void reset() BOOST_NOEXCEPT 166 166 { 167 167 this_type().swap( *this ); 168 168 } … … 188 188 this_type( r, p ).swap( *this ); 189 189 } 190 190 191 T & operator[] (std::ptrdiff_t i) const // never throws 191 T & operator[] (std::ptrdiff_t i) const // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT) 192 192 { 193 193 BOOST_ASSERT(px != 0); 194 194 BOOST_ASSERT(i >= 0); 195 195 return px[i]; 196 196 } 197 197 198 T * get() const // never throws198 T * get() const BOOST_NOEXCEPT 199 199 { 200 200 return px; 201 201 } … … 203 203 // implicit conversion to "bool" 204 204 #include <boost/smart_ptr/detail/operator_bool.hpp> 205 205 206 bool unique() const // never throws206 bool unique() const BOOST_NOEXCEPT 207 207 { 208 208 return pn.unique(); 209 209 } 210 210 211 long use_count() const // never throws211 long use_count() const BOOST_NOEXCEPT 212 212 { 213 213 return pn.use_count(); 214 214 } 215 215 216 void swap(shared_array<T> & other) // never throws216 void swap(shared_array<T> & other) BOOST_NOEXCEPT 217 217 { 218 218 std::swap(px, other.px); 219 219 pn.swap(other.pn); … … 233 233 234 234 }; // shared_array 235 235 236 template<class T> inline bool operator==(shared_array<T> const & a, shared_array<T> const & b) // never throws236 template<class T> inline bool operator==(shared_array<T> const & a, shared_array<T> const & b) BOOST_NOEXCEPT 237 237 { 238 238 return a.get() == b.get(); 239 239 } 240 240 241 template<class T> inline bool operator!=(shared_array<T> const & a, shared_array<T> const & b) // never throws241 template<class T> inline bool operator!=(shared_array<T> const & a, shared_array<T> const & b) BOOST_NOEXCEPT 242 242 { 243 243 return a.get() != b.get(); 244 244 } 245 245 246 template<class T> inline bool operator<(shared_array<T> const & a, shared_array<T> const & b) // never throws246 template<class T> inline bool operator<(shared_array<T> const & a, shared_array<T> const & b) BOOST_NOEXCEPT 247 247 { 248 248 return std::less<T*>()(a.get(), b.get()); 249 249 } 250 250 251 template<class T> void swap(shared_array<T> & a, shared_array<T> & b) // never throws251 template<class T> void swap(shared_array<T> & a, shared_array<T> & b) BOOST_NOEXCEPT 252 252 { 253 253 a.swap(b); 254 254 } -
scoped_array.hpp
53 53 54 54 typedef T element_type; 55 55 56 explicit scoped_array( T * p = 0 ) : px( p ) // never throws56 explicit scoped_array( T * p = 0 ) BOOST_NOEXCEPT : px( p ) 57 57 { 58 58 #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) 59 59 boost::sp_array_constructor_hook( px ); … … 68 68 boost::checked_array_delete( px ); 69 69 } 70 70 71 void reset(T * p = 0) // never throws 71 void reset(T * p = 0) // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT) 72 72 { 73 73 BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors 74 74 this_type(p).swap(*this); 75 75 } 76 76 77 T & operator[](std::ptrdiff_t i) const // never throws 77 T & operator[](std::ptrdiff_t i) const // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT) 78 78 { 79 79 BOOST_ASSERT( px != 0 ); 80 80 BOOST_ASSERT( i >= 0 ); 81 81 return px[i]; 82 82 } 83 83 84 T * get() const // never throws84 T * get() const BOOST_NOEXCEPT 85 85 { 86 86 return px; 87 87 } … … 89 89 // implicit conversion to "bool" 90 90 #include <boost/smart_ptr/detail/operator_bool.hpp> 91 91 92 void swap(scoped_array & b) // never throws92 void swap(scoped_array & b) BOOST_NOEXCEPT 93 93 { 94 94 T * tmp = b.px; 95 95 b.px = px; … … 97 97 } 98 98 }; 99 99 100 template<class T> inline void swap(scoped_array<T> & a, scoped_array<T> & b) // never throws100 template<class T> inline void swap(scoped_array<T> & a, scoped_array<T> & b) BOOST_NOEXCEPT 101 101 { 102 102 a.swap(b); 103 103 }