From a9cd6c353f909bbebbb39009ddd6f1635d2dfc00 Mon Sep 17 00:00:00 2001 From: Antony Polukhin Date: Sun, 3 Oct 2021 17:16:12 +0300 Subject: [PATCH] fix -Wdeprecated-copy warnings in string algorithms --- .../algorithm/string/detail/find_iterator.hpp | 14 ++++++++-- .../boost/algorithm/string/find_iterator.hpp | 28 ++++++++++++++++++- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/include/boost/algorithm/string/detail/find_iterator.hpp b/include/boost/algorithm/string/detail/find_iterator.hpp index 4f90a98..c990785 100644 --- a/include/boost/algorithm/string/detail/find_iterator.hpp +++ b/include/boost/algorithm/string/detail/find_iterator.hpp @@ -40,10 +40,18 @@ namespace boost { // Protected construction/destruction // Default constructor - find_iterator_base() {} + BOOST_DEFAULTED_FUNCTION(find_iterator_base(), {}) + // Copy construction - find_iterator_base( const find_iterator_base& Other ) : + BOOST_DEFAULTED_FUNCTION(find_iterator_base( const find_iterator_base& Other ), : m_Finder(Other.m_Finder) {} + ) + + // Assignment + BOOST_DEFAULTED_FUNCTION(find_iterator_base& operator=( const find_iterator_base& Other ), { + m_Finder = Other.m_Finder; + return *this; + }) // Constructor template @@ -51,7 +59,7 @@ namespace boost { m_Finder(Finder) {} // Destructor - ~find_iterator_base() {} + BOOST_DEFAULTED_FUNCTION(~find_iterator_base(), {}) // Find operation match_type do_find( diff --git a/include/boost/algorithm/string/find_iterator.hpp b/include/boost/algorithm/string/find_iterator.hpp index 5a52d92..47c20e6 100644 --- a/include/boost/algorithm/string/find_iterator.hpp +++ b/include/boost/algorithm/string/find_iterator.hpp @@ -74,7 +74,7 @@ namespace boost { \post eof()==true */ - find_iterator() {} + BOOST_DEFAULTED_FUNCTION(find_iterator(), {}) //! Copy constructor /*! @@ -85,6 +85,18 @@ namespace boost { m_Match(Other.m_Match), m_End(Other.m_End) {} + //! Copy assignment + /*! + Assigns a copy of the find_iterator + */ + BOOST_DEFAULTED_FUNCTION(find_iterator& operator=( const find_iterator& Other ), { + if (this == &Other) return *this; + this->base_type::operator=(Other); + m_Match = Other.m_Match; + m_End = Other.m_End; + return *this; + }) + //! Constructor /*! Construct new find_iterator for a given finder @@ -248,6 +260,20 @@ namespace boost { m_bEof(Other.m_bEof) {} + //! Assignment operator + /*! + Assigns a copy of the split_iterator + */ + BOOST_DEFAULTED_FUNCTION(split_iterator& operator=( const split_iterator& Other ), { + if (this == &Other) return *this; + this->base_type::operator=(Other); + m_Match = Other.m_Match; + m_Next = Other.m_Next; + m_End = Other.m_End; + m_bEof = Other.m_bEof; + return *this; + }) + //! Constructor /*! Construct new split_iterator for a given finder