Merge branch 'noexcept-swap' of https://github.com/palebedev/container into palebedev-noexcept-swap

This commit is contained in:
Ion Gaztañaga
2021-01-02 00:38:31 +01:00
13 changed files with 34 additions and 8 deletions

View File

@@ -1910,6 +1910,7 @@ class deque : protected deque_base<typename real_allocator<T, Allocator>::type,
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
BOOST_CONTAINER_FORCEINLINE friend void swap(deque& x, deque& y) BOOST_CONTAINER_FORCEINLINE friend void swap(deque& x, deque& y)
BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT(x.swap(y)))
{ x.swap(y); } { x.swap(y); }
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED

View File

@@ -1448,6 +1448,7 @@ class flat_tree
{ return !(x < y); } { return !(x < y); }
BOOST_CONTAINER_FORCEINLINE friend void swap(flat_tree& x, flat_tree& y) BOOST_CONTAINER_FORCEINLINE friend void swap(flat_tree& x, flat_tree& y)
BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT(x.swap(y)))
{ x.swap(y); } { x.swap(y); }
private: private:

View File

@@ -2012,6 +2012,8 @@ class devector
{ return !(x < y); } { return !(x < y); }
BOOST_CONTAINER_FORCEINLINE friend void swap(devector& x, devector& y) BOOST_CONTAINER_FORCEINLINE friend void swap(devector& x, devector& y)
BOOST_NOEXCEPT_IF( allocator_traits_type::propagate_on_container_swap::value
|| allocator_traits_type::is_always_equal::value)
{ x.swap(y); } { x.swap(y); }
private: private:

View File

@@ -1614,6 +1614,7 @@ class flat_map
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
BOOST_CONTAINER_FORCEINLINE friend void swap(flat_map& x, flat_map& y) BOOST_CONTAINER_FORCEINLINE friend void swap(flat_map& x, flat_map& y)
BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT(x.swap(y)))
{ x.swap(y); } { x.swap(y); }
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
@@ -2955,6 +2956,7 @@ class flat_multimap
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
BOOST_CONTAINER_FORCEINLINE friend void swap(flat_multimap& x, flat_multimap& y) BOOST_CONTAINER_FORCEINLINE friend void swap(flat_multimap& x, flat_multimap& y)
BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT(x.swap(y)))
{ x.swap(y); } { x.swap(y); }
}; };

View File

@@ -1084,7 +1084,9 @@ class flat_set
//! <b>Effects</b>: x.swap(y) //! <b>Effects</b>: x.swap(y)
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
friend void swap(flat_set& x, flat_set& y); friend void swap(flat_set& x, flat_set& y)
BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value
&& boost::container::dtl::is_nothrow_swappable<Compare>::value );
//! <b>Effects</b>: Extracts the internal sequence container. //! <b>Effects</b>: Extracts the internal sequence container.
//! //!
@@ -1806,7 +1808,9 @@ class flat_multiset
//! <b>Effects</b>: x.swap(y) //! <b>Effects</b>: x.swap(y)
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
friend void swap(flat_multiset& x, flat_multiset& y); friend void swap(flat_multiset& x, flat_multiset& y)
BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value
&& boost::container::dtl::is_nothrow_swappable<Compare>::value );
//! <b>Effects</b>: Extracts the internal sequence container. //! <b>Effects</b>: Extracts the internal sequence container.
//! //!

View File

@@ -1439,6 +1439,7 @@ class list
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
BOOST_CONTAINER_FORCEINLINE friend void swap(list& x, list& y) BOOST_CONTAINER_FORCEINLINE friend void swap(list& x, list& y)
BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT(x.swap(y)))
{ x.swap(y); } { x.swap(y); }
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED

View File

@@ -1064,7 +1064,7 @@ class map
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
void swap(map& x) void swap(map& x)
BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value
&& boost::container::dtl::is_nothrow_swappable<Compare>::value ) && boost::container::dtl::is_nothrow_swappable<Compare>::value );
//! <b>Effects</b>: erase(begin(),end()). //! <b>Effects</b>: erase(begin(),end()).
//! //!
@@ -1285,7 +1285,9 @@ class map
//! <b>Effects</b>: x.swap(y) //! <b>Effects</b>: x.swap(y)
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
friend void swap(map& x, map& y); friend void swap(map& x, map& y)
BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value
&& boost::container::dtl::is_nothrow_swappable<Compare>::value );
#endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
@@ -2216,7 +2218,9 @@ class multimap
//! <b>Effects</b>: x.swap(y) //! <b>Effects</b>: x.swap(y)
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
friend void swap(multimap& x, multimap& y); friend void swap(multimap& x, multimap& y)
BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value
&& boost::container::dtl::is_nothrow_swappable<Compare>::value );
#endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
}; };

