summaryrefslogtreecommitdiffstats
path: root/indexlib/ifile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indexlib/ifile.cpp')
-rw-r--r--indexlib/ifile.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/indexlib/ifile.cpp b/indexlib/ifile.cpp
index 5709bb418..430574339 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;
}
@@ -169,7 +169,7 @@ std::vector<std::string> ifile::break_clean( const char* complete ) const {
std::sort( words.begin(), words.end() );
words.erase( std::unique( words.begin(), words.end() ), words.end() );
words.erase( std::remove_if( words.begin(), words.end(), &ifile::invalid_word ), words.end() );
- words.erase( std::remove_if( words.begin(), words.end(), std::bind1st( std::mem_fun( &ifile::is_stop_word ), this ) ), words.end() );
+ words.erase( std::remove_if( words.begin(), words.end(), std::bind( std::mem_fn( &ifile::is_stop_word ), this, std::placeholders::_1 ) ), words.end() );
return words;
}