diff options
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; } |