diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2024-01-23 10:13:00 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2024-01-23 10:13:00 +0900 |
commit | d2f343cc239e1fa25c9581cf35bada96692c41db (patch) | |
tree | 52a60c0c804e42a990ffb27ca69c54d7467ea814 /indexlib/ifile.cpp | |
parent | 3b3f9ec8f31978030c17309fae48335bea5c1587 (diff) | |
download | tdepim-d2f343cc239e1fa25c9581cf35bada96692c41db.tar.gz tdepim-d2f343cc239e1fa25c9581cf35bada96692c41db.zip |
Replace auto_ptr
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'indexlib/ifile.cpp')
-rw-r--r-- | indexlib/ifile.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
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<indexlib::result> ifile::everything() const { +std::unique_ptr<indexlib::result> ifile::everything() const { std::vector<unsigned> res( ndocs() ); for ( unsigned i = 0; i != ndocs(); ++i ) res[ i ] = i; - return std::auto_ptr<indexlib::result>( new indexlib::detail::simple_result( res ) ); + return std::unique_ptr<indexlib::result>( 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<indexlib::result> ifile::search( const char* str ) const { +std::unique_ptr<indexlib::result> ifile::search( const char* str ) const { using namespace indexlib::detail; using indexlib::result; assert( str ); if ( !*str ) return everything(); std::vector<std::string> words = break_clean( str ); - if ( words.empty() ) return std::auto_ptr<result>( new empty_result ); + if ( words.empty() ) return std::unique_ptr<result>( new empty_result ); words.erase( std::remove_if( words.begin(), words.end(), &word_too_small ), words.end() ); if ( words.empty() ) return everything(); std::set<unsigned> values = find_word( words[ 0 ] ); @@ -113,7 +113,7 @@ std::auto_ptr<indexlib::result> 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<result> r(new simple_result( std::vector<unsigned>( values.begin(), values.end() ) ) ); + std::unique_ptr<result> r(new simple_result( std::vector<unsigned>( values.begin(), values.end() ) ) ); return r; } |