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-26 11:05:01 +0900 |
commit | 3b1e4bbb3df6a0de8aa0693038449c6f0359ce91 (patch) | |
tree | 068068e7b1b6202c635bd655e346f838d715373c /indexlib/ifile.cpp | |
parent | b0f8eef013163b2098c2bb07e93cb9b194338b80 (diff) | |
download | tdepim-3b1e4bbb3df6a0de8aa0693038449c6f0359ce91.tar.gz tdepim-3b1e4bbb3df6a0de8aa0693038449c6f0359ce91.zip |
Replace auto_ptr
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit d2f343cc239e1fa25c9581cf35bada96692c41db)
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; } |