From d2f343cc239e1fa25c9581cf35bada96692c41db Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Tue, 23 Jan 2024 10:13:00 +0900 Subject: Replace auto_ptr Signed-off-by: Michele Calgaro --- indexlib/ifile.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indexlib/ifile.cpp') diff --git a/indexlib/ifile.cpp b/indexlib/ifile.cpp index 5709bb418..8ef5d2c6b 100644 --- a/indexlib/ifile.cpp +++ b/indexlib/ifile.cpp @@ -83,10 +83,10 @@ void ifile::remove_doc( const char* doc ) { // TODO: remove from words_ too if that's the case } -std::auto_ptr ifile::everything() const { +std::unique_ptr ifile::everything() const { std::vector res( ndocs() ); for ( unsigned i = 0; i != ndocs(); ++i ) res[ i ] = i; - return std::auto_ptr( new indexlib::detail::simple_result( res ) ); + return std::unique_ptr( new indexlib::detail::simple_result( res ) ); } namespace { @@ -94,13 +94,13 @@ inline bool word_too_small( std::string str ) { return str.size() < 3; } } -std::auto_ptr ifile::search( const char* str ) const { +std::unique_ptr ifile::search( const char* str ) const { using namespace indexlib::detail; using indexlib::result; assert( str ); if ( !*str ) return everything(); std::vector words = break_clean( str ); - if ( words.empty() ) return std::auto_ptr( new empty_result ); + if ( words.empty() ) return std::unique_ptr( new empty_result ); words.erase( std::remove_if( words.begin(), words.end(), &word_too_small ), words.end() ); if ( words.empty() ) return everything(); std::set values = find_word( words[ 0 ] ); @@ -113,7 +113,7 @@ std::auto_ptr ifile::search( const char* str ) const { std::set_intersection( now.begin(), now.end(), values.begin(), values.end(), std::inserter( next, next.begin() ) ); next.swap( values ); } - std::auto_ptr r(new simple_result( std::vector( values.begin(), values.end() ) ) ); + std::unique_ptr r(new simple_result( std::vector( values.begin(), values.end() ) ) ); return r; } -- cgit v1.2.1