From 1825265014f6c752a8f078ad51de4d36bcc02b27 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Fri, 6 Jan 2023 19:12:47 +0300 Subject: [PATCH] Marked boost::ref methods and associated functions with noexcept. --- doc/changes.qbk | 1 + include/boost/core/ref.hpp | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/doc/changes.qbk b/doc/changes.qbk index 8e63a18..02a5352 100644 --- a/doc/changes.qbk +++ b/doc/changes.qbk @@ -14,6 +14,7 @@ * Deprecated `boost/core/is_same.hpp` and `boost::core::is_same`. The header will be removed in a future release. Users are advised to use [@http://www.boost.org/doc/libs/release/libs/type_traits/doc/html/index.html Boost.TypeTraits] or C++ standard library type traits instead. +* Marked `boost::ref` member functions and associated methods with `noexcept`. [endsect] diff --git a/include/boost/core/ref.hpp b/include/boost/core/ref.hpp index a416cbd..6c7a8d0 100644 --- a/include/boost/core/ref.hpp +++ b/include/boost/core/ref.hpp @@ -92,11 +92,11 @@ public: @remark Does not throw. */ - BOOST_FORCEINLINE explicit reference_wrapper(T& t): t_(boost::addressof(t)) {} + BOOST_FORCEINLINE explicit reference_wrapper(T& t) BOOST_NOEXCEPT : t_(boost::addressof(t)) {} #if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, == 1600 ) - BOOST_FORCEINLINE explicit reference_wrapper( T & t, ref_workaround_tag ): t_( boost::addressof( t ) ) {} + BOOST_FORCEINLINE explicit reference_wrapper( T & t, ref_workaround_tag ) BOOST_NOEXCEPT : t_( boost::addressof( t ) ) {} #endif @@ -119,7 +119,7 @@ public: */ template reference_wrapper( reference_wrapper r, typename enable_if_c::value, - boost::detail::ref_empty>::type = boost::detail::ref_empty() ): t_( r.t_ ) + boost::detail::ref_empty>::type = boost::detail::ref_empty() ) BOOST_NOEXCEPT : t_( r.t_ ) { } @@ -127,20 +127,20 @@ public: @return The stored reference. @remark Does not throw. */ - BOOST_FORCEINLINE operator T& () const { return *t_; } + BOOST_FORCEINLINE operator T& () const BOOST_NOEXCEPT { return *t_; } /** @return The stored reference. @remark Does not throw. */ - BOOST_FORCEINLINE T& get() const { return *t_; } + BOOST_FORCEINLINE T& get() const BOOST_NOEXCEPT { return *t_; } /** @return A pointer to the object referenced by the stored reference. @remark Does not throw. */ - BOOST_FORCEINLINE T* get_pointer() const { return t_; } + BOOST_FORCEINLINE T* get_pointer() const BOOST_NOEXCEPT { return t_; } private: @@ -165,7 +165,7 @@ private: @return `reference_wrapper(t)` @remark Does not throw. */ -template BOOST_FORCEINLINE reference_wrapper BOOST_REF_CONST ref( T & t ) +template BOOST_FORCEINLINE reference_wrapper BOOST_REF_CONST ref( T & t ) BOOST_NOEXCEPT { #if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, == 1600 ) @@ -184,7 +184,7 @@ template BOOST_FORCEINLINE reference_wrapper BOOST_REF_CONST ref( T @return `reference_wrapper(t)` @remark Does not throw. */ -template BOOST_FORCEINLINE reference_wrapper BOOST_REF_CONST cref( T const & t ) +template BOOST_FORCEINLINE reference_wrapper BOOST_REF_CONST cref( T const & t ) BOOST_NOEXCEPT { return reference_wrapper(t); } @@ -315,7 +315,7 @@ template struct unwrap_reference< reference_wrapper const volatil @return `unwrap_reference::type&(t)` @remark Does not throw. */ -template BOOST_FORCEINLINE typename unwrap_reference::type& unwrap_ref( T & t ) +template BOOST_FORCEINLINE typename unwrap_reference::type& unwrap_ref( T & t ) BOOST_NOEXCEPT { return t; } @@ -325,7 +325,7 @@ template BOOST_FORCEINLINE typename unwrap_reference::type& unwrap_r /** @cond */ -template BOOST_FORCEINLINE T* get_pointer( reference_wrapper const & r ) +template BOOST_FORCEINLINE T* get_pointer( reference_wrapper const & r ) BOOST_NOEXCEPT { return r.get_pointer(); }