From 1c988756d54027cae46d97962a9f5d5e46fba964 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 3 Oct 2024 18:31:59 +0300 Subject: [PATCH] Remove uses of BOOST_CONSTEXPR --- include/boost/smart_ptr/allocate_shared_array.hpp | 4 ++-- include/boost/smart_ptr/atomic_shared_ptr.hpp | 2 +- include/boost/smart_ptr/detail/local_counted_base.hpp | 4 ++-- include/boost/smart_ptr/detail/shared_count.hpp | 6 +++--- include/boost/smart_ptr/enable_shared_from_this.hpp | 5 ++--- include/boost/smart_ptr/intrusive_ptr.hpp | 4 +--- include/boost/smart_ptr/local_shared_ptr.hpp | 7 ++++--- include/boost/smart_ptr/shared_ptr.hpp | 8 ++++---- include/boost/smart_ptr/weak_ptr.hpp | 2 +- 9 files changed, 20 insertions(+), 22 deletions(-) diff --git a/include/boost/smart_ptr/allocate_shared_array.hpp b/include/boost/smart_ptr/allocate_shared_array.hpp index c057a99..bfc7a36 100644 --- a/include/boost/smart_ptr/allocate_shared_array.hpp +++ b/include/boost/smart_ptr/allocate_shared_array.hpp @@ -59,7 +59,7 @@ struct sp_align_up { }; template -BOOST_CONSTEXPR inline std::size_t +constexpr inline std::size_t sp_objects(std::size_t size) noexcept { return (size + sizeof(T) - 1) / sizeof(T); @@ -101,7 +101,7 @@ public: return allocator_; } - BOOST_CONSTEXPR std::size_t size() const noexcept { + constexpr std::size_t size() const noexcept { return N; } diff --git a/include/boost/smart_ptr/atomic_shared_ptr.hpp b/include/boost/smart_ptr/atomic_shared_ptr.hpp index b6cad28..2be0b64 100644 --- a/include/boost/smart_ptr/atomic_shared_ptr.hpp +++ b/include/boost/smart_ptr/atomic_shared_ptr.hpp @@ -74,7 +74,7 @@ public: return *this; } - BOOST_CONSTEXPR bool is_lock_free() const noexcept + constexpr bool is_lock_free() const noexcept { return false; } diff --git a/include/boost/smart_ptr/detail/local_counted_base.hpp b/include/boost/smart_ptr/detail/local_counted_base.hpp index cb16bc2..e4f99a5 100644 --- a/include/boost/smart_ptr/detail/local_counted_base.hpp +++ b/include/boost/smart_ptr/detail/local_counted_base.hpp @@ -42,11 +42,11 @@ private: public: - BOOST_CONSTEXPR local_counted_base() noexcept: local_use_count_( initial_ ) + constexpr local_counted_base() noexcept: local_use_count_( initial_ ) { } - BOOST_CONSTEXPR local_counted_base( local_counted_base const & ) noexcept: local_use_count_( initial_ ) + constexpr local_counted_base( local_counted_base const & ) noexcept: local_use_count_( initial_ ) { } diff --git a/include/boost/smart_ptr/detail/shared_count.hpp b/include/boost/smart_ptr/detail/shared_count.hpp index 2ccc1de..cafd3c2 100644 --- a/include/boost/smart_ptr/detail/shared_count.hpp +++ b/include/boost/smart_ptr/detail/shared_count.hpp @@ -120,14 +120,14 @@ private: public: - BOOST_CONSTEXPR shared_count() noexcept: pi_(0) + constexpr shared_count() noexcept: pi_(0) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) , id_(shared_count_id) #endif { } - BOOST_CONSTEXPR explicit shared_count( sp_counted_base * pi ) noexcept: pi_( pi ) + constexpr explicit shared_count( sp_counted_base * pi ) noexcept: pi_( pi ) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) , id_(shared_count_id) #endif @@ -501,7 +501,7 @@ private: public: - BOOST_CONSTEXPR weak_count() noexcept: pi_(0) + constexpr weak_count() noexcept: pi_(0) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) , id_(weak_count_id) #endif diff --git a/include/boost/smart_ptr/enable_shared_from_this.hpp b/include/boost/smart_ptr/enable_shared_from_this.hpp index 292e62e..0c2b3f9 100644 --- a/include/boost/smart_ptr/enable_shared_from_this.hpp +++ b/include/boost/smart_ptr/enable_shared_from_this.hpp @@ -16,7 +16,6 @@ #include #include #include -#include namespace boost { @@ -25,11 +24,11 @@ template class enable_shared_from_this { protected: - BOOST_CONSTEXPR enable_shared_from_this() noexcept + constexpr enable_shared_from_this() noexcept { } - BOOST_CONSTEXPR enable_shared_from_this(enable_shared_from_this const &) noexcept + constexpr enable_shared_from_this(enable_shared_from_this const &) noexcept { } diff --git a/include/boost/smart_ptr/intrusive_ptr.hpp b/include/boost/smart_ptr/intrusive_ptr.hpp index 2501424..ddb20c0 100644 --- a/include/boost/smart_ptr/intrusive_ptr.hpp +++ b/include/boost/smart_ptr/intrusive_ptr.hpp @@ -16,8 +16,6 @@ #include #include #include -#include -#include #include // for std::less #include // for std::basic_ostream @@ -51,7 +49,7 @@ public: typedef T element_type; - BOOST_CONSTEXPR intrusive_ptr() noexcept : px( 0 ) + constexpr intrusive_ptr() noexcept : px( 0 ) { } diff --git a/include/boost/smart_ptr/local_shared_ptr.hpp b/include/boost/smart_ptr/local_shared_ptr.hpp index 9be5aa3..5fac9c2 100644 --- a/include/boost/smart_ptr/local_shared_ptr.hpp +++ b/include/boost/smart_ptr/local_shared_ptr.hpp @@ -13,6 +13,7 @@ #include #include +#include namespace boost { @@ -137,16 +138,16 @@ public: // constructors - BOOST_CONSTEXPR local_shared_ptr() noexcept : px( 0 ), pn( 0 ) + constexpr local_shared_ptr() noexcept : px( 0 ), pn( 0 ) { } - BOOST_CONSTEXPR local_shared_ptr( std::nullptr_t ) noexcept : px( 0 ), pn( 0 ) + constexpr local_shared_ptr( std::nullptr_t ) noexcept : px( 0 ), pn( 0 ) { } // internal constructor, used by make_shared - BOOST_CONSTEXPR local_shared_ptr( boost::detail::lsp_internal_constructor_tag, element_type * px_, boost::detail::local_counted_base * pn_ ) noexcept : px( px_ ), pn( pn_ ) + constexpr local_shared_ptr( boost::detail::lsp_internal_constructor_tag, element_type * px_, boost::detail::local_counted_base * pn_ ) noexcept : px( px_ ), pn( pn_ ) { } diff --git a/include/boost/smart_ptr/shared_ptr.hpp b/include/boost/smart_ptr/shared_ptr.hpp index 220effb..2431a33 100644 --- a/include/boost/smart_ptr/shared_ptr.hpp +++ b/include/boost/smart_ptr/shared_ptr.hpp @@ -261,19 +261,19 @@ public: typedef typename boost::detail::sp_element< T >::type element_type; - BOOST_CONSTEXPR shared_ptr() noexcept : px( 0 ), pn() + constexpr shared_ptr() noexcept : px( 0 ), pn() { } - BOOST_CONSTEXPR shared_ptr( std::nullptr_t ) noexcept : px( 0 ), pn() + constexpr shared_ptr( std::nullptr_t ) noexcept : px( 0 ), pn() { } - BOOST_CONSTEXPR shared_ptr( boost::detail::sp_internal_constructor_tag, element_type * px_, boost::detail::shared_count const & pn_ ) noexcept : px( px_ ), pn( pn_ ) + constexpr shared_ptr( boost::detail::sp_internal_constructor_tag, element_type * px_, boost::detail::shared_count const & pn_ ) noexcept : px( px_ ), pn( pn_ ) { } - BOOST_CONSTEXPR shared_ptr( boost::detail::sp_internal_constructor_tag, element_type * px_, boost::detail::shared_count && pn_ ) noexcept : px( px_ ), pn( std::move( pn_ ) ) + constexpr shared_ptr( boost::detail::sp_internal_constructor_tag, element_type * px_, boost::detail::shared_count && pn_ ) noexcept : px( px_ ), pn( std::move( pn_ ) ) { } diff --git a/include/boost/smart_ptr/weak_ptr.hpp b/include/boost/smart_ptr/weak_ptr.hpp index 80a103a..61ad971 100644 --- a/include/boost/smart_ptr/weak_ptr.hpp +++ b/include/boost/smart_ptr/weak_ptr.hpp @@ -32,7 +32,7 @@ public: typedef typename boost::detail::sp_element< T >::type element_type; - BOOST_CONSTEXPR weak_ptr() noexcept : px(0), pn() + constexpr weak_ptr() noexcept : px(0), pn() { }