summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorAndrew Morrow <acm@mongodb.com>2015-06-10 17:43:13 -0400
committerAndrew Morrow <acm@mongodb.com>2015-06-10 22:37:44 -0400
commita9b6612f5322f916298c19a6728817a1034c6aab (patch)
tree0da5b1ce36e6a8e2d85dbdeb49d505ac99bf6e1d /src/mongo/db
parent0ec1e625760eb9c1a20a3dba78200e8f9ff28d9e (diff)
downloadmongo-a9b6612f5322f916298c19a6728817a1034c6aab.tar.gz
SERVER-17309 Replace std::auto_ptr<T> with std::unique_ptr<T>
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/auth/authorization_manager.cpp8
-rw-r--r--src/mongo/db/auth/authorization_manager.h2
-rw-r--r--src/mongo/db/auth/user.cpp2
-rw-r--r--src/mongo/db/catalog/database.cpp6
-rw-r--r--src/mongo/db/catalog/index_catalog.cpp8
-rw-r--r--src/mongo/db/clientcursor.h2
-rw-r--r--src/mongo/db/cloner.cpp6
-rw-r--r--src/mongo/db/cloner.h2
-rw-r--r--src/mongo/db/commands/clone_collection.cpp4
-rw-r--r--src/mongo/db/commands/dbhash.cpp4
-rw-r--r--src/mongo/db/commands/distinct.cpp4
-rw-r--r--src/mongo/db/commands/index_filter_commands_test.cpp6
-rw-r--r--src/mongo/db/commands/list_collections.cpp6
-rw-r--r--src/mongo/db/commands/list_indexes.cpp6
-rw-r--r--src/mongo/db/commands/mr.cpp14
-rw-r--r--src/mongo/db/commands/parallel_collection_scan.cpp4
-rw-r--r--src/mongo/db/commands/pipeline_command.cpp8
-rw-r--r--src/mongo/db/commands/plan_cache_commands_test.cpp20
-rw-r--r--src/mongo/db/commands/repair_cursor.cpp6
-rw-r--r--src/mongo/db/commands/write_commands/batch_executor.cpp6
-rw-r--r--src/mongo/db/db.cpp4
-rw-r--r--src/mongo/db/dbcommands.cpp8
-rw-r--r--src/mongo/db/dbdirectclient.cpp4
-rw-r--r--src/mongo/db/dbdirectclient.h2
-rw-r--r--src/mongo/db/dbhelpers.cpp12
-rw-r--r--src/mongo/db/exec/and_hash.cpp4
-rw-r--r--src/mongo/db/exec/and_sorted.cpp4
-rw-r--r--src/mongo/db/exec/collection_scan.cpp4
-rw-r--r--src/mongo/db/exec/count.cpp4
-rw-r--r--src/mongo/db/exec/count_scan.cpp4
-rw-r--r--src/mongo/db/exec/delete.cpp4
-rw-r--r--src/mongo/db/exec/distinct_scan.cpp4
-rw-r--r--src/mongo/db/exec/fetch.cpp4
-rw-r--r--src/mongo/db/exec/geo_near.cpp8
-rw-r--r--src/mongo/db/exec/group.cpp4
-rw-r--r--src/mongo/db/exec/group.h2
-rw-r--r--src/mongo/db/exec/idhack.cpp4
-rw-r--r--src/mongo/db/exec/keep_mutations.cpp4
-rw-r--r--src/mongo/db/exec/limit.cpp4
-rw-r--r--src/mongo/db/exec/merge_sort.cpp4
-rw-r--r--src/mongo/db/exec/multi_plan.cpp6
-rw-r--r--src/mongo/db/exec/or.cpp4
-rw-r--r--src/mongo/db/exec/projection.cpp4
-rw-r--r--src/mongo/db/exec/projection_exec_test.cpp4
-rw-r--r--src/mongo/db/exec/queued_data_stage.cpp4
-rw-r--r--src/mongo/db/exec/queued_data_stage_test.cpp10
-rw-r--r--src/mongo/db/exec/shard_filter.cpp4
-rw-r--r--src/mongo/db/exec/skip.cpp4
-rw-r--r--src/mongo/db/exec/sort.cpp6
-rw-r--r--src/mongo/db/exec/stagedebug_cmd.cpp12
-rw-r--r--src/mongo/db/exec/subplan.cpp8
-rw-r--r--src/mongo/db/exec/text.cpp4
-rw-r--r--src/mongo/db/exec/update.cpp4
-rw-r--r--src/mongo/db/exec/working_set.h2
-rw-r--r--src/mongo/db/field_parser-inl.h12
-rw-r--r--src/mongo/db/geo/big_polygon.cpp4
-rw-r--r--src/mongo/db/geo/big_polygon_test.cpp2
-rw-r--r--src/mongo/db/geo/geoparser.cpp4
-rw-r--r--src/mongo/db/geo/r2_region_coverer_test.cpp6
-rw-r--r--src/mongo/db/instance.cpp4
-rw-r--r--src/mongo/db/matcher/expression_array_test.cpp72
-rw-r--r--src/mongo/db/matcher/expression_parser.cpp50
-rw-r--r--src/mongo/db/matcher/expression_parser_geo.cpp10
-rw-r--r--src/mongo/db/matcher/expression_parser_text.cpp4
-rw-r--r--src/mongo/db/matcher/expression_parser_tree.cpp6
-rw-r--r--src/mongo/db/matcher/expression_tree.h2
-rw-r--r--src/mongo/db/matcher/expression_tree_test.cpp98
-rw-r--r--src/mongo/db/matcher/expression_where.cpp6
-rw-r--r--src/mongo/db/matcher/expression_where_noop.cpp4
-rw-r--r--src/mongo/db/operation_context_impl.h2
-rw-r--r--src/mongo/db/operation_context_noop.h2
-rw-r--r--src/mongo/db/ops/modifier_table_test.cpp4
-rw-r--r--src/mongo/db/ops/parsed_delete.h2
-rw-r--r--src/mongo/db/ops/parsed_update.h2
-rw-r--r--src/mongo/db/ops/path_support_test.cpp56
-rw-r--r--src/mongo/db/ops/update_driver.cpp6
-rw-r--r--src/mongo/db/query/canonical_query.cpp10
-rw-r--r--src/mongo/db/query/canonical_query_test.cpp50
-rw-r--r--src/mongo/db/query/explain.cpp4
-rw-r--r--src/mongo/db/query/find.cpp4
-rw-r--r--src/mongo/db/query/get_executor.cpp26
-rw-r--r--src/mongo/db/query/get_executor_test.cpp6
-rw-r--r--src/mongo/db/query/index_bounds_builder_test.cpp78
-rw-r--r--src/mongo/db/query/lite_parsed_query.cpp8
-rw-r--r--src/mongo/db/query/lru_key_value.h10
-rw-r--r--src/mongo/db/query/lru_key_value_test.cpp8
-rw-r--r--src/mongo/db/query/parsed_projection.cpp4
-rw-r--r--src/mongo/db/query/parsed_projection_test.cpp24
-rw-r--r--src/mongo/db/query/plan_cache.cpp4
-rw-r--r--src/mongo/db/query/plan_cache_test.cpp48
-rw-r--r--src/mongo/db/query/plan_enumerator.cpp4
-rw-r--r--src/mongo/db/query/plan_executor.cpp2
-rw-r--r--src/mongo/db/query/planner_access.cpp10
-rw-r--r--src/mongo/db/query/planner_access.h10
-rw-r--r--src/mongo/db/query/planner_analysis.cpp4
-rw-r--r--src/mongo/db/query/planner_ixselect_test.cpp6
-rw-r--r--src/mongo/db/query/query_planner.cpp6
-rw-r--r--src/mongo/db/query/stage_builder.cpp10
-rw-r--r--src/mongo/db/range_deleter.cpp4
-rw-r--r--src/mongo/db/repl/master_slave.cpp6
-rw-r--r--src/mongo/db/repl/repl_set_heartbeat_response_test.cpp2
-rw-r--r--src/mongo/db/repl/replication_info.cpp4
-rw-r--r--src/mongo/db/repl/rs_rollback.cpp2
-rw-r--r--src/mongo/db/restapi.cpp4
-rw-r--r--src/mongo/db/stats/snapshots.cpp2
-rw-r--r--src/mongo/db/storage/mmap_v1/btree/btree_interface_test.cpp2
-rw-r--r--src/mongo/db/storage/mmap_v1/btree/btree_logic.cpp6
-rw-r--r--src/mongo/db/storage/mmap_v1/btree/btree_logic.h2
-rw-r--r--src/mongo/db/storage/mmap_v1/btree/btree_logic_test.cpp4
-rw-r--r--src/mongo/db/storage/mmap_v1/dur_recover.cpp12
-rw-r--r--src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.cpp6
-rw-r--r--src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp8
112 files changed, 525 insertions, 525 deletions
diff --git a/src/mongo/db/auth/authorization_manager.cpp b/src/mongo/db/auth/authorization_manager.cpp
index 9d8235663ec..d9f9fa6660c 100644
--- a/src/mongo/db/auth/authorization_manager.cpp
+++ b/src/mongo/db/auth/authorization_manager.cpp
@@ -464,7 +464,7 @@ namespace mongo {
return Status::OK();
}
- std::auto_ptr<User> user;
+ std::unique_ptr<User> user;
int authzVersion = _version;
guard.beginFetchPhase();
@@ -530,16 +530,16 @@ namespace mongo {
Status AuthorizationManager::_fetchUserV2(OperationContext* txn,
const UserName& userName,
- std::auto_ptr<User>* acquiredUser) {
+ std::unique_ptr<User>* acquiredUser) {
BSONObj userObj;
Status status = getUserDescription(txn, userName, &userObj);
if (!status.isOK()) {
return status;
}
- // Put the new user into an auto_ptr temporarily in case there's an error while
+ // Put the new user into an unique_ptr temporarily in case there's an error while
// initializing the user.
- std::auto_ptr<User> user(new User(userName));
+ std::unique_ptr<User> user(new User(userName));
status = _initializeUserFromPrivilegeDocument(user.get(), userObj);
if (!status.isOK()) {
diff --git a/src/mongo/db/auth/authorization_manager.h b/src/mongo/db/auth/authorization_manager.h
index 78e1e17ff82..009f8e8130b 100644
--- a/src/mongo/db/auth/authorization_manager.h
+++ b/src/mongo/db/auth/authorization_manager.h
@@ -344,7 +344,7 @@ namespace mongo {
*/
Status _fetchUserV2(OperationContext* txn,
const UserName& userName,
- std::auto_ptr<User>* acquiredUser);
+ std::unique_ptr<User>* acquiredUser);
/**
* True if access control enforcement is enabled in this AuthorizationManager.
diff --git a/src/mongo/db/auth/user.cpp b/src/mongo/db/auth/user.cpp
index 4fcfaf883cb..a2afa97a4e3 100644
--- a/src/mongo/db/auth/user.cpp
+++ b/src/mongo/db/auth/user.cpp
@@ -87,7 +87,7 @@ namespace mongo {
}
User* User::clone() const {
- std::auto_ptr<User> result(new User(_name));
+ std::unique_ptr<User> result(new User(_name));
result->_privileges = _privileges;
result->_roles = _roles;
result->_credentials = _credentials;
diff --git a/src/mongo/db/catalog/database.cpp b/src/mongo/db/catalog/database.cpp
index 1ac2e3f1c58..7753235fa8f 100644
--- a/src/mongo/db/catalog/database.cpp
+++ b/src/mongo/db/catalog/database.cpp
@@ -65,7 +65,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::list;
using std::set;
@@ -181,10 +181,10 @@ namespace mongo {
return collection;
}
- auto_ptr<CollectionCatalogEntry> cce( _dbEntry->getCollectionCatalogEntry( fullns ) );
+ unique_ptr<CollectionCatalogEntry> cce( _dbEntry->getCollectionCatalogEntry( fullns ) );
invariant( cce.get() );
- auto_ptr<RecordStore> rs( _dbEntry->getRecordStore( fullns ) );
+ unique_ptr<RecordStore> rs( _dbEntry->getRecordStore( fullns ) );
invariant( rs.get() ); // if cce exists, so should this
// Not registering AddCollectionChange since this is for collections that already exist.
diff --git a/src/mongo/db/catalog/index_catalog.cpp b/src/mongo/db/catalog/index_catalog.cpp
index 9e20c50656c..734c6c6e412 100644
--- a/src/mongo/db/catalog/index_catalog.cpp
+++ b/src/mongo/db/catalog/index_catalog.cpp
@@ -65,7 +65,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::string;
using std::vector;
@@ -164,9 +164,9 @@ namespace {
IndexCatalogEntry* IndexCatalog::_setupInMemoryStructures(OperationContext* txn,
IndexDescriptor* descriptor,
bool initFromDisk) {
- auto_ptr<IndexDescriptor> descriptorCleanup( descriptor );
+ unique_ptr<IndexDescriptor> descriptorCleanup( descriptor );
- auto_ptr<IndexCatalogEntry> entry( new IndexCatalogEntry( _collection->ns().ns(),
+ unique_ptr<IndexCatalogEntry> entry( new IndexCatalogEntry( _collection->ns().ns(),
_collection->getCatalogEntry(),
descriptorCleanup.release(),
_collection->infoCache() ) );
@@ -385,7 +385,7 @@ namespace {
IndexDescriptor* descriptor = new IndexDescriptor( _collection,
IndexNames::findPluginName(keyPattern),
_spec );
- auto_ptr<IndexDescriptor> descriptorCleaner( descriptor );
+ unique_ptr<IndexDescriptor> descriptorCleaner( descriptor );
_indexName = descriptor->indexName();
_indexNamespace = descriptor->indexNamespace();
diff --git a/src/mongo/db/clientcursor.h b/src/mongo/db/clientcursor.h
index 18e64a4c0fe..b2afdd56e10 100644
--- a/src/mongo/db/clientcursor.h
+++ b/src/mongo/db/clientcursor.h
@@ -264,7 +264,7 @@ namespace mongo {
// Only one of these is not-NULL.
RecoveryUnit* _unownedRU;
- std::auto_ptr<RecoveryUnit> _ownedRU;
+ std::unique_ptr<RecoveryUnit> _ownedRU;
// NOTE: _ownedRU must come before _exec, because _ownedRU must outlive _exec.
// The storage engine can have resources in the PlanExecutor that rely on
// the RecoveryUnit being alive.
diff --git a/src/mongo/db/cloner.cpp b/src/mongo/db/cloner.cpp
index 52aa4babaa1..8ed98728c83 100644
--- a/src/mongo/db/cloner.cpp
+++ b/src/mongo/db/cloner.cpp
@@ -68,7 +68,7 @@
namespace mongo {
using boost::scoped_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::list;
using std::set;
using std::endl;
@@ -467,7 +467,7 @@ namespace mongo {
}
else if ( !masterSameProcess ) {
std::string errmsg;
- auto_ptr<DBClientBase> con( cs.connect( errmsg ));
+ unique_ptr<DBClientBase> con( cs.connect( errmsg ));
if (!con.get()) {
return Status(ErrorCodes::HostUnreachable, errmsg);
}
@@ -479,7 +479,7 @@ namespace mongo {
"Unable to authenticate as internal user");
}
- _conn = con;
+ _conn = std::move(con);
}
else {
_conn.reset(new DBDirectClient(txn));
diff --git a/src/mongo/db/cloner.h b/src/mongo/db/cloner.h
index d537932dc83..2009d971869 100644
--- a/src/mongo/db/cloner.h
+++ b/src/mongo/db/cloner.h
@@ -88,7 +88,7 @@ namespace mongo {
bool mayBeInterrupted);
struct Fun;
- std::auto_ptr<DBClientBase> _conn;
+ std::unique_ptr<DBClientBase> _conn;
};
/**
diff --git a/src/mongo/db/commands/clone_collection.cpp b/src/mongo/db/commands/clone_collection.cpp
index a532a1e402f..2ef62f8b090 100644
--- a/src/mongo/db/commands/clone_collection.cpp
+++ b/src/mongo/db/commands/clone_collection.cpp
@@ -57,7 +57,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
using std::stringstream;
using std::endl;
@@ -146,7 +146,7 @@ namespace mongo {
<< " query: " << query << " " << ( copyIndexes ? "" : ", not copying indexes" ) << endl;
Cloner cloner;
- auto_ptr<DBClientConnection> myconn;
+ unique_ptr<DBClientConnection> myconn;
myconn.reset( new DBClientConnection() );
if ( ! myconn->connect( HostAndPort(fromhost) , errmsg ) )
return false;
diff --git a/src/mongo/db/commands/dbhash.cpp b/src/mongo/db/commands/dbhash.cpp
index b99d8305a40..e96fb4b6288 100644
--- a/src/mongo/db/commands/dbhash.cpp
+++ b/src/mongo/db/commands/dbhash.cpp
@@ -48,7 +48,7 @@
namespace mongo {
using boost::scoped_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::list;
using std::endl;
using std::set;
@@ -97,7 +97,7 @@ namespace mongo {
IndexDescriptor* desc = collection->getIndexCatalog()->findIdIndex( opCtx );
- auto_ptr<PlanExecutor> exec;
+ unique_ptr<PlanExecutor> exec;
if ( desc ) {
exec.reset(InternalPlanner::indexScan(opCtx,
collection,
diff --git a/src/mongo/db/commands/distinct.cpp b/src/mongo/db/commands/distinct.cpp
index 778bfdd723d..ceae947fc52 100644
--- a/src/mongo/db/commands/distinct.cpp
+++ b/src/mongo/db/commands/distinct.cpp
@@ -47,7 +47,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
using std::stringstream;
@@ -131,7 +131,7 @@ namespace mongo {
return 0;
}
- auto_ptr<PlanExecutor> exec(rawExec);
+ unique_ptr<PlanExecutor> exec(rawExec);
BSONObj obj;
PlanExecutor::ExecState state;
diff --git a/src/mongo/db/commands/index_filter_commands_test.cpp b/src/mongo/db/commands/index_filter_commands_test.cpp
index aaa54f054be..a1781f2b5bd 100644
--- a/src/mongo/db/commands/index_filter_commands_test.cpp
+++ b/src/mongo/db/commands/index_filter_commands_test.cpp
@@ -45,7 +45,7 @@ using namespace mongo;
namespace {
using boost::scoped_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
using std::vector;
@@ -97,10 +97,10 @@ namespace {
* Utility function to create a PlanRankingDecision
*/
PlanRankingDecision* createDecision(size_t numPlans) {
- auto_ptr<PlanRankingDecision> why(new PlanRankingDecision());
+ unique_ptr<PlanRankingDecision> why(new PlanRankingDecision());
for (size_t i = 0; i < numPlans; ++i) {
CommonStats common("COLLSCAN");
- auto_ptr<PlanStageStats> stats(new PlanStageStats(common, STAGE_COLLSCAN));
+ unique_ptr<PlanStageStats> stats(new PlanStageStats(common, STAGE_COLLSCAN));
stats->specific.reset(new CollectionScanStats());
why->stats.mutableVector().push_back(stats.release());
why->scores.push_back(0U);
diff --git a/src/mongo/db/commands/list_collections.cpp b/src/mongo/db/commands/list_collections.cpp
index 7773b0f0eed..a9fd6daea3b 100644
--- a/src/mongo/db/commands/list_collections.cpp
+++ b/src/mongo/db/commands/list_collections.cpp
@@ -130,8 +130,8 @@ namespace mongo {
names.sort();
}
- std::auto_ptr<WorkingSet> ws(new WorkingSet());
- std::auto_ptr<QueuedDataStage> root(new QueuedDataStage(ws.get()));
+ std::unique_ptr<WorkingSet> ws(new WorkingSet());
+ std::unique_ptr<QueuedDataStage> root(new QueuedDataStage(ws.get()));
for (std::list<std::string>::const_iterator i = names.begin();
i != names.end();
@@ -174,7 +174,7 @@ namespace mongo {
cursorNamespace,
PlanExecutor::YIELD_MANUAL,
&rawExec);
- std::auto_ptr<PlanExecutor> exec(rawExec);
+ std::unique_ptr<PlanExecutor> exec(rawExec);
if (!makeStatus.isOK()) {
return appendCommandStatus( result, makeStatus );
}
diff --git a/src/mongo/db/commands/list_indexes.cpp b/src/mongo/db/commands/list_indexes.cpp
index d84e605c21f..6cdee4785fd 100644
--- a/src/mongo/db/commands/list_indexes.cpp
+++ b/src/mongo/db/commands/list_indexes.cpp
@@ -136,8 +136,8 @@ namespace mongo {
cce->getAllIndexes( txn, &indexNames );
} MONGO_WRITE_CONFLICT_RETRY_LOOP_END(txn, "listIndexes", ns.ns());
- std::auto_ptr<WorkingSet> ws(new WorkingSet());
- std::auto_ptr<QueuedDataStage> root(new QueuedDataStage(ws.get()));
+ std::unique_ptr<WorkingSet> ws(new WorkingSet());
+ std::unique_ptr<QueuedDataStage> root(new QueuedDataStage(ws.get()));
for ( size_t i = 0; i < indexNames.size(); i++ ) {
BSONObj indexSpec;
@@ -166,7 +166,7 @@ namespace mongo {
cursorNamespace,
PlanExecutor::YIELD_MANUAL,
&rawExec);
- std::auto_ptr<PlanExecutor> exec(rawExec);
+ std::unique_ptr<PlanExecutor> exec(rawExec);
if (!makeStatus.isOK()) {
return appendCommandStatus( result, makeStatus );
}
diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp
index 3fbd4460493..099be62e3bc 100644
--- a/src/mongo/db/commands/mr.cpp
+++ b/src/mongo/db/commands/mr.cpp
@@ -74,7 +74,7 @@ namespace mongo {
using boost::scoped_ptr;
using boost::shared_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::set;
using std::string;
@@ -626,7 +626,7 @@ namespace mongo {
"M/R Merge Post Processing Progress",
count);
}
- auto_ptr<DBClientCursor> cursor = _db.query(_config.tempNamespace , BSONObj());
+ unique_ptr<DBClientCursor> cursor = _db.query(_config.tempNamespace , BSONObj());
while (cursor->more()) {
ScopedTransaction scopedXact(_txn, MODE_IX);
Lock::DBLock lock(_txn->lockState(),
@@ -650,7 +650,7 @@ namespace mongo {
"M/R Reduce Post Processing Progress",
count);
}
- auto_ptr<DBClientCursor> cursor = _db.query( _config.tempNamespace , BSONObj() );
+ unique_ptr<DBClientCursor> cursor = _db.query( _config.tempNamespace , BSONObj() );
while ( cursor->more() ) {
ScopedTransaction transaction(txn, MODE_X);
Lock::GlobalWrite lock(txn->lockState()); // TODO(erh) why global?
@@ -1048,7 +1048,7 @@ namespace mongo {
BSONObj(),
&cqRaw,
whereCallback).isOK());
- std::auto_ptr<CanonicalQuery> cq(cqRaw);
+ std::unique_ptr<CanonicalQuery> cq(cqRaw);
Collection* coll = getCollectionOrUassert(ctx->getDb(), _config.incLong);
invariant(coll);
@@ -1120,7 +1120,7 @@ namespace mongo {
return;
}
- auto_ptr<InMemory> n( new InMemory() ); // for new data
+ unique_ptr<InMemory> n( new InMemory() ); // for new data
long nSize = 0;
_dupCount = 0;
@@ -1327,7 +1327,7 @@ namespace mongo {
CollectionMetadataPtr collMetadata;
// Prevent sharding state from changing during the MR.
- auto_ptr<RangePreserver> rangePreserver;
+ unique_ptr<RangePreserver> rangePreserver;
{
AutoGetCollectionForRead ctx(txn, config.ns);
@@ -1416,7 +1416,7 @@ namespace mongo {
uasserted(17238, "Can't canonicalize query " + config.filter.toString());
return 0;
}
- std::auto_ptr<CanonicalQuery> cq(cqRaw);
+ std::unique_ptr<CanonicalQuery> cq(cqRaw);
Database* db = scopedAutoDb->getDb();
Collection* coll = state.getCollectionOrUassert(db, config.ns);
diff --git a/src/mongo/db/commands/parallel_collection_scan.cpp b/src/mongo/db/commands/parallel_collection_scan.cpp
index 08b760825d6..36acc5d9bb8 100644
--- a/src/mongo/db/commands/parallel_collection_scan.cpp
+++ b/src/mongo/db/commands/parallel_collection_scan.cpp
@@ -41,7 +41,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
class ParallelCollectionScanCmd : public Command {
@@ -115,7 +115,7 @@ namespace mongo {
Status execStatus = PlanExecutor::make(txn, ws, mis, collection,
PlanExecutor::YIELD_AUTO, &rawExec);
invariant(execStatus.isOK());
- auto_ptr<PlanExecutor> curExec(rawExec);
+ unique_ptr<PlanExecutor> curExec(rawExec);
// The PlanExecutor was registered on construction due to the YIELD_AUTO policy.
// We have to deregister it, as it will be registered with ClientCursor.
diff --git a/src/mongo/db/commands/pipeline_command.cpp b/src/mongo/db/commands/pipeline_command.cpp
index 792442914ed..34c0c2e5976 100644
--- a/src/mongo/db/commands/pipeline_command.cpp
+++ b/src/mongo/db/commands/pipeline_command.cpp
@@ -59,7 +59,7 @@ namespace mongo {
using boost::intrusive_ptr;
using boost::scoped_ptr;
using boost::shared_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
using std::stringstream;
using std::endl;
@@ -219,7 +219,7 @@ namespace mongo {
PlanExecutor* exec = NULL;
scoped_ptr<ClientCursorPin> pin; // either this OR the execHolder will be non-null
- auto_ptr<PlanExecutor> execHolder;
+ unique_ptr<PlanExecutor> execHolder;
{
// This will throw if the sharding version for this connection is out of date. The
// lock must be held continuously from now until we have we created both the output
@@ -242,8 +242,8 @@ namespace mongo {
// Create the PlanExecutor which returns results from the pipeline. The WorkingSet
// ('ws') and the PipelineProxyStage ('proxy') will be owned by the created
// PlanExecutor.
- auto_ptr<WorkingSet> ws(new WorkingSet());
- auto_ptr<PipelineProxyStage> proxy(
+ unique_ptr<WorkingSet> ws(new WorkingSet());
+ unique_ptr<PipelineProxyStage> proxy(
new PipelineProxyStage(pPipeline, input, ws.get()));
Status execStatus = Status::OK();
if (NULL == collection) {
diff --git a/src/mongo/db/commands/plan_cache_commands_test.cpp b/src/mongo/db/commands/plan_cache_commands_test.cpp
index dd2c0333288..69a9c461a76 100644
--- a/src/mongo/db/commands/plan_cache_commands_test.cpp
+++ b/src/mongo/db/commands/plan_cache_commands_test.cpp
@@ -47,7 +47,7 @@ using namespace mongo;
namespace {
using boost::scoped_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
using std::vector;
@@ -98,7 +98,7 @@ namespace {
* Utility function to create a SolutionCacheData
*/
SolutionCacheData* createSolutionCacheData() {
- auto_ptr<SolutionCacheData> scd(new SolutionCacheData());
+ unique_ptr<SolutionCacheData> scd(new SolutionCacheData());
scd->tree.reset(new PlanCacheIndexTree());
return scd.release();
}
@@ -107,10 +107,10 @@ namespace {
* Utility function to create a PlanRankingDecision
*/
PlanRankingDecision* createDecision(size_t numPlans) {
- auto_ptr<PlanRankingDecision> why(new PlanRankingDecision());
+ unique_ptr<PlanRankingDecision> why(new PlanRankingDecision());
for (size_t i = 0; i < numPlans; ++i) {
CommonStats common("COLLSCAN");
- auto_ptr<PlanStageStats> stats(new PlanStageStats(common, STAGE_COLLSCAN));
+ unique_ptr<PlanStageStats> stats(new PlanStageStats(common, STAGE_COLLSCAN));
stats->specific.reset(new CollectionScanStats());
why->stats.mutableVector().push_back(stats.release());
why->scores.push_back(0U);
@@ -129,7 +129,7 @@ namespace {
// Create a canonical query
CanonicalQuery* cqRaw;
ASSERT_OK(CanonicalQuery::canonicalize(ns, fromjson("{a: 1}"), &cqRaw));
- auto_ptr<CanonicalQuery> cq(cqRaw);
+ unique_ptr<CanonicalQuery> cq(cqRaw);
// Plan cache with one entry
PlanCache planCache;
@@ -154,7 +154,7 @@ namespace {
// Create a canonical query
CanonicalQuery* cqRaw;
ASSERT_OK(CanonicalQuery::canonicalize(ns, fromjson("{a: 1}"), &cqRaw));
- auto_ptr<CanonicalQuery> cq(cqRaw);
+ unique_ptr<CanonicalQuery> cq(cqRaw);
// Plan cache with one entry
PlanCache planCache;
@@ -261,9 +261,9 @@ namespace {
// Create 2 canonical queries.
CanonicalQuery* cqRaw;
ASSERT_OK(CanonicalQuery::canonicalize(ns, fromjson("{a: 1}"), &cqRaw));
- auto_ptr<CanonicalQuery> cqA(cqRaw);
+ unique_ptr<CanonicalQuery> cqA(cqRaw);
ASSERT_OK(CanonicalQuery::canonicalize(ns, fromjson("{b: 1}"), &cqRaw));
- auto_ptr<CanonicalQuery> cqB(cqRaw);
+ unique_ptr<CanonicalQuery> cqB(cqRaw);
// Create plan cache with 2 entries.
PlanCache planCache;
@@ -378,7 +378,7 @@ namespace {
// Create a canonical query
CanonicalQuery* cqRaw;
ASSERT_OK(CanonicalQuery::canonicalize(ns, fromjson("{a: 1}"), &cqRaw));
- auto_ptr<CanonicalQuery> cq(cqRaw);
+ unique_ptr<CanonicalQuery> cq(cqRaw);
// Plan cache with one entry
PlanCache planCache;
@@ -397,7 +397,7 @@ namespace {
// Create a canonical query
CanonicalQuery* cqRaw;
ASSERT_OK(CanonicalQuery::canonicalize(ns, fromjson("{a: 1}"), &cqRaw));
- auto_ptr<CanonicalQuery> cq(cqRaw);
+ unique_ptr<CanonicalQuery> cq(cqRaw);
// Plan cache with one entry
PlanCache planCache;
diff --git a/src/mongo/db/commands/repair_cursor.cpp b/src/mongo/db/commands/repair_cursor.cpp
index 8828bdcdae0..0598b67b9c3 100644
--- a/src/mongo/db/commands/repair_cursor.cpp
+++ b/src/mongo/db/commands/repair_cursor.cpp
@@ -87,8 +87,8 @@ namespace mongo {
"repair iterator not supported"));
}
- std::auto_ptr<WorkingSet> ws(new WorkingSet());
- std::auto_ptr<MultiIteratorStage> stage(new MultiIteratorStage(txn, ws.get(),
+ std::unique_ptr<WorkingSet> ws(new WorkingSet());
+ std::unique_ptr<MultiIteratorStage> stage(new MultiIteratorStage(txn, ws.get(),
collection));
stage->addIterator(std::move(cursor));
@@ -100,7 +100,7 @@ namespace mongo {
PlanExecutor::YIELD_AUTO,
&rawExec);
invariant(execStatus.isOK());
- std::auto_ptr<PlanExecutor> exec(rawExec);
+ std::unique_ptr<PlanExecutor> exec(rawExec);
// 'exec' will be used in getMore(). It was automatically registered on construction
// due to the auto yield policy, so it could yield during plan selection. We deregister
diff --git a/src/mongo/db/commands/write_commands/batch_executor.cpp b/src/mongo/db/commands/write_commands/batch_executor.cpp
index 68150b76c81..f13689c1bf1 100644
--- a/src/mongo/db/commands/write_commands/batch_executor.cpp
+++ b/src/mongo/db/commands/write_commands/batch_executor.cpp
@@ -85,7 +85,7 @@
namespace mongo {
using boost::scoped_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::string;
using std::vector;
@@ -108,7 +108,7 @@ namespace mongo {
private:
WriteOpStats _stats;
- std::auto_ptr<WriteErrorDetail> _error;
+ std::unique_ptr<WriteErrorDetail> _error;
};
} // namespace
@@ -247,7 +247,7 @@ namespace mongo {
// OR if something succeeded and we're unordered.
//
- auto_ptr<WCErrorDetail> wcError;
+ unique_ptr<WCErrorDetail> wcError;
bool needToEnforceWC = writeErrors.empty()
|| ( !request.getOrdered()
&& writeErrors.size() < request.sizeWriteOps() );
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp
index e5555bdd33e..66c45f76dff 100644
--- a/src/mongo/db/db.cpp
+++ b/src/mongo/db/db.cpp
@@ -124,7 +124,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::cout;
using std::cerr;
using std::endl;
@@ -351,7 +351,7 @@ namespace mongo {
const string systemIndexes = db->name() + ".system.indexes";
Collection* coll = db->getCollection( systemIndexes );
- auto_ptr<PlanExecutor> exec(
+ unique_ptr<PlanExecutor> exec(
InternalPlanner::collectionScan(&txn, systemIndexes, coll));
BSONObj index;
diff --git a/src/mongo/db/dbcommands.cpp b/src/mongo/db/dbcommands.cpp
index 8d26dc191fb..af49eb9d779 100644
--- a/src/mongo/db/dbcommands.cpp
+++ b/src/mongo/db/dbcommands.cpp
@@ -110,7 +110,7 @@
namespace mongo {
using boost::scoped_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::ostringstream;
using std::string;
@@ -598,7 +598,7 @@ namespace mongo {
return 0;
}
- auto_ptr<PlanExecutor> exec(rawExec);
+ unique_ptr<PlanExecutor> exec(rawExec);
// Process notifications when the lock is released/reacquired in the loop below
exec->registerExec();
@@ -665,7 +665,7 @@ namespace mongo {
DBDirectClient client(txn);
Query q(query);
q.sort(sort);
- auto_ptr<DBClientCursor> c = client.query(ns, q);
+ unique_ptr<DBClientCursor> c = client.query(ns, q);
while(c->more())
PRINT(c->nextSafe());
}
@@ -729,7 +729,7 @@ namespace mongo {
result.appendBool( "estimate" , estimate );
- auto_ptr<PlanExecutor> exec;
+ unique_ptr<PlanExecutor> exec;
if ( min.isEmpty() && max.isEmpty() ) {
if ( estimate ) {
result.appendNumber( "size" , static_cast<long long>(collection->dataSize(txn)) );
diff --git a/src/mongo/db/dbdirectclient.cpp b/src/mongo/db/dbdirectclient.cpp
index f0107baf9ce..6f297520379 100644
--- a/src/mongo/db/dbdirectclient.cpp
+++ b/src/mongo/db/dbdirectclient.cpp
@@ -39,7 +39,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::string;
@@ -146,7 +146,7 @@ namespace mongo {
assembleResponse(_txn, toSend, dbResponse, dummyHost);
}
- auto_ptr<DBClientCursor> DBDirectClient::query(const string& ns,
+ unique_ptr<DBClientCursor> DBDirectClient::query(const string& ns,
Query query,
int nToReturn,
int nToSkip,
diff --git a/src/mongo/db/dbdirectclient.h b/src/mongo/db/dbdirectclient.h
index 0a8b5122dd0..835b63eab46 100644
--- a/src/mongo/db/dbdirectclient.h
+++ b/src/mongo/db/dbdirectclient.h
@@ -58,7 +58,7 @@ namespace mongo {
// XXX: is this valid or useful?
void setOpCtx(OperationContext* txn);
- virtual std::auto_ptr<DBClientCursor> query(const std::string &ns,
+ virtual std::unique_ptr<DBClientCursor> query(const std::string &ns,
Query query,
int nToReturn = 0,
int nToSkip = 0,
diff --git a/src/mongo/db/dbhelpers.cpp b/src/mongo/db/dbhelpers.cpp
index 93dd0b05dde..ae5444b8c1a 100644
--- a/src/mongo/db/dbhelpers.cpp
+++ b/src/mongo/db/dbhelpers.cpp
@@ -68,7 +68,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::ios_base;
using std::ofstream;
@@ -145,7 +145,7 @@ namespace mongo {
&rawExec,
options).isOK());
- auto_ptr<PlanExecutor> exec(rawExec);
+ unique_ptr<PlanExecutor> exec(rawExec);
PlanExecutor::ExecState state;
RecordId loc;
if (PlanExecutor::ADVANCED == (state = exec->getNext(NULL, &loc))) {
@@ -200,7 +200,7 @@ namespace mongo {
bool Helpers::getSingleton(OperationContext* txn, const char *ns, BSONObj& result) {
AutoGetCollectionForRead ctx(txn, ns);
- auto_ptr<PlanExecutor> exec(InternalPlanner::collectionScan(txn, ns, ctx.getCollection()));
+ unique_ptr<PlanExecutor> exec(InternalPlanner::collectionScan(txn, ns, ctx.getCollection()));
PlanExecutor::ExecState state = exec->getNext(&result, NULL);
CurOp::get(txn)->done();
@@ -214,7 +214,7 @@ namespace mongo {
bool Helpers::getLast(OperationContext* txn, const char *ns, BSONObj& result) {
AutoGetCollectionForRead autoColl(txn, ns);
- auto_ptr<PlanExecutor> exec(InternalPlanner::collectionScan(txn,
+ unique_ptr<PlanExecutor> exec(InternalPlanner::collectionScan(txn,
ns,
autoColl.getCollection(),
InternalPlanner::BACKWARD));
@@ -366,7 +366,7 @@ namespace mongo {
collection->getIndexCatalog()->findIndexByKeyPattern( txn,
indexKeyPattern.toBSON() );
- auto_ptr<PlanExecutor> exec(InternalPlanner::indexScan(txn, collection, desc,
+ unique_ptr<PlanExecutor> exec(InternalPlanner::indexScan(txn, collection, desc,
min, max,
maxInclusive,
InternalPlanner::FORWARD,
@@ -539,7 +539,7 @@ namespace mongo {
bool isLargeChunk = false;
long long docCount = 0;
- auto_ptr<PlanExecutor> exec(
+ unique_ptr<PlanExecutor> exec(
InternalPlanner::indexScan(txn, collection, idx, min, max, false));
// we can afford to yield here because any change to the base data that we might miss is
// already being queued and will be migrated in the 'transferMods' stage
diff --git a/src/mongo/db/exec/and_hash.cpp b/src/mongo/db/exec/and_hash.cpp
index 8374c9740ca..adc24c42394 100644
--- a/src/mongo/db/exec/and_hash.cpp
+++ b/src/mongo/db/exec/and_hash.cpp
@@ -45,7 +45,7 @@ namespace {
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::vector;
const size_t AndHashStage::kLookAheadWorks = 10;
@@ -535,7 +535,7 @@ namespace mongo {
_commonStats.filter = bob.obj();
}
- auto_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_AND_HASH));
+ unique_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_AND_HASH));
ret->specific.reset(new AndHashStats(_specificStats));
for (size_t i = 0; i < _children.size(); ++i) {
ret->children.push_back(_children[i]->getStats());
diff --git a/src/mongo/db/exec/and_sorted.cpp b/src/mongo/db/exec/and_sorted.cpp
index 813895fc619..c201a7633aa 100644
--- a/src/mongo/db/exec/and_sorted.cpp
+++ b/src/mongo/db/exec/and_sorted.cpp
@@ -36,7 +36,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::numeric_limits;
using std::vector;
@@ -326,7 +326,7 @@ namespace mongo {
_commonStats.filter = bob.obj();
}
- auto_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_AND_SORTED));
+ unique_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_AND_SORTED));
ret->specific.reset(new AndSortedStats(_specificStats));
for (size_t i = 0; i < _children.size(); ++i) {
ret->children.push_back(_children[i]->getStats());
diff --git a/src/mongo/db/exec/collection_scan.cpp b/src/mongo/db/exec/collection_scan.cpp
index fb8bdf4a311..1a0c16c6b55 100644
--- a/src/mongo/db/exec/collection_scan.cpp
+++ b/src/mongo/db/exec/collection_scan.cpp
@@ -46,7 +46,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::vector;
// static
@@ -250,7 +250,7 @@ namespace mongo {
_commonStats.filter = bob.obj();
}
- auto_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_COLLSCAN));
+ unique_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_COLLSCAN));
ret->specific.reset(new CollectionScanStats(_specificStats));
return ret.release();
}
diff --git a/src/mongo/db/exec/count.cpp b/src/mongo/db/exec/count.cpp
index 5b3eb904647..9d747c31aca 100644
--- a/src/mongo/db/exec/count.cpp
+++ b/src/mongo/db/exec/count.cpp
@@ -36,7 +36,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::vector;
// static
@@ -200,7 +200,7 @@ namespace mongo {
PlanStageStats* CountStage::getStats() {
_commonStats.isEOF = isEOF();
- auto_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_COUNT));
+ unique_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_COUNT));
CountStats* countStats = new CountStats(_specificStats);
ret->specific.reset(countStats);
if (_child.get()) {
diff --git a/src/mongo/db/exec/count_scan.cpp b/src/mongo/db/exec/count_scan.cpp
index 1a801c82566..668313367d9 100644
--- a/src/mongo/db/exec/count_scan.cpp
+++ b/src/mongo/db/exec/count_scan.cpp
@@ -34,7 +34,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::vector;
// static
@@ -159,7 +159,7 @@ namespace mongo {
}
PlanStageStats* CountScan::getStats() {
- auto_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_COUNT_SCAN));
+ unique_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_COUNT_SCAN));
CountScanStats* countStats = new CountScanStats(_specificStats);
countStats->keyPattern = _specificStats.keyPattern.getOwned();
diff --git a/src/mongo/db/exec/delete.cpp b/src/mongo/db/exec/delete.cpp
index b034df535fc..787f3f244bf 100644
--- a/src/mongo/db/exec/delete.cpp
+++ b/src/mongo/db/exec/delete.cpp
@@ -45,7 +45,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::vector;
// static
@@ -291,7 +291,7 @@ namespace mongo {
PlanStageStats* DeleteStage::getStats() {
_commonStats.isEOF = isEOF();
- auto_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_DELETE));
+ unique_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_DELETE));
ret->specific.reset(new DeleteStats(_specificStats));
ret->children.push_back(_child->getStats());
return ret.release();
diff --git a/src/mongo/db/exec/distinct_scan.cpp b/src/mongo/db/exec/distinct_scan.cpp
index 4185877064c..24dcc36019a 100644
--- a/src/mongo/db/exec/distinct_scan.cpp
+++ b/src/mongo/db/exec/distinct_scan.cpp
@@ -37,7 +37,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::vector;
// static
@@ -149,7 +149,7 @@ namespace mongo {
}
PlanStageStats* DistinctScan::getStats() {
- auto_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_DISTINCT_SCAN));
+ unique_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_DISTINCT_SCAN));
ret->specific.reset(new DistinctScanStats(_specificStats));
return ret.release();
}
diff --git a/src/mongo/db/exec/fetch.cpp b/src/mongo/db/exec/fetch.cpp
index 481640cc971..817bc72fc8d 100644
--- a/src/mongo/db/exec/fetch.cpp
+++ b/src/mongo/db/exec/fetch.cpp
@@ -41,7 +41,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::vector;
// static
@@ -239,7 +239,7 @@ namespace mongo {
_commonStats.filter = bob.obj();
}
- auto_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_FETCH));
+ unique_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_FETCH));
ret->specific.reset(new FetchStats(_specificStats));
ret->children.push_back(_child->getStats());
return ret.release();
diff --git a/src/mongo/db/exec/geo_near.cpp b/src/mongo/db/exec/geo_near.cpp
index dd284e71f0b..3755af02bb3 100644
--- a/src/mongo/db/exec/geo_near.cpp
+++ b/src/mongo/db/exec/geo_near.cpp
@@ -54,7 +54,7 @@ namespace mongo {
using boost::scoped_ptr;
using std::abs;
- using std::auto_ptr;
+ using std::unique_ptr;
//
// Shared GeoNear search functionality
@@ -79,7 +79,7 @@ namespace mongo {
if (!element.isABSONObj())
return NULL;
- auto_ptr<StoredGeometry> stored(new StoredGeometry);
+ unique_ptr<StoredGeometry> stored(new StoredGeometry);
if (!stored->geometry.parseFromStorage(element).isOK())
return NULL;
stored->element = element;
@@ -106,7 +106,7 @@ namespace mongo {
for (BSONElementSet::iterator it = geomElements.begin(); it != geomElements.end(); ++it) {
const BSONElement& el = *it;
- auto_ptr<StoredGeometry> stored(StoredGeometry::parseFrom(el));
+ unique_ptr<StoredGeometry> stored(StoredGeometry::parseFrom(el));
if (stored.get()) {
// Valid geometry element
@@ -746,7 +746,7 @@ namespace mongo {
const CRS queryCRS = _nearParams.nearQuery->centroid->crs;
- auto_ptr<R2Region> coverRegion;
+ unique_ptr<R2Region> coverRegion;
if (FLAT == queryCRS) {
diff --git a/src/mongo/db/exec/group.cpp b/src/mongo/db/exec/group.cpp
index d5d3688d4c5..68b21928b62 100644
--- a/src/mongo/db/exec/group.cpp
+++ b/src/mongo/db/exec/group.cpp
@@ -38,7 +38,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::vector;
namespace {
@@ -285,7 +285,7 @@ namespace mongo {
PlanStageStats* GroupStage::getStats() {
_commonStats.isEOF = isEOF();
- auto_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_GROUP));
+ unique_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_GROUP));
GroupStats* groupStats = new GroupStats(_specificStats);
ret->specific.reset(groupStats);
ret->children.push_back(_child->getStats());
diff --git a/src/mongo/db/exec/group.h b/src/mongo/db/exec/group.h
index dcf96570cbe..2b2e5bb3d04 100644
--- a/src/mongo/db/exec/group.h
+++ b/src/mongo/db/exec/group.h
@@ -151,7 +151,7 @@ namespace mongo {
// The Scope object that all script operations for this group stage will use. Initialized
// by initGroupScripting(). Owned here.
- std::auto_ptr<Scope> _scope;
+ std::unique_ptr<Scope> _scope;
// The reduce function for the group operation. Initialized by initGroupScripting(). Owned
// by _scope.
diff --git a/src/mongo/db/exec/idhack.cpp b/src/mongo/db/exec/idhack.cpp
index 149d20e3509..73a950e4dc2 100644
--- a/src/mongo/db/exec/idhack.cpp
+++ b/src/mongo/db/exec/idhack.cpp
@@ -42,7 +42,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::vector;
// static
@@ -240,7 +240,7 @@ namespace mongo {
PlanStageStats* IDHackStage::getStats() {
_commonStats.isEOF = isEOF();
- auto_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_IDHACK));
+ unique_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_IDHACK));
ret->specific.reset(new IDHackStats(_specificStats));
return ret.release();
}
diff --git a/src/mongo/db/exec/keep_mutations.cpp b/src/mongo/db/exec/keep_mutations.cpp
index a58c979f02a..7c88a59fde5 100644
--- a/src/mongo/db/exec/keep_mutations.cpp
+++ b/src/mongo/db/exec/keep_mutations.cpp
@@ -33,7 +33,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::vector;
// static
@@ -142,7 +142,7 @@ namespace mongo {
PlanStageStats* KeepMutationsStage::getStats() {
_commonStats.isEOF = isEOF();
- auto_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_KEEP_MUTATIONS));
+ unique_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_KEEP_MUTATIONS));
// Takes ownership of the object returned from _child->getStats().
ret->children.push_back(_child->getStats());
return ret.release();
diff --git a/src/mongo/db/exec/limit.cpp b/src/mongo/db/exec/limit.cpp
index 9853cde3e57..c766d07c650 100644
--- a/src/mongo/db/exec/limit.cpp
+++ b/src/mongo/db/exec/limit.cpp
@@ -34,7 +34,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::vector;
// static
@@ -119,7 +119,7 @@ namespace mongo {
PlanStageStats* LimitStage::getStats() {
_commonStats.isEOF = isEOF();
- auto_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_LIMIT));
+ unique_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_LIMIT));
ret->specific.reset(new LimitStats(_specificStats));
ret->children.push_back(_child->getStats());
return ret.release();
diff --git a/src/mongo/db/exec/merge_sort.cpp b/src/mongo/db/exec/merge_sort.cpp
index 6d394ba00d6..37c8269a502 100644
--- a/src/mongo/db/exec/merge_sort.cpp
+++ b/src/mongo/db/exec/merge_sort.cpp
@@ -35,7 +35,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::list;
using std::string;
using std::vector;
@@ -270,7 +270,7 @@ namespace mongo {
_specificStats.sortPattern = _pattern;
- auto_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_SORT_MERGE));
+ unique_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_SORT_MERGE));
ret->specific.reset(new MergeSortStats(_specificStats));
for (size_t i = 0; i < _children.size(); ++i) {
ret->children.push_back(_children[i]->getStats());
diff --git a/src/mongo/db/exec/multi_plan.cpp b/src/mongo/db/exec/multi_plan.cpp
index 3258ab719b0..8bc98d109bd 100644
--- a/src/mongo/db/exec/multi_plan.cpp
+++ b/src/mongo/db/exec/multi_plan.cpp
@@ -51,7 +51,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::list;
using std::vector;
@@ -245,7 +245,7 @@ namespace mongo {
// After picking best plan, ranking will own plan stats from
// candidate solutions (winner and losers).
- std::auto_ptr<PlanRankingDecision> ranking(new PlanRankingDecision);
+ std::unique_ptr<PlanRankingDecision> ranking(new PlanRankingDecision);
_bestPlanIdx = PlanRanker::pickBestPlan(_candidates, ranking.get());
verify(_bestPlanIdx >= 0 && _bestPlanIdx < static_cast<int>(_candidates.size()));
@@ -500,7 +500,7 @@ namespace mongo {
}
_commonStats.isEOF = isEOF();
- auto_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_MULTI_PLAN));
+ unique_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_MULTI_PLAN));
return ret.release();
}
diff --git a/src/mongo/db/exec/or.cpp b/src/mongo/db/exec/or.cpp
index c27c1a1598f..a7d370c41fa 100644
--- a/src/mongo/db/exec/or.cpp
+++ b/src/mongo/db/exec/or.cpp
@@ -35,7 +35,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::vector;
// static
@@ -185,7 +185,7 @@ namespace mongo {
_commonStats.filter = bob.obj();
}
- auto_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_OR));
+ unique_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_OR));
ret->specific.reset(new OrStats(_specificStats));
for (size_t i = 0; i < _children.size(); ++i) {
ret->children.push_back(_children[i]->getStats());
diff --git a/src/mongo/db/exec/projection.cpp b/src/mongo/db/exec/projection.cpp
index 7e4f513e4b7..15d06963b31 100644
--- a/src/mongo/db/exec/projection.cpp
+++ b/src/mongo/db/exec/projection.cpp
@@ -41,7 +41,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::vector;
@@ -275,7 +275,7 @@ namespace mongo {
PlanStageStats* ProjectionStage::getStats() {
_commonStats.isEOF = isEOF();
- auto_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_PROJECTION));
+ unique_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_PROJECTION));
ProjectionStats* projStats = new ProjectionStats(_specificStats);
projStats->projObj = _projObj;
diff --git a/src/mongo/db/exec/projection_exec_test.cpp b/src/mongo/db/exec/projection_exec_test.cpp
index 2ad9fd3b4e0..56d9cbc5be2 100644
--- a/src/mongo/db/exec/projection_exec_test.cpp
+++ b/src/mongo/db/exec/projection_exec_test.cpp
@@ -42,7 +42,7 @@ using namespace mongo;
namespace {
- using std::auto_ptr;
+ using std::unique_ptr;
/**
* Utility function to create MatchExpression
@@ -77,7 +77,7 @@ namespace {
// Create projection exec object.
BSONObj spec = fromjson(specStr);
BSONObj query = fromjson(queryStr);
- auto_ptr<MatchExpression> queryExpression(parseMatchExpression(query));
+ unique_ptr<MatchExpression> queryExpression(parseMatchExpression(query));
ProjectionExec exec(spec, queryExpression.get());
// Create working set member.
diff --git a/src/mongo/db/exec/queued_data_stage.cpp b/src/mongo/db/exec/queued_data_stage.cpp
index b353cb6026d..740f3084740 100644
--- a/src/mongo/db/exec/queued_data_stage.cpp
+++ b/src/mongo/db/exec/queued_data_stage.cpp
@@ -33,7 +33,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::vector;
const char* QueuedDataStage::kStageType = "QUEUED_DATA";
@@ -84,7 +84,7 @@ namespace mongo {
PlanStageStats* QueuedDataStage::getStats() {
_commonStats.isEOF = isEOF();
- auto_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_QUEUED_DATA));
+ unique_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_QUEUED_DATA));
ret->specific.reset(new MockStats(_specificStats));
return ret.release();
}
diff --git a/src/mongo/db/exec/queued_data_stage_test.cpp b/src/mongo/db/exec/queued_data_stage_test.cpp
index 26bc5962a8a..ef823c04cfb 100644
--- a/src/mongo/db/exec/queued_data_stage_test.cpp
+++ b/src/mongo/db/exec/queued_data_stage_test.cpp
@@ -38,19 +38,19 @@ using namespace mongo;
namespace {
- using std::auto_ptr;
+ using std::unique_ptr;
//
// Basic test that we get out valid stats objects.
//
TEST(QueuedDataStageTest, getValidStats) {
WorkingSet ws;
- auto_ptr<QueuedDataStage> mock(new QueuedDataStage(&ws));
+ unique_ptr<QueuedDataStage> mock(new QueuedDataStage(&ws));
const CommonStats* commonStats = mock->getCommonStats();
ASSERT_EQUALS(commonStats->works, static_cast<size_t>(0));
const SpecificStats* specificStats = mock->getSpecificStats();
ASSERT(specificStats);
- auto_ptr<PlanStageStats> allStats(mock->getStats());
+ unique_ptr<PlanStageStats> allStats(mock->getStats());
ASSERT_EQUALS(allStats->stageType, mock->stageType());
}
@@ -60,7 +60,7 @@ namespace {
TEST(QueuedDataStageTest, validateStats) {
WorkingSet ws;
WorkingSetID wsID;
- auto_ptr<QueuedDataStage> mock(new QueuedDataStage(&ws));
+ unique_ptr<QueuedDataStage> mock(new QueuedDataStage(&ws));
// make sure that we're at all zero
const CommonStats* stats = mock->getCommonStats();
@@ -101,7 +101,7 @@ namespace {
// and now we are d1U, but must trigger EOF with getStats()
ASSERT_FALSE(stats->isEOF);
- auto_ptr<PlanStageStats> allStats(mock->getStats());
+ unique_ptr<PlanStageStats> allStats(mock->getStats());
ASSERT_TRUE(stats->isEOF);
}
}
diff --git a/src/mongo/db/exec/shard_filter.cpp b/src/mongo/db/exec/shard_filter.cpp
index 26f546ec836..2727b1c99f8 100644
--- a/src/mongo/db/exec/shard_filter.cpp
+++ b/src/mongo/db/exec/shard_filter.cpp
@@ -38,7 +38,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::vector;
// static
@@ -150,7 +150,7 @@ namespace mongo {
PlanStageStats* ShardFilterStage::getStats() {
_commonStats.isEOF = isEOF();
- auto_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_SHARDING_FILTER));
+ unique_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_SHARDING_FILTER));
ret->children.push_back(_child->getStats());
ret->specific.reset(new ShardingFilterStats(_specificStats));
return ret.release();
diff --git a/src/mongo/db/exec/skip.cpp b/src/mongo/db/exec/skip.cpp
index be2284bca0c..979e952b1d7 100644
--- a/src/mongo/db/exec/skip.cpp
+++ b/src/mongo/db/exec/skip.cpp
@@ -33,7 +33,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::vector;
// static
@@ -118,7 +118,7 @@ namespace mongo {
PlanStageStats* SkipStage::getStats() {
_commonStats.isEOF = isEOF();
_specificStats.skip = _toSkip;
- auto_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_SKIP));
+ unique_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_SKIP));
ret->specific.reset(new SkipStats(_specificStats));
ret->children.push_back(_child->getStats());
return ret.release();
diff --git a/src/mongo/db/exec/sort.cpp b/src/mongo/db/exec/sort.cpp
index 3f2e8be89ad..61dd09e1dbc 100644
--- a/src/mongo/db/exec/sort.cpp
+++ b/src/mongo/db/exec/sort.cpp
@@ -45,7 +45,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::vector;
@@ -238,7 +238,7 @@ namespace mongo {
CanonicalQuery* rawQueryForSort;
verify(CanonicalQuery::canonicalize(
"fake_ns", queryObj, &rawQueryForSort, WhereCallbackNoop()).isOK());
- auto_ptr<CanonicalQuery> queryForSort(rawQueryForSort);
+ unique_ptr<CanonicalQuery> queryForSort(rawQueryForSort);
vector<QuerySolution*> solns;
LOG(5) << "Sort stage: Planning to obtain bounds for sort." << endl;
@@ -477,7 +477,7 @@ namespace mongo {
_specificStats.limit = _limit;
_specificStats.sortPattern = _pattern.getOwned();
- auto_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_SORT));
+ unique_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_SORT));
ret->specific.reset(new SortStats(_specificStats));
ret->children.push_back(_child->getStats());
return ret.release();
diff --git a/src/mongo/db/exec/stagedebug_cmd.cpp b/src/mongo/db/exec/stagedebug_cmd.cpp
index bd5c771e1a2..c3b59a84de2 100644
--- a/src/mongo/db/exec/stagedebug_cmd.cpp
+++ b/src/mongo/db/exec/stagedebug_cmd.cpp
@@ -59,7 +59,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
using std::vector;
@@ -153,7 +153,7 @@ namespace mongo {
// Parse the plan into these.
OwnedPointerVector<MatchExpression> exprs;
- auto_ptr<WorkingSet> ws(new WorkingSet());
+ unique_ptr<WorkingSet> ws(new WorkingSet());
PlanStage* userRoot = parseQuery(txn, collection, planObj, ws.get(), &exprs);
uassert(16911, "Couldn't parse plan from " + cmdObj.toString(), NULL != userRoot);
@@ -260,7 +260,7 @@ namespace mongo {
uassert(16921, "Nodes argument must be provided to AND",
nodeArgs["nodes"].isABSONObj());
- auto_ptr<AndHashStage> andStage(new AndHashStage(workingSet, matcher, collection));
+ unique_ptr<AndHashStage> andStage(new AndHashStage(workingSet, matcher, collection));
int nodesAdded = 0;
BSONObjIterator it(nodeArgs["nodes"].Obj());
@@ -285,7 +285,7 @@ namespace mongo {
uassert(16924, "Nodes argument must be provided to AND",
nodeArgs["nodes"].isABSONObj());
- auto_ptr<AndSortedStage> andStage(new AndSortedStage(workingSet, matcher,
+ unique_ptr<AndSortedStage> andStage(new AndSortedStage(workingSet, matcher,
collection));
int nodesAdded = 0;
@@ -313,7 +313,7 @@ namespace mongo {
uassert(16935, "Dedup argument must be provided to OR",
!nodeArgs["dedup"].eoo());
BSONObjIterator it(nodeArgs["nodes"].Obj());
- auto_ptr<OrStage> orStage(new OrStage(workingSet, nodeArgs["dedup"].Bool(),
+ unique_ptr<OrStage> orStage(new OrStage(workingSet, nodeArgs["dedup"].Bool(),
matcher));
while (it.more()) {
BSONElement e = it.next();
@@ -404,7 +404,7 @@ namespace mongo {
params.pattern = nodeArgs["pattern"].Obj();
// Dedup is true by default.
- auto_ptr<MergeSortStage> mergeStage(new MergeSortStage(params, workingSet,
+ unique_ptr<MergeSortStage> mergeStage(new MergeSortStage(params, workingSet,
collection));
BSONObjIterator it(nodeArgs["nodes"].Obj());
diff --git a/src/mongo/db/exec/subplan.cpp b/src/mongo/db/exec/subplan.cpp
index 364c429429d..386d72eb539 100644
--- a/src/mongo/db/exec/subplan.cpp
+++ b/src/mongo/db/exec/subplan.cpp
@@ -45,7 +45,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::vector;
@@ -238,11 +238,11 @@ namespace mongo {
Status SubplanStage::choosePlanForSubqueries(PlanYieldPolicy* yieldPolicy) {
// This is what we annotate with the index selections and then turn into a solution.
- auto_ptr<OrMatchExpression> orExpr(
+ unique_ptr<OrMatchExpression> orExpr(
static_cast<OrMatchExpression*>(_query->root()->shallowClone()));
// This is the skeleton of index selections that is inserted into the cache.
- auto_ptr<PlanCacheIndexTree> cacheData(new PlanCacheIndexTree());
+ unique_ptr<PlanCacheIndexTree> cacheData(new PlanCacheIndexTree());
for (size_t i = 0; i < orExpr->numChildren(); ++i) {
MatchExpression* orChild = orExpr->getChild(i);
@@ -537,7 +537,7 @@ namespace mongo {
PlanStageStats* SubplanStage::getStats() {
_commonStats.isEOF = isEOF();
- auto_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_SUBPLAN));
+ unique_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_SUBPLAN));
ret->children.push_back(_child->getStats());
return ret.release();
}
diff --git a/src/mongo/db/exec/text.cpp b/src/mongo/db/exec/text.cpp
index 5a62fc9937d..f9db2e94be3 100644
--- a/src/mongo/db/exec/text.cpp
+++ b/src/mongo/db/exec/text.cpp
@@ -41,7 +41,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
using std::vector;
@@ -184,7 +184,7 @@ namespace mongo {
_commonStats.filter = bob.obj();
}
- auto_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_TEXT));
+ unique_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_TEXT));
ret->specific.reset(new TextStats(_specificStats));
return ret.release();
}
diff --git a/src/mongo/db/exec/update.cpp b/src/mongo/db/exec/update.cpp
index cf26b1ff794..8ba566cd7e0 100644
--- a/src/mongo/db/exec/update.cpp
+++ b/src/mongo/db/exec/update.cpp
@@ -46,7 +46,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
using std::vector;
@@ -1060,7 +1060,7 @@ namespace mongo {
PlanStageStats* UpdateStage::getStats() {
_commonStats.isEOF = isEOF();
- auto_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_UPDATE));
+ unique_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_UPDATE));
ret->specific.reset(new UpdateStats(_specificStats));
ret->children.push_back(_child->getStats());
return ret.release();
diff --git a/src/mongo/db/exec/working_set.h b/src/mongo/db/exec/working_set.h
index 07fee7fb659..d251f95d5c4 100644
--- a/src/mongo/db/exec/working_set.h
+++ b/src/mongo/db/exec/working_set.h
@@ -340,7 +340,7 @@ namespace mongo {
private:
boost::scoped_ptr<WorkingSetComputedData> _computed[WSM_COMPUTED_NUM_TYPES];
- std::auto_ptr<RecordFetcher> _fetcher;
+ std::unique_ptr<RecordFetcher> _fetcher;
};
} // namespace mongo
diff --git a/src/mongo/db/field_parser-inl.h b/src/mongo/db/field_parser-inl.h
index fd919a42adb..04dbccf9e2a 100644
--- a/src/mongo/db/field_parser-inl.h
+++ b/src/mongo/db/field_parser-inl.h
@@ -82,7 +82,7 @@ namespace mongo {
BSONElement elem = doc[field.name()];
if (elem.eoo()) {
if (field.hasDefault()) {
- std::auto_ptr<T> temp(new T);
+ std::unique_ptr<T> temp(new T);
field.getDefault()->cloneTo(temp.get());
*out = temp.release();
@@ -98,7 +98,7 @@ namespace mongo {
return FIELD_INVALID;
}
- std::auto_ptr<T> temp(new T);
+ std::unique_ptr<T> temp(new T);
if (!temp->parseBSON(elem.embeddedObject(), errMsg)) {
return FIELD_INVALID;
}
@@ -134,7 +134,7 @@ namespace mongo {
return FIELD_INVALID;
}
- std::auto_ptr<T> temp(new T);
+ std::unique_ptr<T> temp(new T);
if (!temp->parseBSON(elem.embeddedObject(), errMsg)) {
return FIELD_INVALID;
}
@@ -249,7 +249,7 @@ namespace mongo {
return FIELD_INVALID;
}
- std::auto_ptr<T> toInsert(new T);
+ std::unique_ptr<T> toInsert(new T);
if ( !toInsert->parseBSON( next.embeddedObject(), errMsg )
|| !toInsert->isValid( errMsg ) ) {
@@ -289,7 +289,7 @@ namespace mongo {
return FIELD_INVALID;
}
- std::auto_ptr<std::vector<T*> > tempVector(new std::vector<T*>);
+ std::unique_ptr<std::vector<T*> > tempVector(new std::vector<T*>);
BSONArray arr = BSONArray(elem.embeddedObject());
BSONObjIterator objIt(arr);
@@ -306,7 +306,7 @@ namespace mongo {
return FIELD_INVALID;
}
- std::auto_ptr<T> toInsert(new T);
+ std::unique_ptr<T> toInsert(new T);
if (!toInsert->parseBSON(next.embeddedObject(), errMsg)) {
clearOwnedVector(tempVector.get());
return FIELD_INVALID;
diff --git a/src/mongo/db/geo/big_polygon.cpp b/src/mongo/db/geo/big_polygon.cpp
index eb6540651cb..10241db45dc 100644
--- a/src/mongo/db/geo/big_polygon.cpp
+++ b/src/mongo/db/geo/big_polygon.cpp
@@ -37,7 +37,7 @@
namespace mongo {
using boost::scoped_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::vector;
@@ -165,7 +165,7 @@ namespace mongo {
if (_borderPoly)
return *_borderPoly;
- auto_ptr<S2Loop> cloned(_loop->Clone());
+ unique_ptr<S2Loop> cloned(_loop->Clone());
// Any loop in polygon should be than a hemisphere (2*Pi).
cloned->Normalize();
diff --git a/src/mongo/db/geo/big_polygon_test.cpp b/src/mongo/db/geo/big_polygon_test.cpp
index a8cde9bc909..c0c01abdba7 100644
--- a/src/mongo/db/geo/big_polygon_test.cpp
+++ b/src/mongo/db/geo/big_polygon_test.cpp
@@ -35,7 +35,7 @@
namespace {
using namespace mongo;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
using std::vector;
diff --git a/src/mongo/db/geo/geoparser.cpp b/src/mongo/db/geo/geoparser.cpp
index 570b82454c6..95c0f33ac57 100644
--- a/src/mongo/db/geo/geoparser.cpp
+++ b/src/mongo/db/geo/geoparser.cpp
@@ -44,7 +44,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::stringstream;
// This field must be present, and...
@@ -287,7 +287,7 @@ namespace mongo {
elem.toString(false));
}
- auto_ptr<S2Loop> loop(new S2Loop(exteriorVertices));
+ unique_ptr<S2Loop> loop(new S2Loop(exteriorVertices));
// Check whether this loop is valid.
if (!loop->IsValid(&err)) {
return BAD_VALUE("Loop is not valid: " << elem.toString(false) << " " << err);
diff --git a/src/mongo/db/geo/r2_region_coverer_test.cpp b/src/mongo/db/geo/r2_region_coverer_test.cpp
index 470d6208e37..e1df6edea77 100644
--- a/src/mongo/db/geo/r2_region_coverer_test.cpp
+++ b/src/mongo/db/geo/r2_region_coverer_test.cpp
@@ -38,7 +38,7 @@
namespace {
- using std::auto_ptr;
+ using std::unique_ptr;
using namespace mongo;
using mongo::Polygon; // "windows.h" has another Polygon for Windows GDI.
@@ -270,7 +270,7 @@ namespace {
coverer.setMaxLevel( coverer.minLevel() + 4 );
double radius = randDouble(0.0, MAXBOUND / 2);
- auto_ptr<GeometryContainer> geometry(getRandomCircle(radius));
+ unique_ptr<GeometryContainer> geometry(getRandomCircle(radius));
const R2Region& region = geometry->getR2Region();
vector<GeoHash> covering;
@@ -293,7 +293,7 @@ namespace {
// 100 * 2 ^ -32 ~= 2.3E-8 (cell edge length)
double radius = randDouble(1E-15, ldexp(100.0, -32) * 10);
- auto_ptr<GeometryContainer> geometry(getRandomCircle(radius));
+ unique_ptr<GeometryContainer> geometry(getRandomCircle(radius));
const R2Region& region = geometry->getR2Region();
vector<GeoHash> covering;
diff --git a/src/mongo/db/instance.cpp b/src/mongo/db/instance.cpp
index bdc5687ef70..8381d244727 100644
--- a/src/mongo/db/instance.cpp
+++ b/src/mongo/db/instance.cpp
@@ -112,7 +112,7 @@ namespace mongo {
using boost::scoped_ptr;
using logger::LogComponent;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::hex;
using std::ios;
@@ -390,7 +390,7 @@ namespace {
DbMessage d(m);
QueryMessage q(d);
- auto_ptr< Message > resp( new Message() );
+ unique_ptr< Message > resp( new Message() );
CurOp& op = *CurOp::get(txn);
diff --git a/src/mongo/db/matcher/expression_array_test.cpp b/src/mongo/db/matcher/expression_array_test.cpp
index 96a89254a34..891d12752f6 100644
--- a/src/mongo/db/matcher/expression_array_test.cpp
+++ b/src/mongo/db/matcher/expression_array_test.cpp
@@ -38,13 +38,13 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
TEST( ElemMatchObjectMatchExpression, MatchesElementSingle ) {
BSONObj baseOperand = BSON( "b" << 5 );
BSONObj match = BSON( "a" << BSON_ARRAY( BSON( "b" << 5.0 ) ) );
BSONObj notMatch = BSON( "a" << BSON_ARRAY( BSON( "b" << 6 ) ) );
- auto_ptr<ComparisonMatchExpression> eq( new EqualityMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> eq( new EqualityMatchExpression() );
ASSERT( eq->init( "b", baseOperand[ "b" ] ).isOK() );
ElemMatchObjectMatchExpression op;
ASSERT( op.init( "a", eq.release() ).isOK() );
@@ -56,7 +56,7 @@ namespace mongo {
BSONObj baseOperand = BSON( "1" << 5 );
BSONObj match = BSON( "a" << BSON_ARRAY( BSON_ARRAY( 's' << 5.0 ) ) );
BSONObj notMatch = BSON( "a" << BSON_ARRAY( BSON_ARRAY( 5 << 6 ) ) );
- auto_ptr<ComparisonMatchExpression> eq( new EqualityMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> eq( new EqualityMatchExpression() );
ASSERT( eq->init( "1", baseOperand[ "1" ] ).isOK() );
ElemMatchObjectMatchExpression op;
ASSERT( op.init( "a", eq.release() ).isOK() );
@@ -73,14 +73,14 @@ namespace mongo {
BSONObj notMatch3 = BSON( "a" << BSON_ARRAY( BSON( "b" << BSON_ARRAY( 5 << 6 ) ) ) );
BSONObj match =
BSON( "a" << BSON_ARRAY( BSON( "b" << BSON_ARRAY( 5 << 6 ) << "c" << 7 ) ) );
- auto_ptr<ComparisonMatchExpression> eq1( new EqualityMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> eq1( new EqualityMatchExpression() );
ASSERT( eq1->init( "b", baseOperand1[ "b" ] ).isOK() );
- auto_ptr<ComparisonMatchExpression> eq2( new EqualityMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> eq2( new EqualityMatchExpression() );
ASSERT( eq2->init( "b", baseOperand2[ "b" ] ).isOK() );
- auto_ptr<ComparisonMatchExpression> eq3( new EqualityMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> eq3( new EqualityMatchExpression() );
ASSERT( eq3->init( "c", baseOperand3[ "c" ] ).isOK() );
- auto_ptr<AndMatchExpression> andOp( new AndMatchExpression() );
+ unique_ptr<AndMatchExpression> andOp( new AndMatchExpression() );
andOp->add( eq1.release() );
andOp->add( eq2.release() );
andOp->add( eq3.release() );
@@ -95,7 +95,7 @@ namespace mongo {
TEST( ElemMatchObjectMatchExpression, MatchesNonArray ) {
BSONObj baseOperand = BSON( "b" << 5 );
- auto_ptr<ComparisonMatchExpression> eq( new EqualityMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> eq( new EqualityMatchExpression() );
ASSERT( eq->init( "b", baseOperand[ "b" ] ).isOK() );
ElemMatchObjectMatchExpression op;
ASSERT( op.init( "a", eq.release() ).isOK() );
@@ -108,7 +108,7 @@ namespace mongo {
TEST( ElemMatchObjectMatchExpression, MatchesArrayObject ) {
BSONObj baseOperand = BSON( "b" << 5 );
- auto_ptr<ComparisonMatchExpression> eq( new EqualityMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> eq( new EqualityMatchExpression() );
ASSERT( eq->init( "b", baseOperand[ "b" ] ).isOK() );
ElemMatchObjectMatchExpression op;
ASSERT( op.init( "a", eq.release() ).isOK() );
@@ -121,7 +121,7 @@ namespace mongo {
TEST( ElemMatchObjectMatchExpression, MatchesMultipleNamedValues ) {
BSONObj baseOperand = BSON( "c" << 5 );
- auto_ptr<ComparisonMatchExpression> eq( new EqualityMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> eq( new EqualityMatchExpression() );
ASSERT( eq->init( "c", baseOperand[ "c" ] ).isOK() );
ElemMatchObjectMatchExpression op;
ASSERT( op.init( "a.b", eq.release() ).isOK() );
@@ -142,7 +142,7 @@ namespace mongo {
TEST( ElemMatchObjectMatchExpression, ElemMatchKey ) {
BSONObj baseOperand = BSON( "c" << 6 );
- auto_ptr<ComparisonMatchExpression> eq( new EqualityMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> eq( new EqualityMatchExpression() );
ASSERT( eq->init( "c", baseOperand[ "c" ] ).isOK() );
ElemMatchObjectMatchExpression op;
ASSERT( op.init( "a.b", eq.release() ).isOK() );
@@ -172,7 +172,7 @@ namespace mongo {
/**
TEST( ElemMatchObjectMatchExpression, MatchesIndexKey ) {
BSONObj baseOperand = BSON( "b" << 5 );
- auto_ptr<ComparisonMatchExpression> eq( new ComparisonMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> eq( new ComparisonMatchExpression() );
ASSERT( eq->init( "b", baseOperand[ "b" ] ).isOK() );
ElemMatchObjectMatchExpression op;
ASSERT( op.init( "a", eq.release() ).isOK() );
@@ -187,7 +187,7 @@ namespace mongo {
BSONObj baseOperand = BSON( "$gt" << 5 );
BSONObj match = BSON( "a" << BSON_ARRAY( 6 ) );
BSONObj notMatch = BSON( "a" << BSON_ARRAY( 4 ) );
- auto_ptr<ComparisonMatchExpression> gt( new GTMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> gt( new GTMatchExpression() );
ASSERT( gt->init( "", baseOperand[ "$gt" ] ).isOK() );
ElemMatchValueMatchExpression op;
ASSERT( op.init( "a", gt.release() ).isOK() );
@@ -201,9 +201,9 @@ namespace mongo {
BSONObj notMatch1 = BSON( "a" << BSON_ARRAY( 0 << 1 ) );
BSONObj notMatch2 = BSON( "a" << BSON_ARRAY( 10 << 11 ) );
BSONObj match = BSON( "a" << BSON_ARRAY( 0 << 5 << 11 ) );
- auto_ptr<ComparisonMatchExpression> gt( new GTMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> gt( new GTMatchExpression() );
ASSERT( gt->init( "", baseOperand1[ "$gt" ] ).isOK() );
- auto_ptr<ComparisonMatchExpression> lt( new LTMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> lt( new LTMatchExpression() );
ASSERT( lt->init( "", baseOperand2[ "$lt" ] ).isOK() );
ElemMatchValueMatchExpression op;
@@ -218,7 +218,7 @@ namespace mongo {
TEST( ElemMatchValueMatchExpression, MatchesNonArray ) {
BSONObj baseOperand = BSON( "$gt" << 5 );
- auto_ptr<ComparisonMatchExpression> gt( new GTMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> gt( new GTMatchExpression() );
ASSERT( gt->init( "", baseOperand[ "$gt" ] ).isOK() );
ElemMatchObjectMatchExpression op;
ASSERT( op.init( "a", gt.release() ).isOK() );
@@ -230,7 +230,7 @@ namespace mongo {
TEST( ElemMatchValueMatchExpression, MatchesArrayScalar ) {
BSONObj baseOperand = BSON( "$gt" << 5 );
- auto_ptr<ComparisonMatchExpression> gt( new GTMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> gt( new GTMatchExpression() );
ASSERT( gt->init( "", baseOperand[ "$gt" ] ).isOK() );
ElemMatchValueMatchExpression op;
ASSERT( op.init( "a", gt.release() ).isOK() );
@@ -241,7 +241,7 @@ namespace mongo {
TEST( ElemMatchValueMatchExpression, MatchesMultipleNamedValues ) {
BSONObj baseOperand = BSON( "$gt" << 5 );
- auto_ptr<ComparisonMatchExpression> gt( new GTMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> gt( new GTMatchExpression() );
ASSERT( gt->init( "", baseOperand[ "$gt" ] ).isOK() );
ElemMatchValueMatchExpression op;
ASSERT( op.init( "a.b", gt.release() ).isOK() );
@@ -254,7 +254,7 @@ namespace mongo {
TEST( ElemMatchValueMatchExpression, ElemMatchKey ) {
BSONObj baseOperand = BSON( "$gt" << 6 );
- auto_ptr<ComparisonMatchExpression> gt( new GTMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> gt( new GTMatchExpression() );
ASSERT( gt->init( "", baseOperand[ "$gt" ] ).isOK() );
ElemMatchValueMatchExpression op;
ASSERT( op.init( "a.b", gt.release() ).isOK() );
@@ -282,7 +282,7 @@ namespace mongo {
/**
TEST( ElemMatchValueMatchExpression, MatchesIndexKey ) {
BSONObj baseOperand = BSON( "$lt" << 5 );
- auto_ptr<LtOp> lt( new ComparisonMatchExpression() );
+ unique_ptr<LtOp> lt( new ComparisonMatchExpression() );
ASSERT( lt->init( "a", baseOperand[ "$lt" ] ).isOK() );
ElemMatchValueMatchExpression op;
ASSERT( op.init( "a", lt.release() ).isOK() );
@@ -297,40 +297,40 @@ namespace mongo {
BSONObj baseOperanda1 = BSON( "a" << 1 );
- auto_ptr<ComparisonMatchExpression> eqa1( new EqualityMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> eqa1( new EqualityMatchExpression() );
ASSERT( eqa1->init( "a", baseOperanda1[ "a" ] ).isOK() );
BSONObj baseOperandb1 = BSON( "b" << 1 );
- auto_ptr<ComparisonMatchExpression> eqb1( new EqualityMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> eqb1( new EqualityMatchExpression() );
ASSERT( eqb1->init( "b", baseOperandb1[ "b" ] ).isOK() );
- auto_ptr<AndMatchExpression> and1( new AndMatchExpression() );
+ unique_ptr<AndMatchExpression> and1( new AndMatchExpression() );
and1->add( eqa1.release() );
and1->add( eqb1.release() );
// and1 = { a : 1, b : 1 }
- auto_ptr<ElemMatchObjectMatchExpression> elemMatch1( new ElemMatchObjectMatchExpression() );
+ unique_ptr<ElemMatchObjectMatchExpression> elemMatch1( new ElemMatchObjectMatchExpression() );
elemMatch1->init( "x", and1.release() );
// elemMatch1 = { x : { $elemMatch : { a : 1, b : 1 } } }
BSONObj baseOperanda2 = BSON( "a" << 2 );
- auto_ptr<ComparisonMatchExpression> eqa2( new EqualityMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> eqa2( new EqualityMatchExpression() );
ASSERT( eqa2->init( "a", baseOperanda2[ "a" ] ).isOK() );
BSONObj baseOperandb2 = BSON( "b" << 2 );
- auto_ptr<ComparisonMatchExpression> eqb2( new EqualityMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> eqb2( new EqualityMatchExpression() );
ASSERT( eqb2->init( "b", baseOperandb2[ "b" ] ).isOK() );
- auto_ptr<AndMatchExpression> and2( new AndMatchExpression() );
+ unique_ptr<AndMatchExpression> and2( new AndMatchExpression() );
and2->add( eqa2.release() );
and2->add( eqb2.release() );
// and2 = { a : 2, b : 2 }
- auto_ptr<ElemMatchObjectMatchExpression> elemMatch2( new ElemMatchObjectMatchExpression() );
+ unique_ptr<ElemMatchObjectMatchExpression> elemMatch2( new ElemMatchObjectMatchExpression() );
elemMatch2->init( "x", and2.release() );
// elemMatch2 = { x : { $elemMatch : { a : 2, b : 2 } } }
- auto_ptr<AndMatchExpression> andOfEM( new AndMatchExpression() );
+ unique_ptr<AndMatchExpression> andOfEM( new AndMatchExpression() );
andOfEM->add( elemMatch1.release() );
andOfEM->add( elemMatch2.release() );
@@ -354,34 +354,34 @@ namespace mongo {
TEST( AndOfElemMatch, Matches ) {
BSONObj baseOperandgt1 = BSON( "$gt" << 1 );
- auto_ptr<ComparisonMatchExpression> gt1( new GTMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> gt1( new GTMatchExpression() );
ASSERT( gt1->init( "", baseOperandgt1[ "$gt" ] ).isOK() );
BSONObj baseOperandlt1 = BSON( "$lt" << 10 );
- auto_ptr<ComparisonMatchExpression> lt1( new LTMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> lt1( new LTMatchExpression() );
ASSERT( lt1->init( "", baseOperandlt1[ "$lt" ] ).isOK() );
- auto_ptr<ElemMatchValueMatchExpression> elemMatch1( new ElemMatchValueMatchExpression() );
+ unique_ptr<ElemMatchValueMatchExpression> elemMatch1( new ElemMatchValueMatchExpression() );
elemMatch1->init( "x" );
elemMatch1->add( gt1.release() );
elemMatch1->add( lt1.release() );
// elemMatch1 = { x : { $elemMatch : { $gt : 1 , $lt : 10 } } }
BSONObj baseOperandgt2 = BSON( "$gt" << 101 );
- auto_ptr<ComparisonMatchExpression> gt2( new GTMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> gt2( new GTMatchExpression() );
ASSERT( gt2->init( "", baseOperandgt2[ "$gt" ] ).isOK() );
BSONObj baseOperandlt2 = BSON( "$lt" << 110 );
- auto_ptr<ComparisonMatchExpression> lt2( new LTMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> lt2( new LTMatchExpression() );
ASSERT( lt2->init( "", baseOperandlt2[ "$lt" ] ).isOK() );
- auto_ptr<ElemMatchValueMatchExpression> elemMatch2( new ElemMatchValueMatchExpression() );
+ unique_ptr<ElemMatchValueMatchExpression> elemMatch2( new ElemMatchValueMatchExpression() );
elemMatch2->init( "x" );
elemMatch2->add( gt2.release() );
elemMatch2->add( lt2.release() );
// elemMatch2 = { x : { $elemMatch : { $gt : 101 , $lt : 110 } } }
- auto_ptr<AndMatchExpression> andOfEM( new AndMatchExpression() );
+ unique_ptr<AndMatchExpression> andOfEM( new AndMatchExpression() );
andOfEM->add( elemMatch1.release() );
andOfEM->add( elemMatch2.release() );
diff --git a/src/mongo/db/matcher/expression_parser.cpp b/src/mongo/db/matcher/expression_parser.cpp
index 3564d71a907..b2977e34117 100644
--- a/src/mongo/db/matcher/expression_parser.cpp
+++ b/src/mongo/db/matcher/expression_parser.cpp
@@ -67,7 +67,7 @@ namespace mongo {
StatusWithMatchExpression MatchExpressionParser::_parseComparison( const char* name,
ComparisonMatchExpression* cmp,
const BSONElement& e ) {
- std::auto_ptr<ComparisonMatchExpression> temp(cmp);
+ std::unique_ptr<ComparisonMatchExpression> temp(cmp);
// Non-equality comparison match expressions cannot have
// a regular expression as the argument (e.g. {a: {$gt: /b/}} is illegal).
@@ -129,7 +129,7 @@ namespace mongo {
StatusWithMatchExpression s = _parseComparison( name, new EqualityMatchExpression(), e );
if ( !s.isOK() )
return s;
- std::auto_ptr<NotMatchExpression> n( new NotMatchExpression() );
+ std::unique_ptr<NotMatchExpression> n( new NotMatchExpression() );
Status s2 = n->init( s.getValue() );
if ( !s2.isOK() )
return StatusWithMatchExpression( s2 );
@@ -141,7 +141,7 @@ namespace mongo {
case BSONObj::opIN: {
if ( e.type() != Array )
return StatusWithMatchExpression( ErrorCodes::BadValue, "$in needs an array" );
- std::auto_ptr<InMatchExpression> temp( new InMatchExpression() );
+ std::unique_ptr<InMatchExpression> temp( new InMatchExpression() );
Status s = temp->init( name );
if ( !s.isOK() )
return StatusWithMatchExpression( s );
@@ -154,7 +154,7 @@ namespace mongo {
case BSONObj::NIN: {
if ( e.type() != Array )
return StatusWithMatchExpression( ErrorCodes::BadValue, "$nin needs an array" );
- std::auto_ptr<InMatchExpression> temp( new InMatchExpression() );
+ std::unique_ptr<InMatchExpression> temp( new InMatchExpression() );
Status s = temp->init( name );
if ( !s.isOK() )
return StatusWithMatchExpression( s );
@@ -162,7 +162,7 @@ namespace mongo {
if ( !s.isOK() )
return StatusWithMatchExpression( s );
- std::auto_ptr<NotMatchExpression> temp2( new NotMatchExpression() );
+ std::unique_ptr<NotMatchExpression> temp2( new NotMatchExpression() );
s = temp2->init( temp.release() );
if ( !s.isOK() )
return StatusWithMatchExpression( s );
@@ -200,7 +200,7 @@ namespace mongo {
return StatusWithMatchExpression( ErrorCodes::BadValue, "$size needs a number" );
}
- std::auto_ptr<SizeMatchExpression> temp( new SizeMatchExpression() );
+ std::unique_ptr<SizeMatchExpression> temp( new SizeMatchExpression() );
Status s = temp->init( name, size );
if ( !s.isOK() )
return StatusWithMatchExpression( s );
@@ -210,13 +210,13 @@ namespace mongo {
case BSONObj::opEXISTS: {
if ( e.eoo() )
return StatusWithMatchExpression( ErrorCodes::BadValue, "$exists can't be eoo" );
- std::auto_ptr<ExistsMatchExpression> temp( new ExistsMatchExpression() );
+ std::unique_ptr<ExistsMatchExpression> temp( new ExistsMatchExpression() );
Status s = temp->init( name );
if ( !s.isOK() )
return StatusWithMatchExpression( s );
if ( e.trueValue() )
return StatusWithMatchExpression( temp.release() );
- std::auto_ptr<NotMatchExpression> temp2( new NotMatchExpression() );
+ std::unique_ptr<NotMatchExpression> temp2( new NotMatchExpression() );
s = temp2->init( temp.release() );
if ( !s.isOK() )
return StatusWithMatchExpression( s );
@@ -229,7 +229,7 @@ namespace mongo {
int type = e.numberInt();
if ( e.type() != NumberInt && type != e.number() )
type = -1;
- std::auto_ptr<TypeMatchExpression> temp( new TypeMatchExpression() );
+ std::unique_ptr<TypeMatchExpression> temp( new TypeMatchExpression() );
Status s = temp->init( name, type );
if ( !s.isOK() )
return StatusWithMatchExpression( s );
@@ -281,7 +281,7 @@ namespace mongo {
return StatusWithMatchExpression( ErrorCodes::BadValue, ss );
}
- std::auto_ptr<AndMatchExpression> root( new AndMatchExpression() );
+ std::unique_ptr<AndMatchExpression> root( new AndMatchExpression() );
bool topLevel = (level == 0);
level++;
@@ -298,7 +298,7 @@ namespace mongo {
if ( e.type() != Array )
return StatusWithMatchExpression( ErrorCodes::BadValue,
"$or needs an array" );
- std::auto_ptr<OrMatchExpression> temp( new OrMatchExpression() );
+ std::unique_ptr<OrMatchExpression> temp( new OrMatchExpression() );
Status s = _parseTreeList( e.Obj(), temp.get(), level );
if ( !s.isOK() )
return StatusWithMatchExpression( s );
@@ -308,7 +308,7 @@ namespace mongo {
if ( e.type() != Array )
return StatusWithMatchExpression( ErrorCodes::BadValue,
"and needs an array" );
- std::auto_ptr<AndMatchExpression> temp( new AndMatchExpression() );
+ std::unique_ptr<AndMatchExpression> temp( new AndMatchExpression() );
Status s = _parseTreeList( e.Obj(), temp.get(), level );
if ( !s.isOK() )
return StatusWithMatchExpression( s );
@@ -318,7 +318,7 @@ namespace mongo {
if ( e.type() != Array )
return StatusWithMatchExpression( ErrorCodes::BadValue,
"and needs an array" );
- std::auto_ptr<NorMatchExpression> temp( new NorMatchExpression() );
+ std::unique_ptr<NorMatchExpression> temp( new NorMatchExpression() );
Status s = _parseTreeList( e.Obj(), temp.get(), level );
if ( !s.isOK() )
return StatusWithMatchExpression( s );
@@ -355,7 +355,7 @@ namespace mongo {
mongoutils::str::equals( "id", rest ) ||
mongoutils::str::equals( "db", rest ) ) {
// DBRef fields.
- std::auto_ptr<ComparisonMatchExpression> eq( new EqualityMatchExpression() );
+ std::unique_ptr<ComparisonMatchExpression> eq( new EqualityMatchExpression() );
Status s = eq->init( e.fieldName(), e );
if ( !s.isOK() )
return StatusWithMatchExpression( s );
@@ -387,7 +387,7 @@ namespace mongo {
continue;
}
- std::auto_ptr<ComparisonMatchExpression> eq( new EqualityMatchExpression() );
+ std::unique_ptr<ComparisonMatchExpression> eq( new EqualityMatchExpression() );
Status s = eq->init( e.fieldName(), e );
if ( !s.isOK() )
return StatusWithMatchExpression( s );
@@ -548,7 +548,7 @@ namespace mongo {
if ( i.more() )
return StatusWithMatchExpression( ErrorCodes::BadValue, "malformed mod, too many elements" );
- std::auto_ptr<ModMatchExpression> temp( new ModMatchExpression() );
+ std::unique_ptr<ModMatchExpression> temp( new ModMatchExpression() );
Status s = temp->init( name, d.numberInt(), r.numberInt() );
if ( !s.isOK() )
return StatusWithMatchExpression( s );
@@ -560,7 +560,7 @@ namespace mongo {
if ( e.type() != RegEx )
return StatusWithMatchExpression( ErrorCodes::BadValue, "not a regex" );
- std::auto_ptr<RegexMatchExpression> temp( new RegexMatchExpression() );
+ std::unique_ptr<RegexMatchExpression> temp( new RegexMatchExpression() );
Status s = temp->init( name, e.regex(), e.regexFlags() );
if ( !s.isOK() )
return StatusWithMatchExpression( s );
@@ -602,7 +602,7 @@ namespace mongo {
}
- std::auto_ptr<RegexMatchExpression> temp( new RegexMatchExpression() );
+ std::unique_ptr<RegexMatchExpression> temp( new RegexMatchExpression() );
Status s = temp->init( name, regex, regexOptions );
if ( !s.isOK() )
return StatusWithMatchExpression( s );
@@ -623,7 +623,7 @@ namespace mongo {
}
if ( e.type() == RegEx ) {
- std::auto_ptr<RegexMatchExpression> r( new RegexMatchExpression() );
+ std::unique_ptr<RegexMatchExpression> r( new RegexMatchExpression() );
Status s = r->init( "", e );
if ( !s.isOK() )
return s;
@@ -677,7 +677,7 @@ namespace mongo {
if ( !s.isOK() )
return StatusWithMatchExpression( s );
- std::auto_ptr<ElemMatchValueMatchExpression> temp( new ElemMatchValueMatchExpression() );
+ std::unique_ptr<ElemMatchValueMatchExpression> temp( new ElemMatchValueMatchExpression() );
s = temp->init( name );
if ( !s.isOK() )
return StatusWithMatchExpression( s );
@@ -699,7 +699,7 @@ namespace mongo {
StatusWithMatchExpression subRaw = _parse( obj, level );
if ( !subRaw.isOK() )
return subRaw;
- std::auto_ptr<MatchExpression> sub( subRaw.getValue() );
+ std::unique_ptr<MatchExpression> sub( subRaw.getValue() );
// $where is not supported under $elemMatch because $where
// applies to top-level document, not array elements in a field.
@@ -708,7 +708,7 @@ namespace mongo {
"$elemMatch cannot contain $where expression" );
}
- std::auto_ptr<ElemMatchObjectMatchExpression> temp( new ElemMatchObjectMatchExpression() );
+ std::unique_ptr<ElemMatchObjectMatchExpression> temp( new ElemMatchObjectMatchExpression() );
Status status = temp->init( name, sub.release() );
if ( !status.isOK() )
return StatusWithMatchExpression( status );
@@ -723,7 +723,7 @@ namespace mongo {
return StatusWithMatchExpression( ErrorCodes::BadValue, "$all needs an array" );
BSONObj arr = e.Obj();
- std::auto_ptr<AndMatchExpression> myAnd( new AndMatchExpression() );
+ std::unique_ptr<AndMatchExpression> myAnd( new AndMatchExpression() );
BSONObjIterator i( arr );
if ( arr.firstElement().type() == Object &&
@@ -762,7 +762,7 @@ namespace mongo {
BSONElement e = i.next();
if ( e.type() == RegEx ) {
- std::auto_ptr<RegexMatchExpression> r( new RegexMatchExpression() );
+ std::unique_ptr<RegexMatchExpression> r( new RegexMatchExpression() );
Status s = r->init( name, e );
if ( !s.isOK() )
return StatusWithMatchExpression( s );
@@ -772,7 +772,7 @@ namespace mongo {
return StatusWithMatchExpression( ErrorCodes::BadValue, "no $ expressions in $all" );
}
else {
- std::auto_ptr<EqualityMatchExpression> x( new EqualityMatchExpression() );
+ std::unique_ptr<EqualityMatchExpression> x( new EqualityMatchExpression() );
Status s = x->init( name, e );
if ( !s.isOK() )
return StatusWithMatchExpression( s );
diff --git a/src/mongo/db/matcher/expression_parser_geo.cpp b/src/mongo/db/matcher/expression_parser_geo.cpp
index 72145c029b1..837d61b448c 100644
--- a/src/mongo/db/matcher/expression_parser_geo.cpp
+++ b/src/mongo/db/matcher/expression_parser_geo.cpp
@@ -37,18 +37,18 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
StatusWithMatchExpression expressionParserGeoCallbackReal( const char* name,
int type,
const BSONObj& section ) {
if (BSONObj::opWITHIN == type || BSONObj::opGEO_INTERSECTS == type) {
- auto_ptr<GeoExpression> gq(new GeoExpression(name));
+ unique_ptr<GeoExpression> gq(new GeoExpression(name));
Status parseStatus = gq->parseFrom(section);
if (!parseStatus.isOK()) return StatusWithMatchExpression(parseStatus);
- auto_ptr<GeoMatchExpression> e( new GeoMatchExpression() );
+ unique_ptr<GeoMatchExpression> e( new GeoMatchExpression() );
// Until the index layer accepts non-BSON predicates, or special indices are moved into
// stages, we have to clean up the raw object so it can be passed down to the index
@@ -62,12 +62,12 @@ namespace mongo {
}
else {
verify(BSONObj::opNEAR == type);
- auto_ptr<GeoNearExpression> nq(new GeoNearExpression(name));
+ unique_ptr<GeoNearExpression> nq(new GeoNearExpression(name));
Status s = nq->parseFrom( section );
if ( !s.isOK() ) {
return StatusWithMatchExpression( s );
}
- auto_ptr<GeoNearMatchExpression> e( new GeoNearMatchExpression() );
+ unique_ptr<GeoNearMatchExpression> e( new GeoNearMatchExpression() );
// Until the index layer accepts non-BSON predicates, or special indices are moved into
// stages, we have to clean up the raw object so it can be passed down to the index
// layer.
diff --git a/src/mongo/db/matcher/expression_parser_text.cpp b/src/mongo/db/matcher/expression_parser_text.cpp
index 0a7cb0b01ab..f8b40a1823b 100644
--- a/src/mongo/db/matcher/expression_parser_text.cpp
+++ b/src/mongo/db/matcher/expression_parser_text.cpp
@@ -37,7 +37,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
StatusWithMatchExpression expressionParserTextCallbackReal( const BSONObj& queryObj ) {
@@ -84,7 +84,7 @@ namespace mongo {
return StatusWithMatchExpression( ErrorCodes::BadValue, "extra fields in $text" );
}
- auto_ptr<TextMatchExpression> e( new TextMatchExpression() );
+ unique_ptr<TextMatchExpression> e( new TextMatchExpression() );
Status s = e->init( query, language, caseSensitive );
if ( !s.isOK() ) {
return StatusWithMatchExpression( s );
diff --git a/src/mongo/db/matcher/expression_parser_tree.cpp b/src/mongo/db/matcher/expression_parser_tree.cpp
index 8e2582e52e0..7c5359e6318 100644
--- a/src/mongo/db/matcher/expression_parser_tree.cpp
+++ b/src/mongo/db/matcher/expression_parser_tree.cpp
@@ -73,7 +73,7 @@ namespace mongo {
StatusWithMatchExpression s = _parseRegexElement( name, e );
if ( !s.isOK() )
return s;
- std::auto_ptr<NotMatchExpression> n( new NotMatchExpression() );
+ std::unique_ptr<NotMatchExpression> n( new NotMatchExpression() );
Status s2 = n->init( s.getValue() );
if ( !s2.isOK() )
return StatusWithMatchExpression( s2 );
@@ -87,7 +87,7 @@ namespace mongo {
if ( notObject.isEmpty() )
return StatusWithMatchExpression( ErrorCodes::BadValue, "$not cannot be empty" );
- std::auto_ptr<AndMatchExpression> theAnd( new AndMatchExpression() );
+ std::unique_ptr<AndMatchExpression> theAnd( new AndMatchExpression() );
Status s = _parseSub( name, notObject, theAnd.get(), level );
if ( !s.isOK() )
return StatusWithMatchExpression( s );
@@ -98,7 +98,7 @@ namespace mongo {
if ( theAnd->getChild(i)->matchType() == MatchExpression::REGEX )
return StatusWithMatchExpression( ErrorCodes::BadValue, "$not cannot have a regex" );
- std::auto_ptr<NotMatchExpression> theNot( new NotMatchExpression() );
+ std::unique_ptr<NotMatchExpression> theNot( new NotMatchExpression() );
s = theNot->init( theAnd.release() );
if ( !s.isOK() )
return StatusWithMatchExpression( s );
diff --git a/src/mongo/db/matcher/expression_tree.h b/src/mongo/db/matcher/expression_tree.h
index b0caebd1e71..b6441e70f57 100644
--- a/src/mongo/db/matcher/expression_tree.h
+++ b/src/mongo/db/matcher/expression_tree.h
@@ -190,7 +190,7 @@ namespace mongo {
void resetChild( MatchExpression* newChild) { _exp.reset(newChild); }
private:
- std::auto_ptr<MatchExpression> _exp;
+ std::unique_ptr<MatchExpression> _exp;
};
}
diff --git a/src/mongo/db/matcher/expression_tree_test.cpp b/src/mongo/db/matcher/expression_tree_test.cpp
index 27516ff4344..72e9766404a 100644
--- a/src/mongo/db/matcher/expression_tree_test.cpp
+++ b/src/mongo/db/matcher/expression_tree_test.cpp
@@ -38,11 +38,11 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
TEST( NotMatchExpression, MatchesScalar ) {
BSONObj baseOperand = BSON( "$lt" << 5 );
- auto_ptr<ComparisonMatchExpression> lt( new LTMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> lt( new LTMatchExpression() );
ASSERT( lt->init( "a", baseOperand[ "$lt" ] ).isOK() );
NotMatchExpression notOp;
ASSERT( notOp.init( lt.release() ).isOK() );
@@ -52,7 +52,7 @@ namespace mongo {
TEST( NotMatchExpression, MatchesArray ) {
BSONObj baseOperand = BSON( "$lt" << 5 );
- auto_ptr<ComparisonMatchExpression> lt( new LTMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> lt( new LTMatchExpression() );
ASSERT( lt->init( "a", baseOperand[ "$lt" ] ).isOK() );
NotMatchExpression notOp;
ASSERT( notOp.init( lt.release() ).isOK() );
@@ -64,7 +64,7 @@ namespace mongo {
TEST( NotMatchExpression, ElemMatchKey ) {
BSONObj baseOperand = BSON( "$lt" << 5 );
- auto_ptr<ComparisonMatchExpression> lt( new LTMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> lt( new LTMatchExpression() );
ASSERT( lt->init( "a", baseOperand[ "$lt" ] ).isOK() );
NotMatchExpression notOp;
ASSERT( notOp.init( lt.release() ).isOK() );
@@ -81,7 +81,7 @@ namespace mongo {
/*
TEST( NotMatchExpression, MatchesIndexKey ) {
BSONObj baseOperand = BSON( "$lt" << 5 );
- auto_ptr<ComparisonMatchExpression> lt( new ComparisonMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> lt( new ComparisonMatchExpression() );
ASSERT( lt->init( "a", baseOperand[ "$lt" ] ).isOK() );
NotMatchExpression notOp;
ASSERT( notOp.init( lt.release() ).isOK() );
@@ -97,7 +97,7 @@ namespace mongo {
BSONObj baseOperand = BSON( "$lt" << 5 );
BSONObj match = BSON( "a" << 4 );
BSONObj notMatch = BSON( "a" << 5 );
- auto_ptr<ComparisonMatchExpression> lt( new ComparisonMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> lt( new ComparisonMatchExpression() );
ASSERT( lt->init( "", baseOperand[ "$lt" ] ).isOK() );
OwnedPointerVector<MatchMatchExpression> subMatchExpressions;
subMatchExpressions.mutableVector().push_back( lt.release() );
@@ -121,11 +121,11 @@ namespace mongo {
BSONObj notMatch2 = BSON( "a" << "a1" );
BSONObj notMatch3 = BSON( "a" << "r" );
- auto_ptr<ComparisonMatchExpression> sub1( new LTMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> sub1( new LTMatchExpression() );
ASSERT( sub1->init( "a", baseOperand1[ "$lt" ] ).isOK() );
- auto_ptr<ComparisonMatchExpression> sub2( new GTMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> sub2( new GTMatchExpression() );
ASSERT( sub2->init( "a", baseOperand2[ "$gt" ] ).isOK() );
- auto_ptr<RegexMatchExpression> sub3( new RegexMatchExpression() );
+ unique_ptr<RegexMatchExpression> sub3( new RegexMatchExpression() );
ASSERT( sub3->init( "a", "1", "" ).isOK() );
AndMatchExpression andOp;
@@ -141,9 +141,9 @@ namespace mongo {
TEST( AndOp, MatchesSingleClause ) {
BSONObj baseOperand = BSON( "$ne" << 5 );
- auto_ptr<ComparisonMatchExpression> eq( new EqualityMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> eq( new EqualityMatchExpression() );
ASSERT( eq->init( "a", baseOperand[ "$ne" ] ).isOK() );
- auto_ptr<NotMatchExpression> ne( new NotMatchExpression() );
+ unique_ptr<NotMatchExpression> ne( new NotMatchExpression() );
ASSERT( ne->init( eq.release() ).isOK() );
AndMatchExpression andOp;
@@ -160,13 +160,13 @@ namespace mongo {
BSONObj baseOperand2 = BSON( "$lt" << 10 );
BSONObj baseOperand3 = BSON( "$lt" << 100 );
- auto_ptr<ComparisonMatchExpression> sub1( new GTMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> sub1( new GTMatchExpression() );
ASSERT( sub1->init( "a", baseOperand1[ "$gt" ] ).isOK() );
- auto_ptr<ComparisonMatchExpression> sub2( new LTMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> sub2( new LTMatchExpression() );
ASSERT( sub2->init( "a", baseOperand2[ "$lt" ] ).isOK() );
- auto_ptr<ComparisonMatchExpression> sub3( new LTMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> sub3( new LTMatchExpression() );
ASSERT( sub3->init( "b", baseOperand3[ "$lt" ] ).isOK() );
AndMatchExpression andOp;
@@ -185,10 +185,10 @@ namespace mongo {
BSONObj baseOperand1 = BSON( "a" << 1 );
BSONObj baseOperand2 = BSON( "b" << 2 );
- auto_ptr<ComparisonMatchExpression> sub1( new EqualityMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> sub1( new EqualityMatchExpression() );
ASSERT( sub1->init( "a", baseOperand1[ "a" ] ).isOK() );
- auto_ptr<ComparisonMatchExpression> sub2( new EqualityMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> sub2( new EqualityMatchExpression() );
ASSERT( sub2->init( "b", baseOperand2[ "b" ] ).isOK() );
AndMatchExpression andOp;
@@ -212,9 +212,9 @@ namespace mongo {
TEST( AndOp, MatchesIndexKeyWithoutUnknown ) {
BSONObj baseOperand1 = BSON( "$gt" << 1 );
BSONObj baseOperand2 = BSON( "$lt" << 5 );
- auto_ptr<ComparisonMatchExpression> sub1( new ComparisonMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> sub1( new ComparisonMatchExpression() );
ASSERT( sub1->init( "a", baseOperand1[ "$gt" ] ).isOK() );
- auto_ptr<ComparisonMatchExpression> sub2( new ComparisonMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> sub2( new ComparisonMatchExpression() );
ASSERT( sub2->init( "a", baseOperand2[ "$lt" ] ).isOK() );
OwnedPointerVector<MatchMatchExpression> subMatchExpressions;
subMatchExpressions.mutableVector().push_back( sub1.release() );
@@ -235,11 +235,11 @@ namespace mongo {
BSONObj baseOperand2 = BSON( "$lt" << 5 );
// This part will return PartialMatchResult_Unknown.
BSONObj baseOperand3 = BSON( "$ne" << 5 );
- auto_ptr<ComparisonMatchExpression> sub1( new ComparisonMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> sub1( new ComparisonMatchExpression() );
ASSERT( sub1->init( "a", baseOperand1[ "$gt" ] ).isOK() );
- auto_ptr<ComparisonMatchExpression> sub2( new ComparisonMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> sub2( new ComparisonMatchExpression() );
ASSERT( sub2->init( "a", baseOperand2[ "$lt" ] ).isOK() );
- auto_ptr<NeOp> sub3( new NeOp() );
+ unique_ptr<NeOp> sub3( new NeOp() );
ASSERT( sub3->init( "a", baseOperand3[ "$ne" ] ).isOK() );
OwnedPointerVector<MatchMatchExpression> subMatchExpressions;
subMatchExpressions.mutableVector().push_back( sub1.release() );
@@ -262,7 +262,7 @@ namespace mongo {
BSONObj baseOperand = BSON( "$lt" << 5 );
BSONObj match = BSON( "a" << 4 );
BSONObj notMatch = BSON( "a" << 5 );
- auto_ptr<ComparisonMatchExpression> lt( new ComparisonMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> lt( new ComparisonMatchExpression() );
ASSERT( lt->init( "a", baseOperand[ "$lt" ] ).isOK() );
OwnedPointerVector<MatchMatchExpression> subMatchExpressions;
subMatchExpressions.mutableVector().push_back( lt.release() );
@@ -286,11 +286,11 @@ namespace mongo {
BSONObj match2 = BSON( "a" << 11 );
BSONObj match3 = BSON( "a" << 5 );
BSONObj notMatch = BSON( "a" << "6" );
- auto_ptr<ComparisonMatchExpression> sub1( new ComparisonMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> sub1( new ComparisonMatchExpression() );
ASSERT( sub1->init( "a", baseOperand1[ "$lt" ] ).isOK() );
- auto_ptr<ComparisonMatchExpression> sub2( new ComparisonMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> sub2( new ComparisonMatchExpression() );
ASSERT( sub2->init( "a", baseOperand2[ "$gt" ] ).isOK() );
- auto_ptr<ComparisonMatchExpression> sub3( new ComparisonMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> sub3( new ComparisonMatchExpression() );
ASSERT( sub3->init( "a", baseOperand3[ "a" ] ).isOK() );
OwnedPointerVector<MatchMatchExpression> subMatchExpressions;
subMatchExpressions.mutableVector().push_back( sub1.release() );
@@ -306,9 +306,9 @@ namespace mongo {
*/
TEST( OrOp, MatchesSingleClause ) {
BSONObj baseOperand = BSON( "$ne" << 5 );
- auto_ptr<ComparisonMatchExpression> eq( new EqualityMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> eq( new EqualityMatchExpression() );
ASSERT( eq->init( "a", baseOperand[ "$ne" ] ).isOK() );
- auto_ptr<NotMatchExpression> ne( new NotMatchExpression() );
+ unique_ptr<NotMatchExpression> ne( new NotMatchExpression() );
ASSERT( ne->init( eq.release() ).isOK() );
OrMatchExpression orOp;
@@ -324,11 +324,11 @@ namespace mongo {
BSONObj baseOperand1 = BSON( "$gt" << 10 );
BSONObj baseOperand2 = BSON( "$lt" << 0 );
BSONObj baseOperand3 = BSON( "b" << 100 );
- auto_ptr<ComparisonMatchExpression> sub1( new GTMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> sub1( new GTMatchExpression() );
ASSERT( sub1->init( "a", baseOperand1[ "$gt" ] ).isOK() );
- auto_ptr<ComparisonMatchExpression> sub2( new LTMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> sub2( new LTMatchExpression() );
ASSERT( sub2->init( "a", baseOperand2[ "$lt" ] ).isOK() );
- auto_ptr<ComparisonMatchExpression> sub3( new EqualityMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> sub3( new EqualityMatchExpression() );
ASSERT( sub3->init( "b", baseOperand3[ "b" ] ).isOK() );
OrMatchExpression orOp;
@@ -348,9 +348,9 @@ namespace mongo {
TEST( OrOp, ElemMatchKey ) {
BSONObj baseOperand1 = BSON( "a" << 1 );
BSONObj baseOperand2 = BSON( "b" << 2 );
- auto_ptr<ComparisonMatchExpression> sub1( new EqualityMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> sub1( new EqualityMatchExpression() );
ASSERT( sub1->init( "a", baseOperand1[ "a" ] ).isOK() );
- auto_ptr<ComparisonMatchExpression> sub2( new EqualityMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> sub2( new EqualityMatchExpression() );
ASSERT( sub2->init( "b", baseOperand2[ "b" ] ).isOK() );
OrMatchExpression orOp;
@@ -374,9 +374,9 @@ namespace mongo {
TEST( OrOp, MatchesIndexKeyWithoutUnknown ) {
BSONObj baseOperand1 = BSON( "$gt" << 5 );
BSONObj baseOperand2 = BSON( "$lt" << 1 );
- auto_ptr<ComparisonMatchExpression> sub1( new ComparisonMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> sub1( new ComparisonMatchExpression() );
ASSERT( sub1->init( "a", baseOperand1[ "$gt" ] ).isOK() );
- auto_ptr<ComparisonMatchExpression> sub2( new ComparisonMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> sub2( new ComparisonMatchExpression() );
ASSERT( sub2->init( "a", baseOperand2[ "$lt" ] ).isOK() );
OwnedPointerVector<MatchMatchExpression> subMatchExpressions;
subMatchExpressions.mutableVector().push_back( sub1.release() );
@@ -397,11 +397,11 @@ namespace mongo {
BSONObj baseOperand2 = BSON( "$lt" << 1 );
// This part will return PartialMatchResult_Unknown.
BSONObj baseOperand3 = BSON( "$ne" << 5 );
- auto_ptr<ComparisonMatchExpression> sub1( new ComparisonMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> sub1( new ComparisonMatchExpression() );
ASSERT( sub1->init( "a", baseOperand1[ "$gt" ] ).isOK() );
- auto_ptr<ComparisonMatchExpression> sub2( new ComparisonMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> sub2( new ComparisonMatchExpression() );
ASSERT( sub2->init( "a", baseOperand2[ "$lt" ] ).isOK() );
- auto_ptr<NeOp> sub3( new NeOp() );
+ unique_ptr<NeOp> sub3( new NeOp() );
ASSERT( sub3->init( "a", baseOperand3[ "$ne" ] ).isOK() );
OwnedPointerVector<MatchMatchExpression> subMatchExpressions;
subMatchExpressions.mutableVector().push_back( sub1.release() );
@@ -424,7 +424,7 @@ namespace mongo {
BSONObj baseOperand = BSON( "$lt" << 5 );
BSONObj match = BSON( "a" << 5 );
BSONObj notMatch = BSON( "a" << 4 );
- auto_ptr<ComparisonMatchExpression> lt( new ComparisonMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> lt( new ComparisonMatchExpression() );
ASSERT( lt->init( "a", baseOperand[ "$lt" ] ).isOK() );
OwnedPointerVector<MatchMatchExpression> subMatchExpressions;
subMatchExpressions.mutableVector().push_back( lt.release() );
@@ -448,11 +448,11 @@ namespace mongo {
BSONObj notMatch2 = BSON( "a" << 11 );
BSONObj notMatch3 = BSON( "a" << 5 );
BSONObj match = BSON( "a" << "6" );
- auto_ptr<ComparisonMatchExpression> sub1( new ComparisonMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> sub1( new ComparisonMatchExpression() );
ASSERT( sub1->init( "a", baseOperand1[ "$lt" ] ).isOK() );
- auto_ptr<ComparisonMatchExpression> sub2( new ComparisonMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> sub2( new ComparisonMatchExpression() );
ASSERT( sub2->init( "a", baseOperand2[ "$gt" ] ).isOK() );
- auto_ptr<ComparisonMatchExpression> sub3( new ComparisonMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> sub3( new ComparisonMatchExpression() );
ASSERT( sub3->init( "a", baseOperand3[ "a" ] ).isOK() );
OwnedPointerVector<MatchMatchExpression> subMatchExpressions;
subMatchExpressions.mutableVector().push_back( sub1.release() );
@@ -469,9 +469,9 @@ namespace mongo {
TEST( NorOp, MatchesSingleClause ) {
BSONObj baseOperand = BSON( "$ne" << 5 );
- auto_ptr<ComparisonMatchExpression> eq( new EqualityMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> eq( new EqualityMatchExpression() );
ASSERT( eq->init( "a", baseOperand[ "$ne" ] ).isOK() );
- auto_ptr<NotMatchExpression> ne( new NotMatchExpression() );
+ unique_ptr<NotMatchExpression> ne( new NotMatchExpression() );
ASSERT( ne->init( eq.release() ).isOK() );
NorMatchExpression norOp;
@@ -488,11 +488,11 @@ namespace mongo {
BSONObj baseOperand2 = BSON( "$lt" << 0 );
BSONObj baseOperand3 = BSON( "b" << 100 );
- auto_ptr<ComparisonMatchExpression> sub1( new GTMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> sub1( new GTMatchExpression() );
ASSERT( sub1->init( "a", baseOperand1[ "$gt" ] ).isOK() );
- auto_ptr<ComparisonMatchExpression> sub2( new LTMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> sub2( new LTMatchExpression() );
ASSERT( sub2->init( "a", baseOperand2[ "$lt" ] ).isOK() );
- auto_ptr<ComparisonMatchExpression> sub3( new EqualityMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> sub3( new EqualityMatchExpression() );
ASSERT( sub3->init( "b", baseOperand3[ "b" ] ).isOK() );
NorMatchExpression norOp;
@@ -512,9 +512,9 @@ namespace mongo {
TEST( NorOp, ElemMatchKey ) {
BSONObj baseOperand1 = BSON( "a" << 1 );
BSONObj baseOperand2 = BSON( "b" << 2 );
- auto_ptr<ComparisonMatchExpression> sub1( new EqualityMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> sub1( new EqualityMatchExpression() );
ASSERT( sub1->init( "a", baseOperand1[ "a" ] ).isOK() );
- auto_ptr<ComparisonMatchExpression> sub2( new EqualityMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> sub2( new EqualityMatchExpression() );
ASSERT( sub2->init( "b", baseOperand2[ "b" ] ).isOK() );
NorMatchExpression norOp;
@@ -557,7 +557,7 @@ namespace mongo {
/**
TEST( NorOp, MatchesIndexKey ) {
BSONObj baseOperand = BSON( "a" << 5 );
- auto_ptr<ComparisonMatchExpression> eq( new ComparisonMatchExpression() );
+ unique_ptr<ComparisonMatchExpression> eq( new ComparisonMatchExpression() );
ASSERT( eq->init( "a", baseOperand[ "a" ] ).isOK() );
OwnedPointerVector<MatchMatchExpression> subMatchExpressions;
subMatchExpressions.mutableVector().push_back( eq.release() );
diff --git a/src/mongo/db/matcher/expression_where.cpp b/src/mongo/db/matcher/expression_where.cpp
index c2e95e2dd50..290b2bc3071 100644
--- a/src/mongo/db/matcher/expression_where.cpp
+++ b/src/mongo/db/matcher/expression_where.cpp
@@ -42,7 +42,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::string;
using std::stringstream;
@@ -91,7 +91,7 @@ namespace mongo {
string _code;
BSONObj _userScope;
- auto_ptr<Scope> _scope;
+ unique_ptr<Scope> _scope;
ScriptingFunction _func;
// Not owned. See comments insde WhereCallbackReal for the lifetime of this pointer.
@@ -191,7 +191,7 @@ namespace mongo {
return StatusWithMatchExpression(ErrorCodes::BadValue,
"no globalScriptEngine in $where parsing");
- auto_ptr<WhereMatchExpression> exp(new WhereMatchExpression(_txn));
+ unique_ptr<WhereMatchExpression> exp(new WhereMatchExpression(_txn));
if (where.type() == String || where.type() == Code) {
Status s = exp->init(_dbName, where.valuestr(), BSONObj());
if (!s.isOK())
diff --git a/src/mongo/db/matcher/expression_where_noop.cpp b/src/mongo/db/matcher/expression_where_noop.cpp
index dfb6a694c28..d7f5a3c74e1 100644
--- a/src/mongo/db/matcher/expression_where_noop.cpp
+++ b/src/mongo/db/matcher/expression_where_noop.cpp
@@ -35,7 +35,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
/**
@@ -118,7 +118,7 @@ namespace mongo {
StatusWithMatchExpression WhereCallbackNoop::parseWhere(const BSONElement& where) const {
- auto_ptr<WhereNoOpMatchExpression> exp( new WhereNoOpMatchExpression() );
+ unique_ptr<WhereNoOpMatchExpression> exp( new WhereNoOpMatchExpression() );
if ( where.type() == String || where.type() == Code ) {
Status s = exp->init( where.valuestr() );
if ( !s.isOK() )
diff --git a/src/mongo/db/operation_context_impl.h b/src/mongo/db/operation_context_impl.h
index 39fbd95e43f..163bff53295 100644
--- a/src/mongo/db/operation_context_impl.h
+++ b/src/mongo/db/operation_context_impl.h
@@ -65,7 +65,7 @@ namespace mongo {
virtual bool writesAreReplicated() const override;
private:
- std::auto_ptr<RecoveryUnit> _recovery;
+ std::unique_ptr<RecoveryUnit> _recovery;
bool _writesAreReplicated;
};
diff --git a/src/mongo/db/operation_context_noop.h b/src/mongo/db/operation_context_noop.h
index 0ee7c2001ca..055c83d690c 100644
--- a/src/mongo/db/operation_context_noop.h
+++ b/src/mongo/db/operation_context_noop.h
@@ -112,7 +112,7 @@ namespace mongo {
}
private:
- std::auto_ptr<RecoveryUnit> _recoveryUnit;
+ std::unique_ptr<RecoveryUnit> _recoveryUnit;
boost::scoped_ptr<Locker> _locker;
ProgressMeter _pm;
};
diff --git a/src/mongo/db/ops/modifier_table_test.cpp b/src/mongo/db/ops/modifier_table_test.cpp
index 23f568b1981..239f9eb5a34 100644
--- a/src/mongo/db/ops/modifier_table_test.cpp
+++ b/src/mongo/db/ops/modifier_table_test.cpp
@@ -38,7 +38,7 @@ namespace {
using namespace mongo::modifiertable;
using mongo::ModifierInterface;
- using std::auto_ptr;
+ using std::unique_ptr;
TEST(getType, Normal) {
ASSERT_EQUALS(getType("$set"), MOD_SET);
@@ -47,7 +47,7 @@ namespace {
}
TEST(makeUpdateMod, Normal) {
- auto_ptr<ModifierInterface> mod;
+ unique_ptr<ModifierInterface> mod;
mod.reset(makeUpdateMod(MOD_SET));
ASSERT_NOT_EQUALS(mod.get(), static_cast<ModifierInterface*>(0));
diff --git a/src/mongo/db/ops/parsed_delete.h b/src/mongo/db/ops/parsed_delete.h
index ad473d35e91..c65f0da69e9 100644
--- a/src/mongo/db/ops/parsed_delete.h
+++ b/src/mongo/db/ops/parsed_delete.h
@@ -111,7 +111,7 @@ namespace mongo {
const DeleteRequest* const _request;
// Parsed query object, or NULL if the query proves to be an id hack query.
- std::auto_ptr<CanonicalQuery> _canonicalQuery;
+ std::unique_ptr<CanonicalQuery> _canonicalQuery;
};
diff --git a/src/mongo/db/ops/parsed_update.h b/src/mongo/db/ops/parsed_update.h
index 98472eba377..d109904d1bd 100644
--- a/src/mongo/db/ops/parsed_update.h
+++ b/src/mongo/db/ops/parsed_update.h
@@ -129,7 +129,7 @@ namespace mongo {
UpdateDriver _driver;
// Parsed query object, or NULL if the query proves to be an id hack query.
- std::auto_ptr<CanonicalQuery> _canonicalQuery;
+ std::unique_ptr<CanonicalQuery> _canonicalQuery;
};
} // namespace mongo
diff --git a/src/mongo/db/ops/path_support_test.cpp b/src/mongo/db/ops/path_support_test.cpp
index 7a93d73c269..a502a39a0c3 100644
--- a/src/mongo/db/ops/path_support_test.cpp
+++ b/src/mongo/db/ops/path_support_test.cpp
@@ -53,7 +53,7 @@ namespace {
using namespace mutablebson;
using namespace pathsupport;
using mongoutils::str::stream;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
class EmptyDoc : public mongo::unittest::Test {
@@ -487,7 +487,7 @@ namespace {
TEST(ExtractEqualities, Basic) {
BSONObj exprBSON = fromjson("{a:1}");
- auto_ptr<MatchExpression> expr(makeExpr(exprBSON));
+ unique_ptr<MatchExpression> expr(makeExpr(exprBSON));
EqualityMatches equalities;
ASSERT_OK(extractEqualityMatches(*expr, &equalities));
@@ -497,7 +497,7 @@ namespace {
TEST(ExtractEqualities, Multiple) {
BSONObj exprBSON = fromjson("{a:1, b:2}");
- auto_ptr<MatchExpression> expr(makeExpr(exprBSON));
+ unique_ptr<MatchExpression> expr(makeExpr(exprBSON));
EqualityMatches equalities;
ASSERT_OK(extractEqualityMatches(*expr, &equalities));
@@ -508,7 +508,7 @@ namespace {
TEST(ExtractEqualities, EqOperator) {
BSONObj exprBSON = fromjson("{a:{$eq:1}}");
- auto_ptr<MatchExpression> expr(makeExpr(exprBSON));
+ unique_ptr<MatchExpression> expr(makeExpr(exprBSON));
EqualityMatches equalities;
ASSERT_OK(extractEqualityMatches(*expr, &equalities));
@@ -518,7 +518,7 @@ namespace {
TEST(ExtractEqualities, AndOperator) {
BSONObj exprBSON = fromjson("{$and:[{a:{$eq:1}},{b:2}]}");
- auto_ptr<MatchExpression> expr(makeExpr(exprBSON));
+ unique_ptr<MatchExpression> expr(makeExpr(exprBSON));
EqualityMatches equalities;
ASSERT_OK(extractEqualityMatches(*expr, &equalities));
@@ -529,7 +529,7 @@ namespace {
TEST(ExtractEqualities, NestedAndOperator) {
BSONObj exprBSON = fromjson("{$and:[{$and:[{a:{$eq:1}},{b:2}]},{c:3}]}");
- auto_ptr<MatchExpression> expr(makeExpr(exprBSON));
+ unique_ptr<MatchExpression> expr(makeExpr(exprBSON));
EqualityMatches equalities;
ASSERT_OK(extractEqualityMatches(*expr, &equalities));
@@ -541,7 +541,7 @@ namespace {
TEST(ExtractEqualities, NestedPaths) {
BSONObj exprBSON = fromjson("{'a.a':1}");
- auto_ptr<MatchExpression> expr(makeExpr(exprBSON));
+ unique_ptr<MatchExpression> expr(makeExpr(exprBSON));
EqualityMatches equalities;
ASSERT_OK(extractEqualityMatches(*expr, &equalities));
@@ -551,7 +551,7 @@ namespace {
TEST(ExtractEqualities, SiblingPaths) {
BSONObj exprBSON = fromjson("{'a.a':1,'a.b':{$eq:2}}");
- auto_ptr<MatchExpression> expr(makeExpr(exprBSON));
+ unique_ptr<MatchExpression> expr(makeExpr(exprBSON));
EqualityMatches equalities;
ASSERT_OK(extractEqualityMatches(*expr, &equalities));
@@ -562,7 +562,7 @@ namespace {
TEST(ExtractEqualities, NestedAndNestedPaths) {
BSONObj exprBSON = fromjson("{$and:[{$and:[{'a.a':{$eq:1}},{'a.b':2}]},{'c.c.c':3}]}");
- auto_ptr<MatchExpression> expr(makeExpr(exprBSON));
+ unique_ptr<MatchExpression> expr(makeExpr(exprBSON));
EqualityMatches equalities;
ASSERT_OK(extractEqualityMatches(*expr, &equalities));
@@ -574,7 +574,7 @@ namespace {
TEST(ExtractEqualities, IdOnly) {
BSONObj exprBSON = fromjson("{_id:1}");
- auto_ptr<MatchExpression> expr(makeExpr(exprBSON));
+ unique_ptr<MatchExpression> expr(makeExpr(exprBSON));
EqualityMatches equalities;
ASSERT_OK(extractEqualityMatches(*expr, &equalities));
@@ -607,7 +607,7 @@ namespace {
TEST(ExtractEqualities, IdOnlyMulti) {
BSONObj exprBSON = fromjson("{_id:{$eq:1},a:1}");
- auto_ptr<MatchExpression> expr(makeExpr(exprBSON));
+ unique_ptr<MatchExpression> expr(makeExpr(exprBSON));
ImmutablePaths immutablePaths;
immutablePaths.addPath("_id");
@@ -620,7 +620,7 @@ namespace {
TEST(ExtractEqualities, IdOnlyIgnoreConflict) {
BSONObj exprBSON = fromjson("{_id:1,a:1,'a.b':1}");
- auto_ptr<MatchExpression> expr(makeExpr(exprBSON));
+ unique_ptr<MatchExpression> expr(makeExpr(exprBSON));
ImmutablePaths immutablePaths;
immutablePaths.addPath("_id");
@@ -633,7 +633,7 @@ namespace {
TEST(ExtractEqualities, IdOnlyNested) {
BSONObj exprBSON = fromjson("{'_id.a':1,'_id.b':{$eq:2},c:3}");
- auto_ptr<MatchExpression> expr(makeExpr(exprBSON));
+ unique_ptr<MatchExpression> expr(makeExpr(exprBSON));
ImmutablePaths immutablePaths;
immutablePaths.addPath("_id");
@@ -645,7 +645,7 @@ namespace {
TEST(ExtractEqualities, IdAndOtherImmutable) {
BSONObj exprBSON = fromjson("{_id:1,a:1,b:2}");
- auto_ptr<MatchExpression> expr(makeExpr(exprBSON));
+ unique_ptr<MatchExpression> expr(makeExpr(exprBSON));
ImmutablePaths immutablePaths;
immutablePaths.addPath("_id");
@@ -660,7 +660,7 @@ namespace {
TEST(ExtractEqualities, IdAndNestedImmutable) {
BSONObj exprBSON = fromjson("{_id:1,a:1,'c.d':3}");
- auto_ptr<MatchExpression> expr(makeExpr(exprBSON));
+ unique_ptr<MatchExpression> expr(makeExpr(exprBSON));
ImmutablePaths immutablePaths;
immutablePaths.addPath("_id");
@@ -677,7 +677,7 @@ namespace {
TEST(ExtractEqualities, NonFullImmutable) {
BSONObj exprBSON = fromjson("{'a.b':1}");
- auto_ptr<MatchExpression> expr(makeExpr(exprBSON));
+ unique_ptr<MatchExpression> expr(makeExpr(exprBSON));
ImmutablePaths immutablePaths;
immutablePaths.addPath("a");
@@ -689,7 +689,7 @@ namespace {
TEST(ExtractEqualities, Empty) {
BSONObj exprBSON = fromjson("{'':0}");
- auto_ptr<MatchExpression> expr(makeExpr(exprBSON));
+ unique_ptr<MatchExpression> expr(makeExpr(exprBSON));
EqualityMatches equalities;
ASSERT_OK(extractEqualityMatches(*expr, &equalities));
@@ -699,7 +699,7 @@ namespace {
TEST(ExtractEqualities, EmptyMulti) {
BSONObj exprBSON = fromjson("{'':0,a:{$eq:1}}");
- auto_ptr<MatchExpression> expr(makeExpr(exprBSON));
+ unique_ptr<MatchExpression> expr(makeExpr(exprBSON));
EqualityMatches equalities;
ASSERT_OK(extractEqualityMatches(*expr, &equalities));
@@ -710,7 +710,7 @@ namespace {
TEST(ExtractEqualities, EqConflict) {
BSONObj exprBSON = fromjson("{a:1,a:1}");
- auto_ptr<MatchExpression> expr(makeExpr(exprBSON));
+ unique_ptr<MatchExpression> expr(makeExpr(exprBSON));
EqualityMatches equalities;
ASSERT_EQUALS(extractEqualityMatches(*expr, &equalities).code(),
@@ -719,7 +719,7 @@ namespace {
TEST(ExtractEqualities, PrefixConflict) {
BSONObj exprBSON = fromjson("{a:1,'a.b':{$eq:1}}");
- auto_ptr<MatchExpression> expr(makeExpr(exprBSON));
+ unique_ptr<MatchExpression> expr(makeExpr(exprBSON));
EqualityMatches equalities;
ASSERT_EQUALS(extractEqualityMatches(*expr, &equalities).code(),
@@ -728,7 +728,7 @@ namespace {
TEST(ExtractEqualities, AndPrefixConflict) {
BSONObj exprBSON = fromjson("{$and:[{a:1},{'a.b':{$eq:1}}]}");
- auto_ptr<MatchExpression> expr(makeExpr(exprBSON));
+ unique_ptr<MatchExpression> expr(makeExpr(exprBSON));
EqualityMatches equalities;
ASSERT_EQUALS(extractEqualityMatches(*expr, &equalities).code(),
@@ -737,7 +737,7 @@ namespace {
TEST(ExtractEqualities, EmptyConflict) {
BSONObj exprBSON = fromjson("{'':0,'':{$eq:0}}");
- auto_ptr<MatchExpression> expr(makeExpr(exprBSON));
+ unique_ptr<MatchExpression> expr(makeExpr(exprBSON));
EqualityMatches equalities;
ASSERT_EQUALS(extractEqualityMatches(*expr, &equalities).code(),
@@ -803,7 +803,7 @@ namespace {
TEST(FindParentEquality, Basic) {
BSONObj exprBSON = fromjson("{a:1}");
- auto_ptr<MatchExpression> expr(makeExpr(exprBSON));
+ unique_ptr<MatchExpression> expr(makeExpr(exprBSON));
EqualityMatches equalities;
ASSERT_OK(extractEqualityMatches(*expr, &equalities));
@@ -815,7 +815,7 @@ namespace {
TEST(FindParentEquality, Multi) {
BSONObj exprBSON = fromjson("{a:1,b:2}");
- auto_ptr<MatchExpression> expr(makeExpr(exprBSON));
+ unique_ptr<MatchExpression> expr(makeExpr(exprBSON));
EqualityMatches equalities;
ASSERT_OK(extractEqualityMatches(*expr, &equalities));
@@ -829,7 +829,7 @@ namespace {
TEST(FindParentEquality, Nested) {
BSONObj exprBSON = fromjson("{'a.a':1}");
- auto_ptr<MatchExpression> expr(makeExpr(exprBSON));
+ unique_ptr<MatchExpression> expr(makeExpr(exprBSON));
EqualityMatches equalities;
ASSERT_OK(extractEqualityMatches(*expr, &equalities));
@@ -842,7 +842,7 @@ namespace {
TEST(FindParentEquality, NestedMulti) {
BSONObj exprBSON = fromjson("{'a.a':1,'a.b':2,'c.c':3}");
- auto_ptr<MatchExpression> expr(makeExpr(exprBSON));
+ unique_ptr<MatchExpression> expr(makeExpr(exprBSON));
EqualityMatches equalities;
ASSERT_OK(extractEqualityMatches(*expr, &equalities));
@@ -860,7 +860,7 @@ namespace {
TEST(FindParentEquality, Empty) {
BSONObj exprBSON = fromjson("{'':0}");
- auto_ptr<MatchExpression> expr(makeExpr(exprBSON));
+ unique_ptr<MatchExpression> expr(makeExpr(exprBSON));
EqualityMatches equalities;
ASSERT_OK(extractEqualityMatches(*expr, &equalities));
@@ -870,7 +870,7 @@ namespace {
TEST(FindParentEquality, EmptyMulti) {
BSONObj exprBSON = fromjson("{'':0,a:1}");
- auto_ptr<MatchExpression> expr(makeExpr(exprBSON));
+ unique_ptr<MatchExpression> expr(makeExpr(exprBSON));
EqualityMatches equalities;
ASSERT_OK(extractEqualityMatches(*expr, &equalities));
diff --git a/src/mongo/db/ops/update_driver.cpp b/src/mongo/db/ops/update_driver.cpp
index c1235c8b93e..b5737419dad 100644
--- a/src/mongo/db/ops/update_driver.cpp
+++ b/src/mongo/db/ops/update_driver.cpp
@@ -49,7 +49,7 @@ namespace mongo {
namespace mb = mongo::mutablebson;
using boost::scoped_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::vector;
using pathsupport::EqualityMatches;
@@ -81,7 +81,7 @@ namespace mongo {
// definition, an object. We wrap the 'updateExpr' as the mod is expecting. Note
// that the wrapper is temporary so the object replace mod should make a copy of
// the object.
- auto_ptr<ModifierObjectReplace> mod(new ModifierObjectReplace);
+ unique_ptr<ModifierObjectReplace> mod(new ModifierObjectReplace);
BSONObj wrapper = BSON( "dummy" << updateExpr );
Status status = mod->init(wrapper.firstElement(), _modOptions);
if (!status.isOK()) {
@@ -153,7 +153,7 @@ namespace mongo {
<< " which is not allowed for any $" << type << " mod.");
}
- auto_ptr<ModifierInterface> mod(modifiertable::makeUpdateMod(type));
+ unique_ptr<ModifierInterface> mod(modifiertable::makeUpdateMod(type));
dassert(mod.get());
bool positional = false;
diff --git a/src/mongo/db/query/canonical_query.cpp b/src/mongo/db/query/canonical_query.cpp
index fa8a407fa20..d50b46ae087 100644
--- a/src/mongo/db/query/canonical_query.cpp
+++ b/src/mongo/db/query/canonical_query.cpp
@@ -211,7 +211,7 @@ namespace {
Status CanonicalQuery::canonicalize(LiteParsedQuery* lpq,
CanonicalQuery** out,
const MatchExpressionParser::WhereCallback& whereCallback) {
- std::auto_ptr<LiteParsedQuery> autoLpq(lpq);
+ std::unique_ptr<LiteParsedQuery> autoLpq(lpq);
// Make MatchExpression.
StatusWithMatchExpression swme = MatchExpressionParser::parse(autoLpq->getFilter(),
@@ -221,7 +221,7 @@ namespace {
}
// Make the CQ we'll hopefully return.
- std::auto_ptr<CanonicalQuery> cq(new CanonicalQuery());
+ std::unique_ptr<CanonicalQuery> cq(new CanonicalQuery());
// Takes ownership of lpq and the MatchExpression* in swme.
Status initStatus = cq->init(autoLpq.release(), whereCallback, swme.getValue());
@@ -254,7 +254,7 @@ namespace {
}
// Make the CQ we'll hopefully return.
- std::auto_ptr<CanonicalQuery> cq(new CanonicalQuery());
+ std::unique_ptr<CanonicalQuery> cq(new CanonicalQuery());
Status initStatus = cq->init(lpq, whereCallback, root->shallowClone());
if (!initStatus.isOK()) { return initStatus; }
@@ -285,7 +285,7 @@ namespace {
if (!parseStatus.isOK()) {
return parseStatus;
}
- std::auto_ptr<LiteParsedQuery> lpq(lpqRaw);
+ std::unique_ptr<LiteParsedQuery> lpq(lpqRaw);
// Build a parse tree from the BSONObj in the parsed query.
StatusWithMatchExpression swme =
@@ -295,7 +295,7 @@ namespace {
}
// Make the CQ we'll hopefully return.
- std::auto_ptr<CanonicalQuery> cq(new CanonicalQuery());
+ std::unique_ptr<CanonicalQuery> cq(new CanonicalQuery());
// Takes ownership of lpq and the MatchExpression* in swme.
Status initStatus = cq->init(lpq.release(), whereCallback, swme.getValue());
diff --git a/src/mongo/db/query/canonical_query_test.cpp b/src/mongo/db/query/canonical_query_test.cpp
index de2675940c7..13f5f60299c 100644
--- a/src/mongo/db/query/canonical_query_test.cpp
+++ b/src/mongo/db/query/canonical_query_test.cpp
@@ -35,7 +35,7 @@ using namespace mongo;
namespace {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
using std::unique_ptr;
@@ -104,9 +104,9 @@ namespace {
false, // snapshot
false, // explain
&lpqRaw));
- auto_ptr<LiteParsedQuery> lpq(lpqRaw);
+ unique_ptr<LiteParsedQuery> lpq(lpqRaw);
- auto_ptr<MatchExpression> me;
+ unique_ptr<MatchExpression> me;
// Valid: regular TEXT.
auto swme = parseNormalize("{$text: {$search: 's'}}");
@@ -190,9 +190,9 @@ namespace {
false, // snapshot
false, // explain
&lpqRaw));
- auto_ptr<LiteParsedQuery> lpq(lpqRaw);
+ unique_ptr<LiteParsedQuery> lpq(lpqRaw);
- auto_ptr<MatchExpression> me;
+ unique_ptr<MatchExpression> me;
// Valid: regular GEO_NEAR.
auto swme = parseNormalize("{a: {$near: [0, 0]}}");
@@ -286,9 +286,9 @@ namespace {
false, // snapshot
false, // explain
&lpqRaw));
- auto_ptr<LiteParsedQuery> lpq(lpqRaw);
+ unique_ptr<LiteParsedQuery> lpq(lpqRaw);
- auto_ptr<MatchExpression> me;
+ unique_ptr<MatchExpression> me;
// Invalid: TEXT and GEO_NEAR.
auto swme = parseNormalize("{$text: {$search: 's'}, a: {$near: [0, 0]}}");
@@ -326,9 +326,9 @@ namespace {
false, // snapshot
false, // explain
&lpqRaw));
- auto_ptr<LiteParsedQuery> lpq(lpqRaw);
+ unique_ptr<LiteParsedQuery> lpq(lpqRaw);
- auto_ptr<MatchExpression> me;
+ unique_ptr<MatchExpression> me;
// Invalid: TEXT and {$natural: 1} sort order.
auto swme = parseNormalize("{$text: {$search: 's'}}");
@@ -348,9 +348,9 @@ namespace {
false, // snapshot
false, // explain
&lpqRaw));
- auto_ptr<LiteParsedQuery> lpq(lpqRaw);
+ unique_ptr<LiteParsedQuery> lpq(lpqRaw);
- auto_ptr<MatchExpression> me;
+ unique_ptr<MatchExpression> me;
// Invalid: TEXT and {$natural: -1} sort order.
auto swme = parseNormalize("{$text: {$search: 's'}}");
@@ -370,9 +370,9 @@ namespace {
false, // snapshot
false, // explain
&lpqRaw));
- auto_ptr<LiteParsedQuery> lpq(lpqRaw);
+ unique_ptr<LiteParsedQuery> lpq(lpqRaw);
- auto_ptr<MatchExpression> me;
+ unique_ptr<MatchExpression> me;
// Invalid: TEXT and {$natural: -1} sort order.
auto swme = parseNormalize("{$text: {$search: 's'}}");
@@ -393,9 +393,9 @@ namespace {
false, // snapshot
false, // explain
&lpqRaw));
- auto_ptr<LiteParsedQuery> lpq(lpqRaw);
+ unique_ptr<LiteParsedQuery> lpq(lpqRaw);
- auto_ptr<MatchExpression> me;
+ unique_ptr<MatchExpression> me;
// Invalid: GEO_NEAR and {$natural: 1} sort order.
auto swme = parseNormalize("{a: {$near: {$geometry: {type: 'Point', coordinates: [0, 0]}}}}");
@@ -416,9 +416,9 @@ namespace {
false, // snapshot
false, // explain
&lpqRaw));
- auto_ptr<LiteParsedQuery> lpq(lpqRaw);
+ unique_ptr<LiteParsedQuery> lpq(lpqRaw);
- auto_ptr<MatchExpression> me;
+ unique_ptr<MatchExpression> me;
// Invalid: GEO_NEAR and {$natural: 1} hint.
auto swme = parseNormalize("{a: {$near: {$geometry: {type: 'Point', coordinates: [0, 0]}}}}");
@@ -438,9 +438,9 @@ namespace {
snapshot,
false, // explain
&lpqRaw));
- auto_ptr<LiteParsedQuery> lpq(lpqRaw);
+ unique_ptr<LiteParsedQuery> lpq(lpqRaw);
- auto_ptr<MatchExpression> me;
+ unique_ptr<MatchExpression> me;
// Invalid: TEXT and snapshot.
auto swme = parseNormalize("{$text: {$search: 's'}}");
@@ -537,8 +537,8 @@ namespace {
TEST(CanonicalQueryTest, RewriteNoDoubleOr) {
string queryStr = "{$or:[{a:1}, {b:1}], $or:[{c:1}, {d:1}], e:1}";
BSONObj queryObj = fromjson(queryStr);
- auto_ptr<MatchExpression> base(parseMatchExpression(queryObj));
- auto_ptr<MatchExpression> rewrite(CanonicalQuery::logicalRewrite(base->shallowClone()));
+ unique_ptr<MatchExpression> base(parseMatchExpression(queryObj));
+ unique_ptr<MatchExpression> rewrite(CanonicalQuery::logicalRewrite(base->shallowClone()));
assertEquivalent(queryStr.c_str(), base.get(), rewrite.get());
}
@@ -547,12 +547,12 @@ namespace {
// Rewrite of this...
string queryStr = "{$or:[{a:1}, {b:1}], e:1}";
BSONObj queryObj = fromjson(queryStr);
- auto_ptr<MatchExpression> rewrite(CanonicalQuery::logicalRewrite(parseMatchExpression(queryObj)));
+ unique_ptr<MatchExpression> rewrite(CanonicalQuery::logicalRewrite(parseMatchExpression(queryObj)));
// Should look like this.
string rewriteStr = "{$or:[{a:1, e:1}, {b:1, e:1}]}";
BSONObj rewriteObj = fromjson(rewriteStr);
- auto_ptr<MatchExpression> base(parseMatchExpression(rewriteObj));
+ unique_ptr<MatchExpression> base(parseMatchExpression(rewriteObj));
assertEquivalent(queryStr.c_str(), base.get(), rewrite.get());
}
@@ -560,10 +560,10 @@ namespace {
* Test function for CanonicalQuery::normalize.
*/
void testNormalizeQuery(const char* queryStr, const char* expectedExprStr) {
- auto_ptr<CanonicalQuery> cq(canonicalize(queryStr));
+ unique_ptr<CanonicalQuery> cq(canonicalize(queryStr));
MatchExpression* me = cq->root();
BSONObj expectedExprObj = fromjson(expectedExprStr);
- auto_ptr<MatchExpression> expectedExpr(parseMatchExpression(expectedExprObj));
+ unique_ptr<MatchExpression> expectedExpr(parseMatchExpression(expectedExprObj));
assertEquivalent(queryStr, expectedExpr.get(), me);
}
diff --git a/src/mongo/db/query/explain.cpp b/src/mongo/db/query/explain.cpp
index 7630bbd4c94..e67bb343dfb 100644
--- a/src/mongo/db/query/explain.cpp
+++ b/src/mongo/db/query/explain.cpp
@@ -49,7 +49,7 @@ namespace {
using namespace mongo;
using boost::scoped_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
using std::vector;
@@ -595,7 +595,7 @@ namespace mongo {
// Get stats of the winning plan from the trial period, if the verbosity level
// is high enough and there was a runoff between multiple plans.
- auto_ptr<PlanStageStats> winningStatsTrial;
+ unique_ptr<PlanStageStats> winningStatsTrial;
if (verbosity >= ExplainCommon::EXEC_ALL_PLANS && NULL != mps) {
winningStatsTrial.reset(exec->getStats());
invariant(winningStatsTrial.get());
diff --git a/src/mongo/db/query/find.cpp b/src/mongo/db/query/find.cpp
index 4ba5a9bcf42..a722ceb05b8 100644
--- a/src/mongo/db/query/find.cpp
+++ b/src/mongo/db/query/find.cpp
@@ -63,7 +63,7 @@
#include "mongo/util/mongoutils/str.h"
using boost::scoped_ptr;
-using std::auto_ptr;
+using std::unique_ptr;
using std::endl;
namespace mongo {
@@ -530,7 +530,7 @@ namespace mongo {
beginQueryOp(txn, nss, q.query, q.ntoreturn, q.ntoskip);
// Parse the qm into a CanonicalQuery.
- std::auto_ptr<CanonicalQuery> cq;
+ std::unique_ptr<CanonicalQuery> cq;
{
CanonicalQuery* cqRaw;
Status canonStatus = CanonicalQuery::canonicalize(q,
diff --git a/src/mongo/db/query/get_executor.cpp b/src/mongo/db/query/get_executor.cpp
index 9825a5ad224..74d0d42051a 100644
--- a/src/mongo/db/query/get_executor.cpp
+++ b/src/mongo/db/query/get_executor.cpp
@@ -80,7 +80,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::string;
using std::vector;
@@ -445,8 +445,8 @@ namespace mongo {
PlanExecutor::YieldPolicy yieldPolicy,
PlanExecutor** out,
size_t plannerOptions) {
- auto_ptr<CanonicalQuery> canonicalQuery(rawCanonicalQuery);
- auto_ptr<WorkingSet> ws(new WorkingSet());
+ unique_ptr<CanonicalQuery> canonicalQuery(rawCanonicalQuery);
+ unique_ptr<WorkingSet> ws(new WorkingSet());
PlanStage* root;
QuerySolution* querySolution;
Status status = prepareExecution(txn, collection, ws.get(), canonicalQuery.get(),
@@ -534,7 +534,7 @@ namespace {
PlanExecutor** execOut) {
invariant(collection);
invariant(cq);
- auto_ptr<CanonicalQuery> autoCq(cq);
+ unique_ptr<CanonicalQuery> autoCq(cq);
// A query can only do oplog start finding if it has a top-level $gt or $gte predicate over
// the "ts" field (the operation's timestamp). Find that predicate and pass it to
@@ -724,7 +724,7 @@ namespace {
deleteStageParams.isExplain = request->isExplain();
deleteStageParams.returnDeleted = request->shouldReturnDeleted();
- auto_ptr<WorkingSet> ws(new WorkingSet());
+ unique_ptr<WorkingSet> ws(new WorkingSet());
PlanExecutor::YieldPolicy policy = parsedDelete->canYield() ? PlanExecutor::YIELD_AUTO :
PlanExecutor::YIELD_MANUAL;
@@ -769,7 +769,7 @@ namespace {
}
// This is the regular path for when we have a CanonicalQuery.
- std::auto_ptr<CanonicalQuery> cq(parsedDelete->releaseParsedQuery());
+ std::unique_ptr<CanonicalQuery> cq(parsedDelete->releaseParsedQuery());
PlanStage* rawRoot;
QuerySolution* rawQuerySolution;
@@ -882,7 +882,7 @@ namespace {
PlanExecutor::YieldPolicy policy = parsedUpdate->canYield() ? PlanExecutor::YIELD_AUTO :
PlanExecutor::YIELD_MANUAL;
- auto_ptr<WorkingSet> ws(new WorkingSet());
+ unique_ptr<WorkingSet> ws(new WorkingSet());
UpdateStageParams updateStageParams(request, driver, opDebug);
if (!parsedUpdate->hasParsedQuery()) {
@@ -926,7 +926,7 @@ namespace {
}
// This is the regular path for when we have a CanonicalQuery.
- std::auto_ptr<CanonicalQuery> cq(parsedUpdate->releaseParsedQuery());
+ std::unique_ptr<CanonicalQuery> cq(parsedUpdate->releaseParsedQuery());
PlanStage* rawRoot;
QuerySolution* rawQuerySolution;
@@ -988,7 +988,7 @@ namespace {
return Status(ErrorCodes::BadValue, "server-side JavaScript execution is disabled");
}
- auto_ptr<WorkingSet> ws(new WorkingSet());
+ unique_ptr<WorkingSet> ws(new WorkingSet());
PlanStage* root;
QuerySolution* querySolution;
@@ -1011,7 +1011,7 @@ namespace {
if (!canonicalizeStatus.isOK()) {
return canonicalizeStatus;
}
- auto_ptr<CanonicalQuery> canonicalQuery(rawCanonicalQuery);
+ unique_ptr<CanonicalQuery> canonicalQuery(rawCanonicalQuery);
const size_t defaultPlannerOptions = 0;
Status status = prepareExecution(txn, collection, ws.get(), canonicalQuery.get(),
@@ -1216,7 +1216,7 @@ namespace {
bool explain,
PlanExecutor::YieldPolicy yieldPolicy,
PlanExecutor** execOut) {
- auto_ptr<WorkingSet> ws(new WorkingSet());
+ unique_ptr<WorkingSet> ws(new WorkingSet());
PlanStage* root;
QuerySolution* querySolution;
@@ -1231,7 +1231,7 @@ namespace {
return PlanExecutor::make(txn, ws.release(), root, request.ns, yieldPolicy, execOut);
}
- auto_ptr<CanonicalQuery> cq;
+ unique_ptr<CanonicalQuery> cq;
if (!request.query.isEmpty() || !request.hint.isEmpty()) {
// If query or hint is not empty, canonicalize the query before working with collection.
typedef MatchExpressionParser::WhereCallback WhereCallback;
@@ -1422,7 +1422,7 @@ namespace {
return status;
}
- auto_ptr<CanonicalQuery> autoCq(cq);
+ unique_ptr<CanonicalQuery> autoCq(cq);
// If there's no query, we can just distinct-scan one of the indices.
// Not every index in plannerParams.indices may be suitable. Refer to
diff --git a/src/mongo/db/query/get_executor_test.cpp b/src/mongo/db/query/get_executor_test.cpp
index 85d97d3f1f7..7ec251bb6ee 100644
--- a/src/mongo/db/query/get_executor_test.cpp
+++ b/src/mongo/db/query/get_executor_test.cpp
@@ -41,7 +41,7 @@ using namespace mongo;
namespace {
- using std::auto_ptr;
+ using std::unique_ptr;
static const char* ns = "somebogusns";
@@ -80,7 +80,7 @@ namespace {
AllowedIndices *allowedIndicesRaw;
// getAllowedIndices should return false when query shape is not yet in query settings.
- auto_ptr<CanonicalQuery> cq(canonicalize("{a: 1}", "{}", "{}"));
+ unique_ptr<CanonicalQuery> cq(canonicalize("{a: 1}", "{}", "{}"));
PlanCacheKey key = planCache.computeKey(*cq);
ASSERT_FALSE(querySettings.getAllowedIndices(key, &allowedIndicesRaw));
@@ -95,7 +95,7 @@ namespace {
ASSERT_TRUE(querySettings.getAllowedIndices(key, &allowedIndicesRaw));
ASSERT_FALSE(key.empty());
ASSERT(NULL != allowedIndicesRaw);
- auto_ptr<AllowedIndices> allowedIndices(allowedIndicesRaw);
+ unique_ptr<AllowedIndices> allowedIndices(allowedIndicesRaw);
// Indexes from index catalog.
std::vector<IndexEntry> indexEntries;
diff --git a/src/mongo/db/query/index_bounds_builder_test.cpp b/src/mongo/db/query/index_bounds_builder_test.cpp
index 35bb4304c21..1b349b0515a 100644
--- a/src/mongo/db/query/index_bounds_builder_test.cpp
+++ b/src/mongo/db/query/index_bounds_builder_test.cpp
@@ -42,7 +42,7 @@ using namespace mongo;
namespace {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::numeric_limits;
using std::string;
using std::vector;
@@ -74,7 +74,7 @@ namespace {
for (vector<BSONObj>::const_iterator it = toUnion.begin();
it != toUnion.end();
++it) {
- auto_ptr<MatchExpression> expr(parseMatchExpression(*it));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(*it));
BSONElement elt = it->firstElement();
if (toUnion.begin() == it) {
IndexBoundsBuilder::translate(expr.get(), elt, testIndex, oilOut, tightnessOut);
@@ -97,7 +97,7 @@ namespace {
for (vector<BSONObj>::const_iterator it = toIntersect.begin();
it != toIntersect.end();
++it) {
- auto_ptr<MatchExpression> expr(parseMatchExpression(*it));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(*it));
BSONElement elt = it->firstElement();
if (toIntersect.begin() == it) {
IndexBoundsBuilder::translate(expr.get(), elt, testIndex, oilOut, tightnessOut);
@@ -126,7 +126,7 @@ namespace {
++it) {
BSONObj obj = it->first;
bool isIntersect = it->second;
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
if (constraints.begin() == it) {
IndexBoundsBuilder::translate(expr.get(), elt, testIndex, oilOut, tightnessOut);
@@ -165,7 +165,7 @@ namespace {
// Bounds generated should be the same as the embedded expression
// except for the tightness.
BSONObj obj = fromjson("{a: {$elemMatch: {$gt: 2}}}");
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -184,7 +184,7 @@ namespace {
TEST(IndexBoundsBuilderTest, TranslateLteNumber) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = fromjson("{a: {$lte: 1}}");
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -199,7 +199,7 @@ namespace {
TEST(IndexBoundsBuilderTest, TranslateLteNumberMin) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = BSON("a" << BSON("$lte" << numberMin));
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -214,7 +214,7 @@ namespace {
TEST(IndexBoundsBuilderTest, TranslateLteNegativeInfinity) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = fromjson("{a: {$lte: -Infinity}}");
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -229,7 +229,7 @@ namespace {
TEST(IndexBoundsBuilderTest, TranslateLtNumber) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = fromjson("{a: {$lt: 1}}");
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -244,7 +244,7 @@ namespace {
TEST(IndexBoundsBuilderTest, TranslateLtNumberMin) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = BSON("a" << BSON("$lt" << numberMin));
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -259,7 +259,7 @@ namespace {
TEST(IndexBoundsBuilderTest, TranslateLtNegativeInfinity) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = fromjson("{a: {$lt: -Infinity}}");
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -272,7 +272,7 @@ namespace {
TEST(IndexBoundsBuilderTest, TranslateLtDate) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = BSON("a" << LT << Date_t::fromMillisSinceEpoch(5000));
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -287,7 +287,7 @@ namespace {
TEST(IndexBoundsBuilderTest, TranslateGtNumber) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = fromjson("{a: {$gt: 1}}");
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -302,7 +302,7 @@ namespace {
TEST(IndexBoundsBuilderTest, TranslateGtNumberMax) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = BSON("a" << BSON("$gt" << numberMax));
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -317,7 +317,7 @@ namespace {
TEST(IndexBoundsBuilderTest, TranslateGtPositiveInfinity) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = fromjson("{a: {$gt: Infinity}}");
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -330,7 +330,7 @@ namespace {
TEST(IndexBoundsBuilderTest, TranslateGteNumber) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = fromjson("{a: {$gte: 1}}");
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -345,7 +345,7 @@ namespace {
TEST(IndexBoundsBuilderTest, TranslateGteNumberMax) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = BSON("a" << BSON("$gte" << numberMax));
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -360,7 +360,7 @@ namespace {
TEST(IndexBoundsBuilderTest, TranslateGtePositiveInfinity) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = fromjson("{a: {$gte: Infinity}}");
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -375,7 +375,7 @@ namespace {
TEST(IndexBoundsBuilderTest, TranslateGtString) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = fromjson("{a: {$gt: 'abc'}}");
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -390,7 +390,7 @@ namespace {
TEST(IndexBoundsBuilderTest, TranslateEqualNan) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = fromjson("{a: NaN}");
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -405,7 +405,7 @@ namespace {
TEST(IndexBoundsBuilderTest, TranslateLtNan) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = fromjson("{a: {$lt: NaN}}");
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -418,7 +418,7 @@ namespace {
TEST(IndexBoundsBuilderTest, TranslateLteNan) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = fromjson("{a: {$lte: NaN}}");
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -433,7 +433,7 @@ namespace {
TEST(IndexBoundsBuilderTest, TranslateGtNan) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = fromjson("{a: {$gt: NaN}}");
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -446,7 +446,7 @@ namespace {
TEST(IndexBoundsBuilderTest, TranslateGteNan) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = fromjson("{a: {$gte: NaN}}");
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -461,7 +461,7 @@ namespace {
TEST(IndexBoundsBuilderTest, TranslateEqual) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = BSON("a" << 4);
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -476,7 +476,7 @@ namespace {
TEST(IndexBoundsBuilderTest, TranslateArrayEqualBasic) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = fromjson("{a: [1, 2, 3]}");
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -493,7 +493,7 @@ namespace {
TEST(IndexBoundsBuilderTest, TranslateIn) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = fromjson("{a: {$in: [8, 44, -1, -3]}}");
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -514,7 +514,7 @@ namespace {
TEST(IndexBoundsBuilderTest, TranslateInArray) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = fromjson("{a: {$in: [[1], 2]}}");
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -609,7 +609,7 @@ namespace {
TEST(IndexBoundsBuilderTest, ExistsTrue) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = fromjson("{a: {$exists: true}}");
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -624,7 +624,7 @@ namespace {
TEST(IndexBoundsBuilderTest, ExistsFalse) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = fromjson("{a: {$exists: false}}");
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -645,7 +645,7 @@ namespace {
nullptr, // filterExpr
BSONObj());
BSONObj obj = fromjson("{a: {$exists: true}}");
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -839,7 +839,7 @@ namespace {
TEST(IndexBoundsBuilderTest, TranslateMod) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = fromjson("{a: {$mod: [2, 0]}}");
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -1017,7 +1017,7 @@ namespace {
TEST(IndexBoundsBuilderTest, SimpleNonPrefixRegex) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = fromjson("{a: /foo/}");
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -1033,7 +1033,7 @@ namespace {
TEST(IndexBoundsBuilderTest, NonSimpleRegexWithPipe) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = fromjson("{a: /^foo.*|bar/}");
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -1049,7 +1049,7 @@ namespace {
TEST(IndexBoundsBuilderTest, SimpleRegexSingleLineMode) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = fromjson("{a: /^foo/s}");
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -1065,7 +1065,7 @@ namespace {
TEST(IndexBoundsBuilderTest, SimplePrefixRegex) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = fromjson("{a: /^foo/}");
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -1294,7 +1294,7 @@ namespace {
TEST(IndexBoundsBuilderTest, SimpleNE) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = BSON("a" << BSON("$ne" << 3));
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
IndexBoundsBuilder::BoundsTightness tightness;
@@ -1345,7 +1345,7 @@ namespace {
TEST(IndexBoundsBuilderTest, CodeTypeBounds) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = fromjson("{a: {$type: 13}}");
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
@@ -1370,7 +1370,7 @@ namespace {
TEST(IndexBoundsBuilderTest, CodeWithScopeTypeBounds) {
IndexEntry testIndex = IndexEntry(BSONObj());
BSONObj obj = fromjson("{a: {$type: 15}}");
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
BSONElement elt = obj.firstElement();
OrderedIntervalList oil;
diff --git a/src/mongo/db/query/lite_parsed_query.cpp b/src/mongo/db/query/lite_parsed_query.cpp
index 747d62d3f60..c24e5271112 100644
--- a/src/mongo/db/query/lite_parsed_query.cpp
+++ b/src/mongo/db/query/lite_parsed_query.cpp
@@ -37,7 +37,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
const string LiteParsedQuery::cmdOptionMaxTimeMS("maxTimeMS");
@@ -72,7 +72,7 @@ namespace mongo {
const BSONObj& cmdObj,
bool isExplain,
LiteParsedQuery** out) {
- auto_ptr<LiteParsedQuery> pq(new LiteParsedQuery());
+ unique_ptr<LiteParsedQuery> pq(new LiteParsedQuery());
pq->_ns = fullns;
pq->_fromCommand = true;
pq->_explain = isExplain;
@@ -566,7 +566,7 @@ namespace mongo {
// static
Status LiteParsedQuery::make(const QueryMessage& qm, LiteParsedQuery** out) {
- auto_ptr<LiteParsedQuery> pq(new LiteParsedQuery());
+ unique_ptr<LiteParsedQuery> pq(new LiteParsedQuery());
Status status = pq->init(qm.ns, qm.ntoskip, qm.ntoreturn, qm.queryOptions, qm.query,
qm.fields, true);
@@ -582,7 +582,7 @@ namespace mongo {
bool snapshot,
bool explain,
LiteParsedQuery** out) {
- auto_ptr<LiteParsedQuery> pq(new LiteParsedQuery());
+ unique_ptr<LiteParsedQuery> pq(new LiteParsedQuery());
pq->_sort = sort.getOwned();
pq->_hint = hint.getOwned();
pq->_min = minObj.getOwned();
diff --git a/src/mongo/db/query/lru_key_value.h b/src/mongo/db/query/lru_key_value.h
index 808e0584662..8215c029375 100644
--- a/src/mongo/db/query/lru_key_value.h
+++ b/src/mongo/db/query/lru_key_value.h
@@ -88,9 +88,9 @@ namespace mongo {
* kv-store is full prior to the add() operation.
*
* If an entry is evicted, it will be returned in
- * an auto_ptr for the caller to use before disposing.
+ * an unique_ptr for the caller to use before disposing.
*/
- std::auto_ptr<V> add(const K& key, V* entry) {
+ std::unique_ptr<V> add(const K& key, V* entry) {
// If the key already exists, delete it first.
KVMapConstIt i = _kvMap.find(key);
if (i != _kvMap.end()) {
@@ -117,11 +117,11 @@ namespace mongo {
invariant(_currentSize == _maxSize);
// Pass ownership of evicted entry to caller.
- // If caller chooses to ignore this auto_ptr,
+ // If caller chooses to ignore this unique_ptr,
// the evicted entry will be deleted automatically.
- return std::auto_ptr<V>(evictedEntry);
+ return std::unique_ptr<V>(evictedEntry);
}
- return std::auto_ptr<V>();
+ return std::unique_ptr<V>();
}
/**
diff --git a/src/mongo/db/query/lru_key_value_test.cpp b/src/mongo/db/query/lru_key_value_test.cpp
index 28cc2147dda..da9c9c73f34 100644
--- a/src/mongo/db/query/lru_key_value_test.cpp
+++ b/src/mongo/db/query/lru_key_value_test.cpp
@@ -97,7 +97,7 @@ namespace {
int maxSize = 10;
LRUKeyValue<int, int> cache(maxSize);
for (int i = 0; i < maxSize; ++i) {
- std::auto_ptr<int> evicted = cache.add(i, new int(i));
+ std::unique_ptr<int> evicted = cache.add(i, new int(i));
ASSERT(NULL == evicted.get());
}
ASSERT_EQUALS(cache.size(), (size_t)maxSize);
@@ -110,7 +110,7 @@ namespace {
}
// Adding another entry causes an eviction.
- std::auto_ptr<int> evicted = cache.add(maxSize + 1, new int(maxSize + 1));
+ std::unique_ptr<int> evicted = cache.add(maxSize + 1, new int(maxSize + 1));
ASSERT_EQUALS(cache.size(), (size_t)maxSize);
ASSERT(NULL != evicted.get());
ASSERT_EQUALS(*evicted, evictKey);
@@ -136,7 +136,7 @@ namespace {
int maxSize = 10;
LRUKeyValue<int, int> cache(maxSize);
for (int i = 0; i < maxSize; ++i) {
- std::auto_ptr<int> evicted = cache.add(i, new int(i));
+ std::unique_ptr<int> evicted = cache.add(i, new int(i));
ASSERT(NULL == evicted.get());
}
ASSERT_EQUALS(cache.size(), (size_t)maxSize);
@@ -147,7 +147,7 @@ namespace {
// Evict all but one of the original entries.
for (int i = maxSize; i < (maxSize + maxSize - 1); ++i) {
- std::auto_ptr<int> evicted = cache.add(i, new int(i));
+ std::unique_ptr<int> evicted = cache.add(i, new int(i));
ASSERT(NULL != evicted.get());
}
ASSERT_EQUALS(cache.size(), (size_t)maxSize);
diff --git a/src/mongo/db/query/parsed_projection.cpp b/src/mongo/db/query/parsed_projection.cpp
index 4c20c13acf6..7552475d5f1 100644
--- a/src/mongo/db/query/parsed_projection.cpp
+++ b/src/mongo/db/query/parsed_projection.cpp
@@ -32,7 +32,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
/**
@@ -238,7 +238,7 @@ namespace mongo {
}
// Fill out the returned obj.
- auto_ptr<ParsedProjection> pp(new ParsedProjection());
+ unique_ptr<ParsedProjection> pp(new ParsedProjection());
// The positional operator uses the MatchDetails from the query
// expression to know which array element was matched.
diff --git a/src/mongo/db/query/parsed_projection_test.cpp b/src/mongo/db/query/parsed_projection_test.cpp
index df36aef927b..4507da17a1d 100644
--- a/src/mongo/db/query/parsed_projection_test.cpp
+++ b/src/mongo/db/query/parsed_projection_test.cpp
@@ -35,7 +35,7 @@
namespace {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
using std::vector;
@@ -45,7 +45,7 @@ namespace {
// creation function
//
- auto_ptr<ParsedProjection> createParsedProjection(const BSONObj& query, const BSONObj& projObj) {
+ unique_ptr<ParsedProjection> createParsedProjection(const BSONObj& query, const BSONObj& projObj) {
StatusWithMatchExpression swme = MatchExpressionParser::parse(query);
ASSERT(swme.isOK());
boost::scoped_ptr<MatchExpression> queryMatchExpr(swme.getValue());
@@ -56,10 +56,10 @@ namespace {
<< " (query: " << query << "): " << status.toString());
}
ASSERT(out);
- return auto_ptr<ParsedProjection>(out);
+ return unique_ptr<ParsedProjection>(out);
}
- auto_ptr<ParsedProjection> createParsedProjection(const char* queryStr, const char* projStr) {
+ unique_ptr<ParsedProjection> createParsedProjection(const char* queryStr, const char* projStr) {
BSONObj query = fromjson(queryStr);
BSONObj projObj = fromjson(projStr);
return createParsedProjection(query, projObj);
@@ -85,17 +85,17 @@ namespace {
// the projection spec is non-empty. This test case is included for
// completeness and do not reflect actual usage.
TEST(ParsedProjectionTest, MakeId) {
- auto_ptr<ParsedProjection> parsedProj(createParsedProjection("{}", "{}"));
+ unique_ptr<ParsedProjection> parsedProj(createParsedProjection("{}", "{}"));
ASSERT(parsedProj->requiresDocument());
}
TEST(ParsedProjectionTest, MakeEmpty) {
- auto_ptr<ParsedProjection> parsedProj(createParsedProjection("{}", "{_id: 0}"));
+ unique_ptr<ParsedProjection> parsedProj(createParsedProjection("{}", "{_id: 0}"));
ASSERT(parsedProj->requiresDocument());
}
TEST(ParsedProjectionTest, MakeSingleField) {
- auto_ptr<ParsedProjection> parsedProj(createParsedProjection("{}", "{a: 1}"));
+ unique_ptr<ParsedProjection> parsedProj(createParsedProjection("{}", "{a: 1}"));
ASSERT(!parsedProj->requiresDocument());
const vector<string>& fields = parsedProj->getRequiredFields();
ASSERT_EQUALS(fields.size(), 2U);
@@ -104,7 +104,7 @@ namespace {
}
TEST(ParsedProjectionTest, MakeSingleFieldCovered) {
- auto_ptr<ParsedProjection> parsedProj(createParsedProjection("{}", "{_id: 0, a: 1}"));
+ unique_ptr<ParsedProjection> parsedProj(createParsedProjection("{}", "{_id: 0, a: 1}"));
ASSERT(!parsedProj->requiresDocument());
const vector<string>& fields = parsedProj->getRequiredFields();
ASSERT_EQUALS(fields.size(), 1U);
@@ -112,7 +112,7 @@ namespace {
}
TEST(ParsedProjectionTest, MakeSingleFieldIDCovered) {
- auto_ptr<ParsedProjection> parsedProj(createParsedProjection("{}", "{_id: 1}"));
+ unique_ptr<ParsedProjection> parsedProj(createParsedProjection("{}", "{_id: 1}"));
ASSERT(!parsedProj->requiresDocument());
const vector<string>& fields = parsedProj->getRequiredFields();
ASSERT_EQUALS(fields.size(), 1U);
@@ -121,7 +121,7 @@ namespace {
// boolean support is undocumented
TEST(ParsedProjectionTest, MakeSingleFieldCoveredBoolean) {
- auto_ptr<ParsedProjection> parsedProj(createParsedProjection("{}", "{_id: 0, a: true}"));
+ unique_ptr<ParsedProjection> parsedProj(createParsedProjection("{}", "{_id: 0, a: true}"));
ASSERT(!parsedProj->requiresDocument());
const vector<string>& fields = parsedProj->getRequiredFields();
ASSERT_EQUALS(fields.size(), 1U);
@@ -130,7 +130,7 @@ namespace {
// boolean support is undocumented
TEST(ParsedProjectionTest, MakeSingleFieldCoveredIdBoolean) {
- auto_ptr<ParsedProjection> parsedProj(createParsedProjection("{}", "{_id: false, a: 1}"));
+ unique_ptr<ParsedProjection> parsedProj(createParsedProjection("{}", "{_id: false, a: 1}"));
ASSERT(!parsedProj->requiresDocument());
const vector<string>& fields = parsedProj->getRequiredFields();
ASSERT_EQUALS(fields.size(), 1U);
@@ -177,7 +177,7 @@ namespace {
// to achieve the same effect.
// Projection parser should handle this the same way as an empty path.
TEST(ParsedProjectionTest, InvalidPositionalProjectionDefaultPathMatchExpression) {
- auto_ptr<MatchExpression> queryMatchExpr(new FalseMatchExpression());
+ unique_ptr<MatchExpression> queryMatchExpr(new FalseMatchExpression());
ASSERT(NULL == queryMatchExpr->path().rawData());
ParsedProjection* out = NULL;
diff --git a/src/mongo/db/query/plan_cache.cpp b/src/mongo/db/query/plan_cache.cpp
index c1de9f0e891..0f2871e2f29 100644
--- a/src/mongo/db/query/plan_cache.cpp
+++ b/src/mongo/db/query/plan_cache.cpp
@@ -582,7 +582,7 @@ namespace {
entry->projection = pq.getProj().getOwned();
boost::lock_guard<boost::mutex> cacheLock(_cacheMutex);
- std::auto_ptr<PlanCacheEntry> evictedEntry = _cache.add(computeKey(query), entry);
+ std::unique_ptr<PlanCacheEntry> evictedEntry = _cache.add(computeKey(query), entry);
if (NULL != evictedEntry.get()) {
LOG(1) << _ns << ": plan cache maximum size exceeded - "
@@ -614,7 +614,7 @@ namespace {
if (NULL == feedback) {
return Status(ErrorCodes::BadValue, "feedback is NULL");
}
- std::auto_ptr<PlanCacheEntryFeedback> autoFeedback(feedback);
+ std::unique_ptr<PlanCacheEntryFeedback> autoFeedback(feedback);
PlanCacheKey ck = computeKey(cq);
boost::lock_guard<boost::mutex> cacheLock(_cacheMutex);
diff --git a/src/mongo/db/query/plan_cache_test.cpp b/src/mongo/db/query/plan_cache_test.cpp
index a5353cbfcbe..55554315376 100644
--- a/src/mongo/db/query/plan_cache_test.cpp
+++ b/src/mongo/db/query/plan_cache_test.cpp
@@ -52,7 +52,7 @@ using namespace mongo;
namespace {
using boost::scoped_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
using std::unique_ptr;
using std::vector;
@@ -173,7 +173,7 @@ namespace {
*/
struct GenerateQuerySolution {
QuerySolution* operator()() const {
- auto_ptr<QuerySolution> qs(new QuerySolution());
+ unique_ptr<QuerySolution> qs(new QuerySolution());
qs->cacheData.reset(new SolutionCacheData());
qs->cacheData->solnType = SolutionCacheData::COLLSCAN_SOLN;
qs->cacheData->tree.reset(new PlanCacheIndexTree());
@@ -185,10 +185,10 @@ namespace {
* Utility function to create a PlanRankingDecision
*/
PlanRankingDecision* createDecision(size_t numPlans) {
- auto_ptr<PlanRankingDecision> why(new PlanRankingDecision());
+ unique_ptr<PlanRankingDecision> why(new PlanRankingDecision());
for (size_t i = 0; i < numPlans; ++i) {
CommonStats common("COLLSCAN");
- auto_ptr<PlanStageStats> stats(new PlanStageStats(common, STAGE_COLLSCAN));
+ unique_ptr<PlanStageStats> stats(new PlanStageStats(common, STAGE_COLLSCAN));
stats->specific.reset(new CollectionScanStats());
why->stats.mutableVector().push_back(stats.release());
why->scores.push_back(0U);
@@ -222,12 +222,12 @@ namespace {
}
void assertShouldNotCacheQuery(const BSONObj& query) {
- auto_ptr<CanonicalQuery> cq(canonicalize(query));
+ unique_ptr<CanonicalQuery> cq(canonicalize(query));
assertShouldNotCacheQuery(*cq);
}
void assertShouldNotCacheQuery(const char* queryStr) {
- auto_ptr<CanonicalQuery> cq(canonicalize(queryStr));
+ unique_ptr<CanonicalQuery> cq(canonicalize(queryStr));
assertShouldNotCacheQuery(*cq);
}
@@ -238,12 +238,12 @@ namespace {
*/
TEST(PlanCacheTest, ShouldCacheQueryBasic) {
- auto_ptr<CanonicalQuery> cq(canonicalize("{a: 1}"));
+ unique_ptr<CanonicalQuery> cq(canonicalize("{a: 1}"));
assertShouldCacheQuery(*cq);
}
TEST(PlanCacheTest, ShouldCacheQuerySort) {
- auto_ptr<CanonicalQuery> cq(canonicalize("{}", "{a: -1}", "{_id: 0, a: 1}"));
+ unique_ptr<CanonicalQuery> cq(canonicalize("{}", "{a: -1}", "{_id: 0, a: 1}"));
assertShouldCacheQuery(*cq);
}
@@ -257,7 +257,7 @@ namespace {
* This should normally be handled by the IDHack runner.
*/
TEST(PlanCacheTest, ShouldNotCacheQueryCollectionScan) {
- auto_ptr<CanonicalQuery> cq(canonicalize("{}"));
+ unique_ptr<CanonicalQuery> cq(canonicalize("{}"));
assertShouldNotCacheQuery(*cq);
}
@@ -267,7 +267,7 @@ namespace {
* Therefore, not much point in caching.
*/
TEST(PlanCacheTest, ShouldNotCacheQueryWithHint) {
- auto_ptr<CanonicalQuery> cq(canonicalize("{a: 1}", "{}", "{}", 0, 0, "{a: 1, b: 1}",
+ unique_ptr<CanonicalQuery> cq(canonicalize("{a: 1}", "{}", "{}", 0, 0, "{a: 1, b: 1}",
"{}", "{}"));
assertShouldNotCacheQuery(*cq);
}
@@ -276,7 +276,7 @@ namespace {
* Min queries are a specialized case of hinted queries
*/
TEST(PlanCacheTest, ShouldNotCacheQueryWithMin) {
- auto_ptr<CanonicalQuery> cq(canonicalize("{a: 1}", "{}", "{}", 0, 0, "{}",
+ unique_ptr<CanonicalQuery> cq(canonicalize("{a: 1}", "{}", "{}", 0, 0, "{}",
"{a: 100}", "{}"));
assertShouldNotCacheQuery(*cq);
}
@@ -285,7 +285,7 @@ namespace {
* Max queries are non-cacheable for the same reasons as min queries.
*/
TEST(PlanCacheTest, ShouldNotCacheQueryWithMax) {
- auto_ptr<CanonicalQuery> cq(canonicalize("{a: 1}", "{}", "{}", 0, 0, "{}",
+ unique_ptr<CanonicalQuery> cq(canonicalize("{a: 1}", "{}", "{}", 0, 0, "{}",
"{}", "{a: 100}"));
assertShouldNotCacheQuery(*cq);
}
@@ -295,7 +295,7 @@ namespace {
* the planner is able to come up with a cacheable solution.
*/
TEST(PlanCacheTest, ShouldCacheQueryWithGeoWithinLegacyCoordinates) {
- auto_ptr<CanonicalQuery> cq(canonicalize("{a: {$geoWithin: "
+ unique_ptr<CanonicalQuery> cq(canonicalize("{a: {$geoWithin: "
"{$box: [[-180, -90], [180, 90]]}}}"));
assertShouldCacheQuery(*cq);
}
@@ -304,7 +304,7 @@ namespace {
* $geoWithin queries with GeoJSON coordinates are supported by the index bounds builder.
*/
TEST(PlanCacheTest, ShouldCacheQueryWithGeoWithinJSONCoordinates) {
- auto_ptr<CanonicalQuery> cq(canonicalize("{a: {$geoWithin: "
+ unique_ptr<CanonicalQuery> cq(canonicalize("{a: {$geoWithin: "
"{$geometry: {type: 'Polygon', coordinates: "
"[[[0, 0], [0, 90], [90, 0], [0, 0]]]}}}}"));
assertShouldCacheQuery(*cq);
@@ -314,7 +314,7 @@ namespace {
* $geoWithin queries with both legacy and GeoJSON coordinates are cacheable.
*/
TEST(PlanCacheTest, ShouldCacheQueryWithGeoWithinLegacyAndJSONCoordinates) {
- auto_ptr<CanonicalQuery> cq(canonicalize(
+ unique_ptr<CanonicalQuery> cq(canonicalize(
"{$or: [{a: {$geoWithin: {$geometry: {type: 'Polygon', "
"coordinates: [[[0, 0], [0, 90], "
"[90, 0], [0, 0]]]}}}},"
@@ -326,7 +326,7 @@ namespace {
* $geoIntersects queries are always cacheable because they support GeoJSON coordinates only.
*/
TEST(PlanCacheTest, ShouldCacheQueryWithGeoIntersects) {
- auto_ptr<CanonicalQuery> cq(canonicalize("{a: {$geoIntersects: "
+ unique_ptr<CanonicalQuery> cq(canonicalize("{a: {$geoIntersects: "
"{$geometry: {type: 'Point', coordinates: "
"[10.0, 10.0]}}}}"));
assertShouldCacheQuery(*cq);
@@ -337,7 +337,7 @@ namespace {
* between flat and spherical queries.
*/
TEST(PlanCacheTest, ShouldNotCacheQueryWithGeoNear) {
- auto_ptr<CanonicalQuery> cq(canonicalize("{a: {$geoNear: {$geometry: {type: 'Point',"
+ unique_ptr<CanonicalQuery> cq(canonicalize("{a: {$geoNear: {$geometry: {type: 'Point',"
"coordinates: [0,0]}, $maxDistance:100}}}"));
assertShouldCacheQuery(*cq);
}
@@ -348,7 +348,7 @@ namespace {
* non-winning plans.
*/
TEST(PlanCacheTest, ShouldNotCacheQueryExplain) {
- auto_ptr<CanonicalQuery> cq(canonicalize("{a: 1}", "{}", "{}", 0, 0, "{}",
+ unique_ptr<CanonicalQuery> cq(canonicalize("{a: 1}", "{}", "{}", 0, 0, "{}",
"{}", "{}", // min, max
false, // snapshot
true // explain
@@ -361,7 +361,7 @@ namespace {
// Adding an empty vector of query solutions should fail.
TEST(PlanCacheTest, AddEmptySolutions) {
PlanCache planCache;
- auto_ptr<CanonicalQuery> cq(canonicalize("{a: 1}"));
+ unique_ptr<CanonicalQuery> cq(canonicalize("{a: 1}"));
std::vector<QuerySolution*> solns;
boost::scoped_ptr<PlanRankingDecision> decision(createDecision(1U));
ASSERT_NOT_OK(planCache.add(*cq, solns, decision.get()));
@@ -369,7 +369,7 @@ namespace {
TEST(PlanCacheTest, AddValidSolution) {
PlanCache planCache;
- auto_ptr<CanonicalQuery> cq(canonicalize("{a: 1}"));
+ unique_ptr<CanonicalQuery> cq(canonicalize("{a: 1}"));
QuerySolution qs;
qs.cacheData.reset(new SolutionCacheData());
qs.cacheData->tree.reset(new PlanCacheIndexTree());
@@ -386,7 +386,7 @@ namespace {
TEST(PlanCacheTest, NotifyOfWriteOp) {
PlanCache planCache;
- auto_ptr<CanonicalQuery> cq(canonicalize("{a: 1}"));
+ unique_ptr<CanonicalQuery> cq(canonicalize("{a: 1}"));
QuerySolution qs;
qs.cacheData.reset(new SolutionCacheData());
qs.cacheData->tree.reset(new PlanCacheIndexTree());
@@ -1066,7 +1066,7 @@ namespace {
const char* projStr,
const char *expectedStr) {
PlanCache planCache;
- auto_ptr<CanonicalQuery> cq(canonicalize(queryStr, sortStr, projStr));
+ unique_ptr<CanonicalQuery> cq(canonicalize(queryStr, sortStr, projStr));
PlanCacheKey key = planCache.computeKey(*cq);
PlanCacheKey expectedKey(expectedStr);
if (key == expectedKey) {
@@ -1148,10 +1148,10 @@ namespace {
PlanCache planCache;
// Legacy coordinates.
- auto_ptr<CanonicalQuery> cqLegacy(canonicalize("{a: {$geoWithin: "
+ unique_ptr<CanonicalQuery> cqLegacy(canonicalize("{a: {$geoWithin: "
"{$box: [[-180, -90], [180, 90]]}}}"));
// GeoJSON coordinates.
- auto_ptr<CanonicalQuery> cqNew(canonicalize("{a: {$geoWithin: "
+ unique_ptr<CanonicalQuery> cqNew(canonicalize("{a: {$geoWithin: "
"{$geometry: {type: 'Polygon', coordinates: "
"[[[0, 0], [0, 90], [90, 0], [0, 0]]]}}}}"));
ASSERT_NOT_EQUALS(planCache.computeKey(*cqLegacy),
diff --git a/src/mongo/db/query/plan_enumerator.cpp b/src/mongo/db/query/plan_enumerator.cpp
index 9d889b40987..ef1f23997d0 100644
--- a/src/mongo/db/query/plan_enumerator.cpp
+++ b/src/mongo/db/query/plan_enumerator.cpp
@@ -39,7 +39,7 @@
namespace {
using namespace mongo;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::set;
using std::string;
@@ -276,7 +276,7 @@ namespace mongo {
else if (Indexability::arrayUsesIndexOnChildren(node)) {
// Add each of our children as a subnode. We enumerate through each subnode one at a
// time until it's exhausted then we move on.
- auto_ptr<ArrayAssignment> aa(new ArrayAssignment());
+ unique_ptr<ArrayAssignment> aa(new ArrayAssignment());
if (MatchExpression::ELEM_MATCH_OBJECT == node->matchType()) {
childContext.elemMatchExpr = node;
diff --git a/src/mongo/db/query/plan_executor.cpp b/src/mongo/db/query/plan_executor.cpp
index 42ca5164107..c261f1b8982 100644
--- a/src/mongo/db/query/plan_executor.cpp
+++ b/src/mongo/db/query/plan_executor.cpp
@@ -130,7 +130,7 @@ namespace mongo {
const std::string& ns,
YieldPolicy yieldPolicy,
PlanExecutor** out) {
- std::auto_ptr<PlanExecutor> exec(new PlanExecutor(opCtx, ws, rt, qs, cq, collection, ns));
+ std::unique_ptr<PlanExecutor> exec(new PlanExecutor(opCtx, ws, rt, qs, cq, collection, ns));
// Perform plan selection, if necessary.
Status status = exec->pickBestPlan(yieldPolicy);
diff --git a/src/mongo/db/query/planner_access.cpp b/src/mongo/db/query/planner_access.cpp
index 70d91540003..e0f714716b8 100644
--- a/src/mongo/db/query/planner_access.cpp
+++ b/src/mongo/db/query/planner_access.cpp
@@ -59,7 +59,7 @@ namespace {
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::vector;
// static
@@ -843,7 +843,7 @@ namespace mongo {
bool inArrayOperator,
const vector<IndexEntry>& indices,
const QueryPlannerParams& params) {
- auto_ptr<MatchExpression> autoRoot;
+ unique_ptr<MatchExpression> autoRoot;
if (!inArrayOperator) {
autoRoot.reset(root);
}
@@ -854,7 +854,7 @@ namespace mongo {
// sure that the FETCH stage will recheck the entire predicate.
//
// XXX: This block is a hack to accommodate the storage layer concurrency model.
- std::auto_ptr<MatchExpression> clonedRoot;
+ std::unique_ptr<MatchExpression> clonedRoot;
if (params.options & QueryPlannerParams::CANNOT_TRIM_IXISECT) {
clonedRoot.reset(root->shallowClone());
}
@@ -975,7 +975,7 @@ namespace mongo {
bool inArrayOperator,
const vector<IndexEntry>& indices,
const QueryPlannerParams& params) {
- auto_ptr<MatchExpression> autoRoot;
+ unique_ptr<MatchExpression> autoRoot;
if (!inArrayOperator) {
autoRoot.reset(root);
}
@@ -1083,7 +1083,7 @@ namespace mongo {
}
}
else {
- auto_ptr<MatchExpression> autoRoot;
+ unique_ptr<MatchExpression> autoRoot;
if (!inArrayOperator) {
autoRoot.reset(root);
}
diff --git a/src/mongo/db/query/planner_access.h b/src/mongo/db/query/planner_access.h
index 80dba39264c..433e2259bb6 100644
--- a/src/mongo/db/query/planner_access.h
+++ b/src/mongo/db/query/planner_access.h
@@ -107,12 +107,12 @@ namespace mongo {
: root(theRoot),
inArrayOperator(inArrayOp),
indices(indexList),
- currentScan(NULL),
+ currentScan(nullptr),
curChild(0),
currentIndexNumber(IndexTag::kNoIndex),
ixtag(NULL),
tightness(IndexBoundsBuilder::INEXACT_FETCH),
- curOr(NULL),
+ curOr(nullptr),
loosestBounds(IndexBoundsBuilder::EXACT) {
}
@@ -144,7 +144,7 @@ namespace mongo {
// The index access node that we are currently constructing. We may merge
// multiple tagged predicates into a single index scan.
- std::auto_ptr<QuerySolutionNode> currentScan;
+ std::unique_ptr<QuerySolutionNode> currentScan;
// An index into the child vector of 'root'. Indicates the child MatchExpression
// for which we are currently either constructing a new scan or which we are about
@@ -165,8 +165,8 @@ namespace mongo {
// If 'root' is an $or, the child predicates which are tagged with the same index are
// detached from the original root and added here. 'curOr' may be attached as a filter
- // later on, or ignored and cleaned up by the auto_ptr.
- std::auto_ptr<MatchExpression> curOr;
+ // later on, or ignored and cleaned up by the unique_ptr.
+ std::unique_ptr<MatchExpression> curOr;
// The values of BoundsTightness range from loosest to tightest in this order:
//
diff --git a/src/mongo/db/query/planner_analysis.cpp b/src/mongo/db/query/planner_analysis.cpp
index ef9d8abaadc..f8d1fb3ce3a 100644
--- a/src/mongo/db/query/planner_analysis.cpp
+++ b/src/mongo/db/query/planner_analysis.cpp
@@ -39,7 +39,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::string;
using std::vector;
@@ -536,7 +536,7 @@ namespace mongo {
QuerySolution* QueryPlannerAnalysis::analyzeDataAccess(const CanonicalQuery& query,
const QueryPlannerParams& params,
QuerySolutionNode* solnRoot) {
- auto_ptr<QuerySolution> soln(new QuerySolution());
+ unique_ptr<QuerySolution> soln(new QuerySolution());
soln->filterData = query.getQueryObj();
soln->indexFilterApplied = params.indexFiltersApplied;
diff --git a/src/mongo/db/query/planner_ixselect_test.cpp b/src/mongo/db/query/planner_ixselect_test.cpp
index 041167771e8..ba1f11e93d0 100644
--- a/src/mongo/db/query/planner_ixselect_test.cpp
+++ b/src/mongo/db/query/planner_ixselect_test.cpp
@@ -43,7 +43,7 @@ using namespace mongo;
namespace {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
using std::vector;
@@ -81,7 +81,7 @@ namespace {
*/
void testGetFields(const char* query, const char* prefix, const char* expectedFieldsStr) {
BSONObj obj = fromjson(query);
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
unordered_set<string> fields;
QueryPlannerIXSelect::getFields(expr.get(), prefix, &fields);
@@ -186,7 +186,7 @@ namespace {
// Parse and rate query. Some of the nodes in the rated tree
// will be tagged after the rating process.
BSONObj obj = fromjson(query);
- auto_ptr<MatchExpression> expr(parseMatchExpression(obj));
+ unique_ptr<MatchExpression> expr(parseMatchExpression(obj));
// Currently, we tag every indexable node even when no compatible
// index is available. Hence, it is fine to pass an empty vector of
diff --git a/src/mongo/db/query/query_planner.cpp b/src/mongo/db/query/query_planner.cpp
index 43ada571f37..4cdcbff54a3 100644
--- a/src/mongo/db/query/query_planner.cpp
+++ b/src/mongo/db/query/query_planner.cpp
@@ -49,7 +49,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::numeric_limits;
// Copied verbatim from db/index.h
@@ -250,7 +250,7 @@ namespace mongo {
return Status(ErrorCodes::BadValue, "Cannot produce cache data: tree is NULL.");
}
- auto_ptr<PlanCacheIndexTree> indexTree(new PlanCacheIndexTree());
+ unique_ptr<PlanCacheIndexTree> indexTree(new PlanCacheIndexTree());
if (NULL != taggedTree->getTag()) {
IndexTag* itag = static_cast<IndexTag*>(taggedTree->getTag());
@@ -758,7 +758,7 @@ namespace mongo {
if (!indexTreeStatus.isOK()) {
LOG(5) << "Query is not cachable: " << indexTreeStatus.reason() << endl;
}
- auto_ptr<PlanCacheIndexTree> autoData(cacheData);
+ unique_ptr<PlanCacheIndexTree> autoData(cacheData);
// This can fail if enumeration makes a mistake.
QuerySolutionNode* solnRoot =
diff --git a/src/mongo/db/query/stage_builder.cpp b/src/mongo/db/query/stage_builder.cpp
index f6c1b93da09..0268fe02277 100644
--- a/src/mongo/db/query/stage_builder.cpp
+++ b/src/mongo/db/query/stage_builder.cpp
@@ -55,7 +55,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
PlanStage* buildStages(OperationContext* txn,
Collection* collection,
@@ -152,7 +152,7 @@ namespace mongo {
}
else if (STAGE_AND_HASH == root->getType()) {
const AndHashNode* ahn = static_cast<const AndHashNode*>(root);
- auto_ptr<AndHashStage> ret(new AndHashStage(ws, ahn->filter.get(), collection));
+ unique_ptr<AndHashStage> ret(new AndHashStage(ws, ahn->filter.get(), collection));
for (size_t i = 0; i < ahn->children.size(); ++i) {
PlanStage* childStage = buildStages(txn, collection, qsol, ahn->children[i], ws);
if (NULL == childStage) { return NULL; }
@@ -162,7 +162,7 @@ namespace mongo {
}
else if (STAGE_OR == root->getType()) {
const OrNode * orn = static_cast<const OrNode*>(root);
- auto_ptr<OrStage> ret(new OrStage(ws, orn->dedup, orn->filter.get()));
+ unique_ptr<OrStage> ret(new OrStage(ws, orn->dedup, orn->filter.get()));
for (size_t i = 0; i < orn->children.size(); ++i) {
PlanStage* childStage = buildStages(txn, collection, qsol, orn->children[i], ws);
if (NULL == childStage) { return NULL; }
@@ -172,7 +172,7 @@ namespace mongo {
}
else if (STAGE_AND_SORTED == root->getType()) {
const AndSortedNode* asn = static_cast<const AndSortedNode*>(root);
- auto_ptr<AndSortedStage> ret(new AndSortedStage(ws, asn->filter.get(), collection));
+ unique_ptr<AndSortedStage> ret(new AndSortedStage(ws, asn->filter.get(), collection));
for (size_t i = 0; i < asn->children.size(); ++i) {
PlanStage* childStage = buildStages(txn, collection, qsol, asn->children[i], ws);
if (NULL == childStage) { return NULL; }
@@ -185,7 +185,7 @@ namespace mongo {
MergeSortStageParams params;
params.dedup = msn->dedup;
params.pattern = msn->sort;
- auto_ptr<MergeSortStage> ret(new MergeSortStage(params, ws, collection));
+ unique_ptr<MergeSortStage> ret(new MergeSortStage(params, ws, collection));
for (size_t i = 0; i < msn->children.size(); ++i) {
PlanStage* childStage = buildStages(txn, collection, qsol, msn->children[i], ws);
if (NULL == childStage) { return NULL; }
diff --git a/src/mongo/db/range_deleter.cpp b/src/mongo/db/range_deleter.cpp
index 6eefd436274..75b1a9c38a7 100644
--- a/src/mongo/db/range_deleter.cpp
+++ b/src/mongo/db/range_deleter.cpp
@@ -46,7 +46,7 @@
#include "mongo/util/time_support.h"
#include "mongo/util/timer.h"
-using std::auto_ptr;
+using std::unique_ptr;
using std::endl;
using std::set;
using std::pair;
@@ -224,7 +224,7 @@ namespace mongo {
const BSONObj& min(options.range.minKey);
const BSONObj& max(options.range.maxKey);
- auto_ptr<RangeDeleteEntry> toDelete(
+ unique_ptr<RangeDeleteEntry> toDelete(
new RangeDeleteEntry(options));
toDelete->notifyDone = notifyDone;
diff --git a/src/mongo/db/repl/master_slave.cpp b/src/mongo/db/repl/master_slave.cpp
index fde2c24232c..2f269b625c5 100644
--- a/src/mongo/db/repl/master_slave.cpp
+++ b/src/mongo/db/repl/master_slave.cpp
@@ -74,7 +74,7 @@
#include "mongo/util/log.h"
using boost::scoped_ptr;
-using std::auto_ptr;
+using std::unique_ptr;
using std::cout;
using std::endl;
using std::max;
@@ -269,7 +269,7 @@ namespace repl {
// check that no items are in sources other than that
// add if missing
int n = 0;
- auto_ptr<PlanExecutor> exec(
+ unique_ptr<PlanExecutor> exec(
InternalPlanner::collectionScan(txn,
localSources,
ctx.db()->getCollection(localSources)));
@@ -314,7 +314,7 @@ namespace repl {
}
}
- auto_ptr<PlanExecutor> exec(
+ unique_ptr<PlanExecutor> exec(
InternalPlanner::collectionScan(txn,
localSources,
ctx.db()->getCollection(localSources)));
diff --git a/src/mongo/db/repl/repl_set_heartbeat_response_test.cpp b/src/mongo/db/repl/repl_set_heartbeat_response_test.cpp
index 8d53dffc062..49f9ed1e06d 100644
--- a/src/mongo/db/repl/repl_set_heartbeat_response_test.cpp
+++ b/src/mongo/db/repl/repl_set_heartbeat_response_test.cpp
@@ -39,7 +39,7 @@ namespace repl {
namespace {
using boost::scoped_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
bool stringContains(const std::string &haystack, const std::string& needle) {
return haystack.find(needle) != std::string::npos;
diff --git a/src/mongo/db/repl/replication_info.cpp b/src/mongo/db/repl/replication_info.cpp
index b33d03d7bf3..6d75a351957 100644
--- a/src/mongo/db/repl/replication_info.cpp
+++ b/src/mongo/db/repl/replication_info.cpp
@@ -51,7 +51,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::list;
using std::string;
using std::stringstream;
@@ -89,7 +89,7 @@ namespace repl {
{
const char* localSources = "local.sources";
AutoGetCollectionForRead ctx(txn, localSources);
- auto_ptr<PlanExecutor> exec(
+ unique_ptr<PlanExecutor> exec(
InternalPlanner::collectionScan(txn, localSources, ctx.getCollection()));
BSONObj obj;
PlanExecutor::ExecState state;
diff --git a/src/mongo/db/repl/rs_rollback.cpp b/src/mongo/db/repl/rs_rollback.cpp
index 395aefd4d5a..437e01f1011 100644
--- a/src/mongo/db/repl/rs_rollback.cpp
+++ b/src/mongo/db/repl/rs_rollback.cpp
@@ -104,7 +104,7 @@
namespace mongo {
using boost::shared_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::list;
using std::map;
diff --git a/src/mongo/db/restapi.cpp b/src/mongo/db/restapi.cpp
index f582bf33a3b..f977e3afeef 100644
--- a/src/mongo/db/restapi.cpp
+++ b/src/mongo/db/restapi.cpp
@@ -54,7 +54,7 @@ namespace mongo {
bool getInitialSyncCompleted();
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
using std::stringstream;
using std::endl;
@@ -179,7 +179,7 @@ namespace mongo {
BSONObj query = queryBuilder.obj();
DBDirectClient db(txn);
- auto_ptr<DBClientCursor> cursor = db.query( ns.c_str() , query, num , skip );
+ unique_ptr<DBClientCursor> cursor = db.query( ns.c_str() , query, num , skip );
uassert( 13085 , "query failed for dbwebserver" , cursor.get() );
if ( one ) {
diff --git a/src/mongo/db/stats/snapshots.cpp b/src/mongo/db/stats/snapshots.cpp
index 555c93917f0..d6ab900420f 100644
--- a/src/mongo/db/stats/snapshots.cpp
+++ b/src/mongo/db/stats/snapshots.cpp
@@ -45,7 +45,7 @@
*/
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
void SnapshotData::takeSnapshot() {
diff --git a/src/mongo/db/storage/mmap_v1/btree/btree_interface_test.cpp b/src/mongo/db/storage/mmap_v1/btree/btree_interface_test.cpp
index 48d9fe5319b..23f649bfcaa 100644
--- a/src/mongo/db/storage/mmap_v1/btree/btree_interface_test.cpp
+++ b/src/mongo/db/storage/mmap_v1/btree/btree_interface_test.cpp
@@ -35,7 +35,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
class MyHarnessHelper final : public HarnessHelper {
public:
diff --git a/src/mongo/db/storage/mmap_v1/btree/btree_logic.cpp b/src/mongo/db/storage/mmap_v1/btree/btree_logic.cpp
index 98f1d1497e9..1afe24331cf 100644
--- a/src/mongo/db/storage/mmap_v1/btree/btree_logic.cpp
+++ b/src/mongo/db/storage/mmap_v1/btree/btree_logic.cpp
@@ -42,7 +42,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::dec;
using std::endl;
using std::hex;
@@ -114,7 +114,7 @@ namespace mongo {
template <class BtreeLayout>
Status BtreeLogic<BtreeLayout>::Builder::addKey(const BSONObj& keyObj, const DiskLoc& loc) {
- auto_ptr<KeyDataOwnedType> key(new KeyDataOwnedType(keyObj));
+ unique_ptr<KeyDataOwnedType> key(new KeyDataOwnedType(keyObj));
if (key->dataSize() > BtreeLayout::KeyMax) {
string msg = str::stream() << "Btree::insert: key too large to index, failing "
@@ -148,7 +148,7 @@ namespace mongo {
invariant(_logic->pushBack(rightLeaf, loc, *key, DiskLoc()));
}
- _keyLast = key;
+ _keyLast = std::move(key);
return Status::OK();
}
diff --git a/src/mongo/db/storage/mmap_v1/btree/btree_logic.h b/src/mongo/db/storage/mmap_v1/btree/btree_logic.h
index 5b4fdc8205e..48a307f3b4d 100644
--- a/src/mongo/db/storage/mmap_v1/btree/btree_logic.h
+++ b/src/mongo/db/storage/mmap_v1/btree/btree_logic.h
@@ -121,7 +121,7 @@ namespace mongo {
DiskLoc _rightLeafLoc; // DiskLoc of right-most (highest) leaf bucket.
bool _dupsAllowed;
- std::auto_ptr<KeyDataOwnedType> _keyLast;
+ std::unique_ptr<KeyDataOwnedType> _keyLast;
// Not owned.
OperationContext* _txn;
diff --git a/src/mongo/db/storage/mmap_v1/btree/btree_logic_test.cpp b/src/mongo/db/storage/mmap_v1/btree/btree_logic_test.cpp
index 87bfd0a03db..1c0bd1c1505 100644
--- a/src/mongo/db/storage/mmap_v1/btree/btree_logic_test.cpp
+++ b/src/mongo/db/storage/mmap_v1/btree/btree_logic_test.cpp
@@ -2128,7 +2128,7 @@ namespace mongo {
start.appendMinKey( "a" );
BSONObjBuilder end;
end.appendMaxKey( "a" );
- auto_ptr< BtreeCursor > c( BtreeCursor::make( nsdetails( ns() ),
+ unique_ptr< BtreeCursor > c( BtreeCursor::make( nsdetails( ns() ),
id(),
start.done(),
end.done(),
@@ -2193,7 +2193,7 @@ namespace mongo {
end.appendMaxKey( "a" );
BSONObj l = bt()->keyNode( 0 ).key.toBson();
string toInsert;
- auto_ptr< BtreeCursor > c( BtreeCursor::make( nsdetails( ns() ),
+ unique_ptr< BtreeCursor > c( BtreeCursor::make( nsdetails( ns() ),
id(),
start.done(),
end.done(),
diff --git a/src/mongo/db/storage/mmap_v1/dur_recover.cpp b/src/mongo/db/storage/mmap_v1/dur_recover.cpp
index b6d997d4025..5e61e39930f 100644
--- a/src/mongo/db/storage/mmap_v1/dur_recover.cpp
+++ b/src/mongo/db/storage/mmap_v1/dur_recover.cpp
@@ -59,7 +59,7 @@
namespace mongo {
using boost::shared_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::hex;
using std::map;
@@ -157,7 +157,7 @@ namespace mongo {
const char *p = _uncompressed.c_str();
verify(compressedLen == _h.sectionLen() - sizeof(JSectFooter) - sizeof(JSectHeader));
- _entries = auto_ptr<BufReader>(new BufReader(p, _uncompressed.size()));
+ _entries = unique_ptr<BufReader>(new BufReader(p, _uncompressed.size()));
}
// We work with the uncompressed buffer when doing a WRITETODATAFILES (for speed)
@@ -228,7 +228,7 @@ namespace mongo {
private:
- auto_ptr<BufReader> _entries;
+ unique_ptr<BufReader> _entries;
const JSectHeader _h;
const char *_lastDbName; // pointer into mmaped journal file
const bool _doDurOps;
@@ -412,12 +412,12 @@ namespace mongo {
return;
}
- auto_ptr<JournalSectionIterator> i;
+ unique_ptr<JournalSectionIterator> i;
if( _recovering ) {
- i = auto_ptr<JournalSectionIterator>(new JournalSectionIterator(*h, p, len, _recovering));
+ i = unique_ptr<JournalSectionIterator>(new JournalSectionIterator(*h, p, len, _recovering));
}
else {
- i = auto_ptr<JournalSectionIterator>(new JournalSectionIterator(*h, /*after header*/p, /*w/out header*/len));
+ i = unique_ptr<JournalSectionIterator>(new JournalSectionIterator(*h, /*after header*/p, /*w/out header*/len));
}
// we use a static so that we don't have to reallocate every time through. occasionally we
diff --git a/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.cpp b/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.cpp
index 5045d6a23da..2d9857ce64e 100644
--- a/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.cpp
+++ b/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.cpp
@@ -57,7 +57,7 @@
namespace mongo {
using boost::scoped_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
namespace {
@@ -735,7 +735,7 @@ namespace {
_getIndexRecordStore(),
this));
- auto_ptr<NamespaceDetailsRSV1MetaData> md(new NamespaceDetailsRSV1MetaData(ns, details));
+ unique_ptr<NamespaceDetailsRSV1MetaData> md(new NamespaceDetailsRSV1MetaData(ns, details));
const NamespaceString nss(ns);
if (details->isCapped) {
@@ -779,7 +779,7 @@ namespace {
RecordStoreV1Base* rs = _getRecordStore(entry->descriptor()->indexNamespace());
invariant(rs);
- std::auto_ptr<SortedDataInterface> btree(
+ std::unique_ptr<SortedDataInterface> btree(
getMMAPV1Interface(entry->headManager(),
rs,
&rs->savedCursors,
diff --git a/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp b/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp
index ebd298917c5..b783d92a76c 100644
--- a/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp
+++ b/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp
@@ -55,7 +55,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::max;
using std::string;
@@ -166,7 +166,7 @@ namespace mongo {
}
}
- auto_ptr<DataFile> df(new DataFile(n));
+ unique_ptr<DataFile> df(new DataFile(n));
Status s = df->openExisting(fullNameString.c_str());
if (!s.isOK()) {
@@ -235,7 +235,7 @@ namespace mongo {
}
{
- auto_ptr<DataFile> allocFile(new DataFile(allocFileId));
+ unique_ptr<DataFile> allocFile(new DataFile(allocFileId));
const string allocFileName = _fileName(allocFileId).string();
Timer t;
@@ -254,7 +254,7 @@ namespace mongo {
// Preallocate is asynchronous
if (preallocateNextFile) {
- auto_ptr<DataFile> nextFile(new DataFile(allocFileId + 1));
+ unique_ptr<DataFile> nextFile(new DataFile(allocFileId + 1));
const string nextFileName = _fileName(allocFileId + 1).string();
nextFile->open(txn, nextFileName.c_str(), minSize, false);