View File

@@ -947,7 +947,9 @@ class set
//! <b>Effects</b>: x.swap(y) //! <b>Effects</b>: x.swap(y)
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
friend void swap(set& x, set& y); friend void swap(set& x, set& y)
BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value
&& boost::container::dtl::is_nothrow_swappable<Compare>::value );
#endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
}; };
@@ -1600,7 +1602,9 @@ class multiset
//! <b>Effects</b>: x.swap(y) //! <b>Effects</b>: x.swap(y)
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
friend void swap(multiset& x, multiset& y); friend void swap(multiset& x, multiset& y)
BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value
&& boost::container::dtl::is_nothrow_swappable<Compare>::value );
#endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
}; };

View File

@@ -1629,6 +1629,7 @@ class slist
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
friend void swap(slist& x, slist& y) friend void swap(slist& x, slist& y)
BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT(x.swap(y)))
{ x.swap(y); } { x.swap(y); }
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED

View File

@@ -1840,6 +1840,7 @@ class stable_vector
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
BOOST_CONTAINER_FORCEINLINE friend void swap(stable_vector& x, stable_vector& y) BOOST_CONTAINER_FORCEINLINE friend void swap(stable_vector& x, stable_vector& y)
BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT(x.swap(y)))
{ x.swap(y); } { x.swap(y); }
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED

View File

@@ -1169,6 +1169,7 @@ public:
#else #else
BOOST_CONTAINER_FORCEINLINE friend void swap(static_vector &x, static_vector &y) BOOST_CONTAINER_FORCEINLINE friend void swap(static_vector &x, static_vector &y)
BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT(x.swap(y)))
{ {
x.swap(y); x.swap(y);
} }
@@ -1275,13 +1276,15 @@ bool operator>= (static_vector<V, C1, O1> const& x, static_vector<V, C2, O2> con
//! @par Complexity //! @par Complexity
//! Linear O(N). //! Linear O(N).
template<typename V, std::size_t C1, std::size_t C2, class O1, class O2> template<typename V, std::size_t C1, std::size_t C2, class O1, class O2>
inline void swap(static_vector<V, C1, O1> & x, static_vector<V, C2, O2> & y); inline void swap(static_vector<V, C1, O1> & x, static_vector<V, C2, O2> & y)
BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT(x.swap(y)));
#else #else
template<typename V, std::size_t C1, std::size_t C2, class O1, class O2> template<typename V, std::size_t C1, std::size_t C2, class O1, class O2>
inline void swap(static_vector<V, C1, O1> & x, static_vector<V, C2, O2> & y inline void swap(static_vector<V, C1, O1> & x, static_vector<V, C2, O2> & y
, typename dtl::enable_if_c< C1 != C2>::type * = 0) , typename dtl::enable_if_c< C1 != C2>::type * = 0)
BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT(x.swap(y)))
{ {
x.swap(y); x.swap(y);
} }

View File

@@ -3399,6 +3399,7 @@ operator>=( const basic_string<CharT,Traits,Allocator>& x, BasicStringView<CharT
// Swap. // Swap.
template <class CharT, class Traits, class Allocator> template <class CharT, class Traits, class Allocator>
inline void swap(basic_string<CharT,Traits,Allocator>& x, basic_string<CharT,Traits,Allocator>& y) inline void swap(basic_string<CharT,Traits,Allocator>& x, basic_string<CharT,Traits,Allocator>& y)
BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT(x.swap(y)))
{ x.swap(y); } { x.swap(y); }
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED

View File

@@ -2197,6 +2197,7 @@ private:
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
BOOST_CONTAINER_FORCEINLINE friend void swap(vector& x, vector& y) BOOST_CONTAINER_FORCEINLINE friend void swap(vector& x, vector& y)
BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT(x.swap(y)))
{ x.swap(y); } { x.swap(y); }
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED