summaryrefslogtreecommitdiff
path: root/src
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
parent0ec1e625760eb9c1a20a3dba78200e8f9ff28d9e (diff)
downloadmongo-a9b6612f5322f916298c19a6728817a1034c6aab.tar.gz
SERVER-17309 Replace std::auto_ptr<T> with std::unique_ptr<T>
Diffstat (limited to 'src')
-rw-r--r--src/mongo/base/owned_pointer_vector.h2
-rw-r--r--src/mongo/bson/bsonmisc.h2
-rw-r--r--src/mongo/client/connection_pool.cpp2
-rw-r--r--src/mongo/client/dbclient.cpp30
-rw-r--r--src/mongo/client/dbclient_rs.cpp12
-rw-r--r--src/mongo/client/dbclient_rs.h6
-rw-r--r--src/mongo/client/dbclient_rs_test.cpp44
-rw-r--r--src/mongo/client/dbclientcursor.cpp12
-rw-r--r--src/mongo/client/dbclientcursor.h2
-rw-r--r--src/mongo/client/dbclientinterface.h10
-rw-r--r--src/mongo/client/parallel.h4
-rw-r--r--src/mongo/client/sasl_sspi.cpp2
-rw-r--r--src/mongo/client/syncclusterconnection.cpp14
-rw-r--r--src/mongo/client/syncclusterconnection.h10
-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
-rw-r--r--src/mongo/dbtests/clienttests.cpp6
-rw-r--r--src/mongo/dbtests/dbhelper_tests.cpp4
-rw-r--r--src/mongo/dbtests/directclienttests.cpp6
-rw-r--r--src/mongo/dbtests/executor_registry.cpp18
-rw-r--r--src/mongo/dbtests/jstests.cpp20
-rw-r--r--src/mongo/dbtests/mock/mock_dbclient_connection.cpp6
-rw-r--r--src/mongo/dbtests/mock/mock_dbclient_connection.h2
-rw-r--r--src/mongo/dbtests/mock_dbclient_conn_test.cpp32
-rw-r--r--src/mongo/dbtests/namespacetests.cpp8
-rw-r--r--src/mongo/dbtests/query_multi_plan_runner.cpp12
-rw-r--r--src/mongo/dbtests/query_plan_executor.cpp14
-rw-r--r--src/mongo/dbtests/query_stage_and.cpp6
-rw-r--r--src/mongo/dbtests/query_stage_collscan.cpp4
-rw-r--r--src/mongo/dbtests/query_stage_count.cpp6
-rw-r--r--src/mongo/dbtests/query_stage_fetch.cpp12
-rw-r--r--src/mongo/dbtests/query_stage_ixscan.cpp2
-rw-r--r--src/mongo/dbtests/query_stage_keep.cpp4
-rw-r--r--src/mongo/dbtests/query_stage_limit_skip.cpp4
-rw-r--r--src/mongo/dbtests/query_stage_merge_sort.cpp4
-rw-r--r--src/mongo/dbtests/query_stage_sort.cpp12
-rw-r--r--src/mongo/dbtests/query_stage_tests.cpp4
-rw-r--r--src/mongo/dbtests/query_stage_update.cpp6
-rw-r--r--src/mongo/dbtests/querytests.cpp58
-rw-r--r--src/mongo/dbtests/repltests.cpp6
-rw-r--r--src/mongo/dbtests/sharding.cpp4
-rw-r--r--src/mongo/dbtests/threadedtests.cpp6
-rw-r--r--src/mongo/dbtests/updatetests.cpp4
-rw-r--r--src/mongo/logger/log_domain.h4
-rw-r--r--src/mongo/logger/log_test.cpp2
-rw-r--r--src/mongo/logger/rotatable_file_manager.cpp2
-rw-r--r--src/mongo/s/balance.cpp2
-rw-r--r--src/mongo/s/catalog/catalog_manager.cpp14
-rw-r--r--src/mongo/s/catalog/legacy/cluster_client_internal.cpp4
-rw-r--r--src/mongo/s/catalog/legacy/cluster_client_internal.h2
-rw-r--r--src/mongo/s/catalog/legacy/config_upgrade_helpers.cpp2
-rw-r--r--src/mongo/s/catalog/legacy/distlock.cpp2
-rw-r--r--src/mongo/s/chunk.cpp4
-rw-r--r--src/mongo/s/chunk_manager_targeter_test.cpp10
-rw-r--r--src/mongo/s/client/scc_fast_query_handler.cpp8
-rw-r--r--src/mongo/s/client/scc_fast_query_handler.h2
-rw-r--r--src/mongo/s/client/shard_connection.cpp4
-rw-r--r--src/mongo/s/cluster_write.cpp6
-rw-r--r--src/mongo/s/collection_metadata.cpp14
-rw-r--r--src/mongo/s/collection_metadata_test.cpp2
-rw-r--r--src/mongo/s/commands/cluster_find_cmd.cpp4
-rw-r--r--src/mongo/s/commands/cluster_pipeline_cmd.cpp12
-rw-r--r--src/mongo/s/config.cpp4
-rw-r--r--src/mongo/s/d_split.cpp10
-rw-r--r--src/mongo/s/metadata_loader.cpp2
-rw-r--r--src/mongo/s/metadata_loader_test.cpp10
-rw-r--r--src/mongo/s/shard_key_pattern.cpp2
-rw-r--r--src/mongo/s/write_ops/batch_downconvert.h4
-rw-r--r--src/mongo/s/write_ops/batch_upconvert.cpp4
-rw-r--r--src/mongo/s/write_ops/batch_write_exec.h2
-rw-r--r--src/mongo/s/write_ops/batch_write_op.cpp8
-rw-r--r--src/mongo/s/write_ops/batch_write_op_test.cpp6
-rw-r--r--src/mongo/s/write_ops/batched_command_request.cpp4
-rw-r--r--src/mongo/s/write_ops/batched_command_response.cpp6
-rw-r--r--src/mongo/s/write_ops/batched_delete_request.cpp6
-rw-r--r--src/mongo/s/write_ops/batched_insert_request_test.cpp8
-rw-r--r--src/mongo/s/write_ops/batched_request_metadata.cpp4
-rw-r--r--src/mongo/s/write_ops/batched_update_request.cpp6
-rw-r--r--src/mongo/scripting/engine.cpp8
-rw-r--r--src/mongo/scripting/engine.h2
-rw-r--r--src/mongo/shell/bench.cpp6
-rw-r--r--src/mongo/shell/dbshell.cpp2
-rw-r--r--src/mongo/tools/bridge.cpp2
-rw-r--r--src/mongo/util/net/message_server_port.cpp2
-rw-r--r--src/mongo/util/options_parser/option_section.cpp22
195 files changed, 851 insertions, 851 deletions
diff --git a/src/mongo/base/owned_pointer_vector.h b/src/mongo/base/owned_pointer_vector.h
index fb5ddc09554..167401824de 100644
--- a/src/mongo/base/owned_pointer_vector.h
+++ b/src/mongo/base/owned_pointer_vector.h
@@ -112,7 +112,7 @@ namespace mongo {
* Releases the entire vector to allow you to transfer ownership.
*
* Leaves the OwnedPointerVector empty.
- * Named after the similar method and pattern in std::auto_ptr.
+ * Named after the similar method and pattern in std::unique_ptr.
*/
std::vector<T*> release() {
std::vector<T*> out;
diff --git a/src/mongo/bson/bsonmisc.h b/src/mongo/bson/bsonmisc.h
index 483528d80e0..0c0ea6cdb80 100644
--- a/src/mongo/bson/bsonmisc.h
+++ b/src/mongo/bson/bsonmisc.h
@@ -241,7 +241,7 @@ namespace mongo {
bool haveSubobj() const { return _subobj.get() != 0; }
BSONObjBuilder *subobj();
- std::auto_ptr< BSONObjBuilder > _subobj;
+ std::unique_ptr< BSONObjBuilder > _subobj;
};
/**
diff --git a/src/mongo/client/connection_pool.cpp b/src/mongo/client/connection_pool.cpp
index ed994b25c33..b7ebda533aa 100644
--- a/src/mongo/client/connection_pool.cpp
+++ b/src/mongo/client/connection_pool.cpp
@@ -169,7 +169,7 @@ namespace {
// No idle connection in the pool; make a new one.
lk.unlock();
- std::auto_ptr<DBClientConnection> conn(new DBClientConnection);
+ std::unique_ptr<DBClientConnection> conn(new DBClientConnection);
// setSoTimeout takes a double representing the number of seconds for send and receive
// timeouts. Thus, we must take count() and divide by 1000.0 to get the number
diff --git a/src/mongo/client/dbclient.cpp b/src/mongo/client/dbclient.cpp
index cee1c7c92ea..aa7a6e73032 100644
--- a/src/mongo/client/dbclient.cpp
+++ b/src/mongo/client/dbclient.cpp
@@ -62,7 +62,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::list;
using std::map;
@@ -795,7 +795,7 @@ namespace {
if ( id != 0 ) {
const std::string ns = cursorObj["ns"].String();
- auto_ptr<DBClientCursor> cursor = getMore(ns, id, 0, 0);
+ unique_ptr<DBClientCursor> cursor = getMore(ns, id, 0, 0);
while ( cursor->more() ) {
infos.push_back(cursor->nextSafe().getOwned());
}
@@ -826,7 +826,7 @@ namespace {
fallbackFilter.appendElementsUnique( filter );
string ns = db + ".system.namespaces";
- auto_ptr<DBClientCursor> c = query(
+ unique_ptr<DBClientCursor> c = query(
ns.c_str(), fallbackFilter.obj(), 0, 0, 0, QueryOption_SlaveOk);
uassert(28611, str::stream() << "listCollections failed querying " << ns, c.get());
@@ -870,7 +870,7 @@ namespace {
void DBClientInterface::findN(vector<BSONObj>& out, const string& ns, Query query, int nToReturn, int nToSkip, const BSONObj *fieldsToReturn, int queryOptions) {
out.reserve(nToReturn);
- auto_ptr<DBClientCursor> c =
+ unique_ptr<DBClientCursor> c =
this->query(ns, query, nToReturn, nToSkip, fieldsToReturn, queryOptions);
uassert( 10276 , str::stream() << "DBClientBase::findN: transport error: " << getServerAddress() << " ns: " << ns << " query: " << query.toString(), c.get() );
@@ -906,7 +906,7 @@ namespace {
// we keep around SockAddr for connection life -- maybe MessagingPort
// requires that?
- std::auto_ptr<SockAddr> serverSockAddr(new SockAddr(_server.host().c_str(),
+ std::unique_ptr<SockAddr> serverSockAddr(new SockAddr(_server.host().c_str(),
_server.port()));
if (!serverSockAddr->isValid()) {
errmsg = str::stream() << "couldn't initialize connection to host "
@@ -1024,21 +1024,21 @@ namespace {
const uint64_t DBClientBase::INVALID_SOCK_CREATION_TIME =
static_cast<uint64_t>(0xFFFFFFFFFFFFFFFFULL);
- auto_ptr<DBClientCursor> DBClientBase::query(const string &ns, Query query, int nToReturn,
+ unique_ptr<DBClientCursor> DBClientBase::query(const string &ns, Query query, int nToReturn,
int nToSkip, const BSONObj *fieldsToReturn, int queryOptions , int batchSize ) {
- auto_ptr<DBClientCursor> c( new DBClientCursor( this,
+ unique_ptr<DBClientCursor> c( new DBClientCursor( this,
ns, query.obj, nToReturn, nToSkip,
fieldsToReturn, queryOptions , batchSize ) );
if ( c->init() )
return c;
- return auto_ptr< DBClientCursor >( 0 );
+ return nullptr;
}
- auto_ptr<DBClientCursor> DBClientBase::getMore( const string &ns, long long cursorId, int nToReturn, int options ) {
- auto_ptr<DBClientCursor> c( new DBClientCursor( this, ns, cursorId, nToReturn, options ) );
+ unique_ptr<DBClientCursor> DBClientBase::getMore( const string &ns, long long cursorId, int nToReturn, int options ) {
+ unique_ptr<DBClientCursor> c( new DBClientCursor( this, ns, cursorId, nToReturn, options ) );
if ( c->init() )
return c;
- return auto_ptr< DBClientCursor >( 0 );
+ return nullptr;
}
struct DBClientFunConvertor {
@@ -1067,7 +1067,7 @@ namespace {
// mask options
queryOptions &= (int)( QueryOption_NoCursorTimeout | QueryOption_SlaveOk );
- auto_ptr<DBClientCursor> c( this->query(ns, query, 0, 0, fieldsToReturn, queryOptions) );
+ unique_ptr<DBClientCursor> c( this->query(ns, query, 0, 0, fieldsToReturn, queryOptions) );
uassert( 16090, "socket error for mapping query", c.get() );
unsigned long long n = 0;
@@ -1095,7 +1095,7 @@ namespace {
queryOptions &= (int)( QueryOption_NoCursorTimeout | QueryOption_SlaveOk );
queryOptions |= (int)QueryOption_Exhaust;
- auto_ptr<DBClientCursor> c( this->query(ns, query, 0, 0, fieldsToReturn, queryOptions) );
+ unique_ptr<DBClientCursor> c( this->query(ns, query, 0, 0, fieldsToReturn, queryOptions) );
uassert( 13386, "socket error for mapping query", c.get() );
unsigned long long n = 0;
@@ -1250,7 +1250,7 @@ namespace {
if ( id != 0 ) {
const std::string ns = cursorObj["ns"].String();
- auto_ptr<DBClientCursor> cursor = getMore(ns, id, 0, 0);
+ unique_ptr<DBClientCursor> cursor = getMore(ns, id, 0, 0);
while ( cursor->more() ) {
specs.push_back(cursor->nextSafe().getOwned());
}
@@ -1274,7 +1274,7 @@ namespace {
// fallback to querying system.indexes
// TODO(spencer): Remove fallback behavior after 3.0
- auto_ptr<DBClientCursor> cursor = query(NamespaceString(ns).getSystemIndexesCollection(),
+ unique_ptr<DBClientCursor> cursor = query(NamespaceString(ns).getSystemIndexesCollection(),
BSON("ns" << ns), 0, 0, 0, options);
uassert(28612, str::stream() << "listIndexes failed querying " << ns, cursor.get());
diff --git a/src/mongo/client/dbclient_rs.cpp b/src/mongo/client/dbclient_rs.cpp
index 07884da5313..a344f8d3fb8 100644
--- a/src/mongo/client/dbclient_rs.cpp
+++ b/src/mongo/client/dbclient_rs.cpp
@@ -47,7 +47,7 @@
namespace mongo {
using boost::shared_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::map;
using std::set;
@@ -261,7 +261,7 @@ namespace {
bool DBClientReplicaSet::isSecondaryQuery( const string& ns,
const BSONObj& queryObj,
int queryOptions ) {
- auto_ptr<ReadPreferenceSetting> readPref( _extractReadPref( queryObj, queryOptions ) );
+ unique_ptr<ReadPreferenceSetting> readPref( _extractReadPref( queryObj, queryOptions ) );
return _isSecondaryQuery( ns, queryObj, *readPref );
}
@@ -491,7 +491,7 @@ namespace {
return checkMaster()->update( ns, query, obj, flags );
}
- auto_ptr<DBClientCursor> DBClientReplicaSet::query(const string &ns,
+ unique_ptr<DBClientCursor> DBClientReplicaSet::query(const string &ns,
Query query,
int nToReturn,
int nToSkip,
@@ -521,11 +521,11 @@ namespace {
break;
}
- auto_ptr<DBClientCursor> cursor = conn->query(ns, query,
+ unique_ptr<DBClientCursor> cursor = conn->query(ns, query,
nToReturn, nToSkip, fieldsToReturn, queryOptions,
batchSize);
- return checkSlaveQueryResult(cursor);
+ return checkSlaveQueryResult(std::move(cursor));
}
catch (const DBException &dbExcep) {
StringBuilder errMsgBuilder;
@@ -629,7 +629,7 @@ namespace {
resetMaster();
}
- auto_ptr<DBClientCursor> DBClientReplicaSet::checkSlaveQueryResult( auto_ptr<DBClientCursor> result ){
+ unique_ptr<DBClientCursor> DBClientReplicaSet::checkSlaveQueryResult( unique_ptr<DBClientCursor> result ){
if ( result.get() == NULL ) return result;
BSONObj error;
diff --git a/src/mongo/client/dbclient_rs.h b/src/mongo/client/dbclient_rs.h
index 8b85e1664c2..ac32ccd4964 100644
--- a/src/mongo/client/dbclient_rs.h
+++ b/src/mongo/client/dbclient_rs.h
@@ -80,7 +80,7 @@ namespace mongo {
// ----------- simple functions --------------
/** throws userassertion "no master found" */
- virtual std::auto_ptr<DBClientCursor> query(const std::string &ns, Query query, int nToReturn = 0, int nToSkip = 0,
+ virtual std::unique_ptr<DBClientCursor> query(const std::string &ns, Query query, int nToReturn = 0, int nToSkip = 0,
const BSONObj *fieldsToReturn = 0, int queryOptions = 0 , int batchSize = 0 );
/** throws userassertion "no master found" */
@@ -207,7 +207,7 @@ namespace mongo {
* @throws DBException if the directed node cannot accept the query because it
* is not a master
*/
- std::auto_ptr<DBClientCursor> checkSlaveQueryResult( std::auto_ptr<DBClientCursor> result );
+ std::unique_ptr<DBClientCursor> checkSlaveQueryResult( std::unique_ptr<DBClientCursor> result );
DBClientConnection * checkMaster();
@@ -277,7 +277,7 @@ namespace mongo {
// Connection can either be owned here or returned to the connection pool. Note that
// if connection is primary, it is owned by _master so it is incorrect to return
// it to the pool.
- std::auto_ptr<DBClientConnection> _lastSlaveOkConn;
+ std::unique_ptr<DBClientConnection> _lastSlaveOkConn;
boost::shared_ptr<ReadPreferenceSetting> _lastReadPref;
double _so_timeout;
diff --git a/src/mongo/client/dbclient_rs_test.cpp b/src/mongo/client/dbclient_rs_test.cpp
index 03dce3cb711..34abf413d5b 100644
--- a/src/mongo/client/dbclient_rs_test.cpp
+++ b/src/mongo/client/dbclient_rs_test.cpp
@@ -49,7 +49,7 @@
namespace {
using boost::scoped_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::map;
using std::make_pair;
using std::pair;
@@ -109,7 +109,7 @@ namespace {
query.readPref(mongo::ReadPreference::PrimaryOnly, BSONArray());
// Note: IdentityNS contains the name of the server.
- auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
+ unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
BSONObj doc = cursor->next();
ASSERT_EQUALS(replSet->getPrimary(), doc[HostField.name()].str());
}
@@ -122,7 +122,7 @@ namespace {
query.readPref(mongo::ReadPreference::SecondaryOnly, BSONArray());
// Note: IdentityNS contains the name of the server.
- auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
+ unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
BSONObj doc = cursor->next();
ASSERT_EQUALS(replSet->getSecondaries().front(), doc[HostField.name()].str());
}
@@ -138,7 +138,7 @@ namespace {
query.readPref(mongo::ReadPreference::PrimaryPreferred, BSONArray());
// Note: IdentityNS contains the name of the server.
- auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
+ unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
BSONObj doc = cursor->next();
ASSERT_EQUALS(replSet->getPrimary(), doc[HostField.name()].str());
}
@@ -154,7 +154,7 @@ namespace {
query.readPref(mongo::ReadPreference::SecondaryPreferred, BSONArray());
// Note: IdentityNS contains the name of the server.
- auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
+ unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
BSONObj doc = cursor->next();
ASSERT_EQUALS(replSet->getSecondaries().front(), doc[HostField.name()].str());
}
@@ -282,7 +282,7 @@ namespace {
query.readPref(mongo::ReadPreference::SecondaryOnly, BSONArray());
// Note: IdentityNS contains the name of the server.
- auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
+ unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
BSONObj doc = cursor->next();
ASSERT_EQUALS(replSet->getSecondaries().front(), doc[HostField.name()].str());
}
@@ -295,7 +295,7 @@ namespace {
query.readPref(mongo::ReadPreference::PrimaryPreferred, BSONArray());
// Note: IdentityNS contains the name of the server.
- auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
+ unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
BSONObj doc = cursor->next();
ASSERT_EQUALS(replSet->getSecondaries().front(), doc[HostField.name()].str());
}
@@ -308,7 +308,7 @@ namespace {
query.readPref(mongo::ReadPreference::SecondaryPreferred, BSONArray());
// Note: IdentityNS contains the name of the server.
- auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
+ unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
BSONObj doc = cursor->next();
ASSERT_EQUALS(replSet->getSecondaries().front(), doc[HostField.name()].str());
}
@@ -319,7 +319,7 @@ namespace {
Query query;
query.readPref(mongo::ReadPreference::Nearest, BSONArray());
- auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
+ unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
BSONObj doc = cursor->next();
ASSERT_EQUALS(replSet->getSecondaries().front(), doc[HostField.name()].str());
}
@@ -361,7 +361,7 @@ namespace {
query.readPref(mongo::ReadPreference::PrimaryOnly, BSONArray());
// Note: IdentityNS contains the name of the server.
- auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
+ unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
BSONObj doc = cursor->next();
ASSERT_EQUALS(replSet->getPrimary(), doc[HostField.name()].str());
}
@@ -383,7 +383,7 @@ namespace {
query.readPref(mongo::ReadPreference::PrimaryPreferred, BSONArray());
// Note: IdentityNS contains the name of the server.
- auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
+ unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
BSONObj doc = cursor->next();
ASSERT_EQUALS(replSet->getPrimary(), doc[HostField.name()].str());
}
@@ -396,7 +396,7 @@ namespace {
query.readPref(mongo::ReadPreference::SecondaryPreferred, BSONArray());
// Note: IdentityNS contains the name of the server.
- auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
+ unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
BSONObj doc = cursor->next();
ASSERT_EQUALS(replSet->getPrimary(), doc[HostField.name()].str());
}
@@ -409,7 +409,7 @@ namespace {
query.readPref(mongo::ReadPreference::Nearest, BSONArray());
// Note: IdentityNS contains the name of the server.
- auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
+ unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
BSONObj doc = cursor->next();
ASSERT_EQUALS(replSet->getPrimary(), doc[HostField.name()].str());
}
@@ -544,7 +544,7 @@ namespace {
query.readPref(mongo::ReadPreference::PrimaryPreferred, BSONArray());
// Note: IdentityNS contains the name of the server.
- auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
+ unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
BSONObj doc = cursor->next();
dest = doc[HostField.name()].str();
}
@@ -552,7 +552,7 @@ namespace {
{
Query query;
query.readPref(mongo::ReadPreference::PrimaryPreferred, BSONArray());
- auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
+ unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
BSONObj doc = cursor->next();
const string newDest = doc[HostField.name()].str();
ASSERT_EQUALS(dest, newDest);
@@ -572,7 +572,7 @@ namespace {
query.readPref(mongo::ReadPreference::PrimaryPreferred, BSONArray());
// Note: IdentityNS contains the name of the server.
- auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
+ unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
BSONObj doc = cursor->next();
dest = doc[HostField.name()].str();
}
@@ -585,7 +585,7 @@ namespace {
{
Query query;
query.readPref(mongo::ReadPreference::PrimaryPreferred, BSONArray());
- auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
+ unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
BSONObj doc = cursor->next();
const string newDest = doc[HostField.name()].str();
ASSERT_NOT_EQUALS(dest, newDest);
@@ -608,7 +608,7 @@ namespace {
query.readPref(mongo::ReadPreference::SecondaryPreferred, BSONArray());
// Note: IdentityNS contains the name of the server.
- auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
+ unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
BSONObj doc = cursor->next();
dest = doc[HostField.name()].str();
ASSERT_NOT_EQUALS(dest, replSet->getPrimary());
@@ -617,7 +617,7 @@ namespace {
{
Query query;
query.readPref(mongo::ReadPreference::SecondaryOnly, BSONArray());
- auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
+ unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
BSONObj doc = cursor->next();
const string newDest = doc[HostField.name()].str();
ASSERT_NOT_EQUALS(dest, newDest);
@@ -641,7 +641,7 @@ namespace {
BSON_ARRAY(BSON("dc" << "sf")));
// Note: IdentityNS contains the name of the server.
- auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
+ unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
BSONObj doc = cursor->next();
dest = doc[HostField.name()].str();
ASSERT_NOT_EQUALS(dest, replSet->getPrimary());
@@ -652,7 +652,7 @@ namespace {
vector<pair<string, string> > tagSet;
query.readPref(mongo::ReadPreference::SecondaryPreferred,
BSON_ARRAY(BSON("group" << 1)));
- auto_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
+ unique_ptr<DBClientCursor> cursor = replConn.query(IdentityNS, query);
BSONObj doc = cursor->next();
const string newDest = doc[HostField.name()].str();
ASSERT_NOT_EQUALS(dest, newDest);
@@ -675,7 +675,7 @@ namespace {
mongo::DBClientConnection& secConn = replConn.slaveConn();
// Note: IdentityNS contains the name of the server.
- auto_ptr<DBClientCursor> cursor = secConn.query(IdentityNS, Query());
+ unique_ptr<DBClientCursor> cursor = secConn.query(IdentityNS, Query());
BSONObj doc = cursor->next();
dest = doc[HostField.name()].str();
ASSERT_NOT_EQUALS(dest, replSet->getPrimary());
diff --git a/src/mongo/client/dbclientcursor.cpp b/src/mongo/client/dbclientcursor.cpp
index 94ed23d18d7..f0f4a5de653 100644
--- a/src/mongo/client/dbclientcursor.cpp
+++ b/src/mongo/client/dbclientcursor.cpp
@@ -43,7 +43,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::string;
using std::vector;
@@ -168,11 +168,11 @@ namespace mongo {
Message toSend;
toSend.setData(dbGetMore, b.buf(), b.len());
- auto_ptr<Message> response(new Message());
+ unique_ptr<Message> response(new Message());
if ( _client ) {
_client->call( toSend, *response );
- this->batch.m = response;
+ this->batch.m = std::move(response);
dataReceived();
}
else {
@@ -180,7 +180,7 @@ namespace mongo {
ScopedDbConnection conn(_scopedHost);
conn->call( toSend , *response );
_client = conn.get();
- this->batch.m = response;
+ this->batch.m = std::move(response);
dataReceived();
_client = 0;
conn.done();
@@ -191,12 +191,12 @@ namespace mongo {
void DBClientCursor::exhaustReceiveMore() {
verify( cursorId && batch.pos == batch.nReturned );
verify( !haveLimit );
- auto_ptr<Message> response(new Message());
+ unique_ptr<Message> response(new Message());
verify( _client );
if (!_client->recv(*response)) {
uasserted(16465, "recv failed while exhausting cursor");
}
- batch.m = response;
+ batch.m = std::move(response);
dataReceived();
}
diff --git a/src/mongo/client/dbclientcursor.h b/src/mongo/client/dbclientcursor.h
index 53bce3056dc..ae6fc33dfd6 100644
--- a/src/mongo/client/dbclientcursor.h
+++ b/src/mongo/client/dbclientcursor.h
@@ -206,7 +206,7 @@ namespace mongo {
class Batch : boost::noncopyable {
friend class DBClientCursor;
- std::auto_ptr<Message> m;
+ std::unique_ptr<Message> m;
int nReturned;
int pos;
const char *data;
diff --git a/src/mongo/client/dbclientinterface.h b/src/mongo/client/dbclientinterface.h
index e0361156d1d..0aae9081a13 100644
--- a/src/mongo/client/dbclientinterface.h
+++ b/src/mongo/client/dbclientinterface.h
@@ -373,7 +373,7 @@ namespace mongo {
*/
class DBClientInterface : boost::noncopyable {
public:
- virtual std::auto_ptr<DBClientCursor> query(const std::string &ns, Query query, int nToReturn = 0, int nToSkip = 0,
+ virtual std::unique_ptr<DBClientCursor> query(const std::string &ns, Query query, int nToReturn = 0, int nToSkip = 0,
const BSONObj *fieldsToReturn = 0, int queryOptions = 0 , int batchSize = 0 ) = 0;
virtual void insert( const std::string &ns, BSONObj obj , int flags=0) = 0;
@@ -407,7 +407,7 @@ namespace mongo {
virtual std::string getServerAddress() const = 0;
/** don't use this - called automatically by DBClientCursor for you */
- virtual std::auto_ptr<DBClientCursor> getMore( const std::string &ns, long long cursorId, int nToReturn = 0, int options = 0 ) = 0;
+ virtual std::unique_ptr<DBClientCursor> getMore( const std::string &ns, long long cursorId, int nToReturn = 0, int options = 0 ) = 0;
};
/**
@@ -900,7 +900,7 @@ namespace mongo {
@return cursor. 0 if error (connection failure)
@throws AssertionException
*/
- virtual std::auto_ptr<DBClientCursor> query(const std::string &ns, Query query, int nToReturn = 0, int nToSkip = 0,
+ virtual std::unique_ptr<DBClientCursor> query(const std::string &ns, Query query, int nToReturn = 0, int nToSkip = 0,
const BSONObj *fieldsToReturn = 0, int queryOptions = 0 , int batchSize = 0 );
@@ -930,7 +930,7 @@ namespace mongo {
@return an handle to a previously allocated cursor
@throws AssertionException
*/
- virtual std::auto_ptr<DBClientCursor> getMore( const std::string &ns, long long cursorId, int nToReturn = 0, int options = 0 );
+ virtual std::unique_ptr<DBClientCursor> getMore( const std::string &ns, long long cursorId, int nToReturn = 0, int options = 0 );
/**
insert an object into the database
@@ -1041,7 +1041,7 @@ namespace mongo {
*/
virtual void logout(const std::string& dbname, BSONObj& info);
- virtual std::auto_ptr<DBClientCursor> query(const std::string &ns, Query query=Query(), int nToReturn = 0, int nToSkip = 0,
+ virtual std::unique_ptr<DBClientCursor> query(const std::string &ns, Query query=Query(), int nToReturn = 0, int nToSkip = 0,
const BSONObj *fieldsToReturn = 0, int queryOptions = 0 , int batchSize = 0 ) {
checkConnection();
return DBClientBase::query( ns, query, nToReturn, nToSkip, fieldsToReturn, queryOptions , batchSize );
diff --git a/src/mongo/client/parallel.h b/src/mongo/client/parallel.h
index 241e591a166..d530dc88a04 100644
--- a/src/mongo/client/parallel.h
+++ b/src/mongo/client/parallel.h
@@ -284,8 +284,8 @@ namespace mongo {
private:
- std::auto_ptr<DBClientCursor> _cursor;
- std::auto_ptr<ParallelConnectionMetadata> _pcmData;
+ std::unique_ptr<DBClientCursor> _cursor;
+ std::unique_ptr<ParallelConnectionMetadata> _pcmData;
};
/**
diff --git a/src/mongo/client/sasl_sspi.cpp b/src/mongo/client/sasl_sspi.cpp
index af56a69c460..391530e20eb 100644
--- a/src/mongo/client/sasl_sspi.cpp
+++ b/src/mongo/client/sasl_sspi.cpp
@@ -182,7 +182,7 @@ namespace {
}
// Actually acquire the handle to the client credentials.
- std::auto_ptr<SspiConnContext> pcctx(new SspiConnContext());
+ std::unique_ptr<SspiConnContext> pcctx(new SspiConnContext());
pcctx->userPlusRealm = userPlusRealm;
TimeStamp ignored;
SECURITY_STATUS status = AcquireCredentialsHandleW(NULL, // principal
diff --git a/src/mongo/client/syncclusterconnection.cpp b/src/mongo/client/syncclusterconnection.cpp
index 79ed1abab23..792cd530e22 100644
--- a/src/mongo/client/syncclusterconnection.cpp
+++ b/src/mongo/client/syncclusterconnection.cpp
@@ -44,7 +44,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::list;
using std::map;
@@ -323,7 +323,7 @@ namespace mongo {
// TODO: logout is required for use of this class outside of a cluster environment
- auto_ptr<DBClientCursor> SyncClusterConnection::query(const string &ns, Query query, int nToReturn, int nToSkip,
+ unique_ptr<DBClientCursor> SyncClusterConnection::query(const string &ns, Query query, int nToReturn, int nToSkip,
const BSONObj *fieldsToReturn, int queryOptions, int batchSize ) {
_lastErrors.clear();
if ( ns.find( ".$cmd" ) != string::npos ) {
@@ -336,7 +336,7 @@ namespace mongo {
}
bool SyncClusterConnection::_commandOnActive(const string &dbname, const BSONObj& cmd, BSONObj &info, int options ) {
- auto_ptr<DBClientCursor> cursor = _queryOnActive(dbname + ".$cmd", cmd, 1, 0, 0, options, 0);
+ unique_ptr<DBClientCursor> cursor = _queryOnActive(dbname + ".$cmd", cmd, 1, 0, 0, options, 0);
if ( cursor->more() )
info = cursor->next().copy();
else
@@ -348,7 +348,7 @@ namespace mongo {
_customQueryHandler.reset( handler );
}
- auto_ptr<DBClientCursor> SyncClusterConnection::_queryOnActive(const string &ns, Query query, int nToReturn, int nToSkip,
+ unique_ptr<DBClientCursor> SyncClusterConnection::_queryOnActive(const string &ns, Query query, int nToReturn, int nToSkip,
const BSONObj *fieldsToReturn, int queryOptions, int batchSize ) {
if ( _customQueryHandler && _customQueryHandler->canHandleQuery( ns, query ) ) {
@@ -368,7 +368,7 @@ namespace mongo {
for ( size_t i=0; i<_conns.size(); i++ ) {
try {
- auto_ptr<DBClientCursor> cursor =
+ unique_ptr<DBClientCursor> cursor =
_conns[i]->query( ns , query , nToReturn , nToSkip , fieldsToReturn , queryOptions , batchSize );
if ( cursor.get() )
return cursor;
@@ -390,9 +390,9 @@ namespace mongo {
throw UserException( 8002 , str::stream() << "all servers down/unreachable when querying: " << _address );
}
- auto_ptr<DBClientCursor> SyncClusterConnection::getMore( const string &ns, long long cursorId, int nToReturn, int options ) {
+ unique_ptr<DBClientCursor> SyncClusterConnection::getMore( const string &ns, long long cursorId, int nToReturn, int options ) {
uassert( 10022 , "SyncClusterConnection::getMore not supported yet" , 0);
- auto_ptr<DBClientCursor> c;
+ unique_ptr<DBClientCursor> c;
return c;
}
diff --git a/src/mongo/client/syncclusterconnection.h b/src/mongo/client/syncclusterconnection.h
index 3e662bac845..b47d4cfe0eb 100644
--- a/src/mongo/client/syncclusterconnection.h
+++ b/src/mongo/client/syncclusterconnection.h
@@ -82,10 +82,10 @@ namespace mongo {
virtual BSONObj findOne(const std::string &ns, const Query& query, const BSONObj *fieldsToReturn, int queryOptions);
- virtual std::auto_ptr<DBClientCursor> query(const std::string &ns, Query query, int nToReturn, int nToSkip,
+ virtual std::unique_ptr<DBClientCursor> query(const std::string &ns, Query query, int nToReturn, int nToSkip,
const BSONObj *fieldsToReturn, int queryOptions, int batchSize );
- virtual std::auto_ptr<DBClientCursor> getMore( const std::string &ns, long long cursorId, int nToReturn, int options );
+ virtual std::unique_ptr<DBClientCursor> getMore( const std::string &ns, long long cursorId, int nToReturn, int options );
virtual void insert( const std::string &ns, BSONObj obj, int flags=0);
@@ -149,7 +149,7 @@ namespace mongo {
SyncClusterConnection( SyncClusterConnection& prev, double socketTimeout = 0 );
std::string _toString() const;
bool _commandOnActive(const std::string &dbname, const BSONObj& cmd, BSONObj &info, int options=0);
- std::auto_ptr<DBClientCursor> _queryOnActive(const std::string &ns, Query query, int nToReturn, int nToSkip,
+ std::unique_ptr<DBClientCursor> _queryOnActive(const std::string &ns, Query query, int nToReturn, int nToSkip,
const BSONObj *fieldsToReturn, int queryOptions, int batchSize );
int _lockType( const std::string& name );
void _checkLast();
@@ -187,9 +187,9 @@ namespace mongo {
/**
* Returns a cursor on one of the hosts with the desired results for the query.
- * May throw or return an empty auto_ptr on failure.
+ * May throw or return an empty unique_ptr on failure.
*/
- virtual std::auto_ptr<DBClientCursor> handleQuery( const std::vector<std::string>& hosts,
+ virtual std::unique_ptr<DBClientCursor> handleQuery( const std::vector<std::string>& hosts,
const std::string &ns,
Query query,
int nToReturn,
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);
diff --git a/src/mongo/dbtests/clienttests.cpp b/src/mongo/dbtests/clienttests.cpp
index c7cb467983b..c35db8eb404 100644
--- a/src/mongo/dbtests/clienttests.cpp
+++ b/src/mongo/dbtests/clienttests.cpp
@@ -38,7 +38,7 @@
namespace ClientTests {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
using std::vector;
@@ -141,7 +141,7 @@ namespace ClientTests {
ASSERT_OK(dbtests::createIndex(&txn, ns(), BSON( "a" << 1 << "b" << 1 ) ));
- auto_ptr< DBClientCursor > c = db.query( ns(), Query().sort( BSON( "a" << 1 << "b" << 1 ) ) );
+ unique_ptr< DBClientCursor > c = db.query( ns(), Query().sort( BSON( "a" << 1 << "b" << 1 ) ) );
ASSERT_EQUALS( 1111, c->itcount() );
}
};
@@ -157,7 +157,7 @@ namespace ClientTests {
db.insert(ns(), BSON("i" << i));
}
- auto_ptr< DBClientCursor > c = db.query( ns(), Query().sort( BSON( "i" << 1 ) ) );
+ unique_ptr< DBClientCursor > c = db.query( ns(), Query().sort( BSON( "i" << 1 ) ) );
BSONObj o = c->next();
ASSERT( c->more() );
diff --git a/src/mongo/dbtests/dbhelper_tests.cpp b/src/mongo/dbtests/dbhelper_tests.cpp
index 24aeb64be2a..9a7f2de4103 100644
--- a/src/mongo/dbtests/dbhelper_tests.cpp
+++ b/src/mongo/dbtests/dbhelper_tests.cpp
@@ -39,7 +39,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::set;
/**
@@ -96,7 +96,7 @@ namespace mongo {
BSONArray docs(OperationContext* txn) const {
DBDirectClient client(txn);
- auto_ptr<DBClientCursor> cursor = client.query( ns,
+ unique_ptr<DBClientCursor> cursor = client.query( ns,
Query().hint( BSON( "_id" << 1 ) ) );
BSONArrayBuilder bab;
while ( cursor->more() ) {
diff --git a/src/mongo/dbtests/directclienttests.cpp b/src/mongo/dbtests/directclienttests.cpp
index fc076a9f926..e7503413b9e 100644
--- a/src/mongo/dbtests/directclienttests.cpp
+++ b/src/mongo/dbtests/directclienttests.cpp
@@ -44,7 +44,7 @@
namespace DirectClientTests {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::vector;
class ClientBase {
@@ -127,7 +127,7 @@ namespace DirectClientTests {
OperationContextImpl txn;
DBDirectClient client(&txn);
- auto_ptr<DBClientCursor> cursor = client.query( "", Query(), 1 );
+ unique_ptr<DBClientCursor> cursor = client.query( "", Query(), 1 );
ASSERT(cursor->more());
BSONObj result = cursor->next().getOwned();
ASSERT( result.hasField( "$err" ));
@@ -141,7 +141,7 @@ namespace DirectClientTests {
OperationContextImpl txn;
DBDirectClient client(&txn);
- auto_ptr<DBClientCursor> cursor = client.getMore("", 1, 1);
+ unique_ptr<DBClientCursor> cursor = client.getMore("", 1, 1);
ASSERT(cursor->more());
BSONObj result = cursor->next().getOwned();
ASSERT(result.hasField("$err"));
diff --git a/src/mongo/dbtests/executor_registry.cpp b/src/mongo/dbtests/executor_registry.cpp
index a22187460be..af365b37e46 100644
--- a/src/mongo/dbtests/executor_registry.cpp
+++ b/src/mongo/dbtests/executor_registry.cpp
@@ -47,7 +47,7 @@
namespace ExecutorRegistry {
- using std::auto_ptr;
+ using std::unique_ptr;
class ExecutorRegistryBase {
public:
@@ -66,12 +66,12 @@ namespace ExecutorRegistry {
* Return a plan executor that is going over the collection in ns().
*/
PlanExecutor* getCollscan() {
- auto_ptr<WorkingSet> ws(new WorkingSet());
+ unique_ptr<WorkingSet> ws(new WorkingSet());
CollectionScanParams params;
params.collection = collection();
params.direction = CollectionScanParams::FORWARD;
params.tailable = false;
- auto_ptr<CollectionScan> scan(new CollectionScan(&_opCtx, params, ws.get(), NULL));
+ unique_ptr<CollectionScan> scan(new CollectionScan(&_opCtx, params, ws.get(), NULL));
// Create a plan executor to hold it
CanonicalQuery* cq;
@@ -115,7 +115,7 @@ namespace ExecutorRegistry {
// Order of these is important for initialization
OperationContextImpl _opCtx;
- auto_ptr<OldClientWriteContext> _ctx;
+ unique_ptr<OldClientWriteContext> _ctx;
DBDirectClient _client;
};
@@ -128,7 +128,7 @@ namespace ExecutorRegistry {
return;
}
- auto_ptr<PlanExecutor> run(getCollscan());
+ unique_ptr<PlanExecutor> run(getCollscan());
BSONObj obj;
// Read some of it.
@@ -170,7 +170,7 @@ namespace ExecutorRegistry {
class ExecutorRegistryDropCollection : public ExecutorRegistryBase {
public:
void run() {
- auto_ptr<PlanExecutor> run(getCollscan());
+ unique_ptr<PlanExecutor> run(getCollscan());
BSONObj obj;
// Read some of it.
@@ -213,7 +213,7 @@ namespace ExecutorRegistry {
class ExecutorRegistryDropAllIndices : public ExecutorRegistryBase {
public:
void run() {
- auto_ptr<PlanExecutor> run(getCollscan());
+ unique_ptr<PlanExecutor> run(getCollscan());
BSONObj obj;
ASSERT_OK(dbtests::createIndex(&_opCtx, ns(), BSON("foo" << 1)));
@@ -244,7 +244,7 @@ namespace ExecutorRegistry {
class ExecutorRegistryDropOneIndex : public ExecutorRegistryBase {
public:
void run() {
- auto_ptr<PlanExecutor> run(getCollscan());
+ unique_ptr<PlanExecutor> run(getCollscan());
BSONObj obj;
ASSERT_OK(dbtests::createIndex(&_opCtx, ns(), BSON("foo" << 1)));
@@ -275,7 +275,7 @@ namespace ExecutorRegistry {
class ExecutorRegistryDropDatabase : public ExecutorRegistryBase {
public:
void run() {
- auto_ptr<PlanExecutor> run(getCollscan());
+ unique_ptr<PlanExecutor> run(getCollscan());
BSONObj obj;
// Read some of it.
diff --git a/src/mongo/dbtests/jstests.cpp b/src/mongo/dbtests/jstests.cpp
index 07098656497..fcd271bd3fc 100644
--- a/src/mongo/dbtests/jstests.cpp
+++ b/src/mongo/dbtests/jstests.cpp
@@ -48,7 +48,7 @@
#include "mongo/util/timer.h"
using boost::scoped_ptr;
-using std::auto_ptr;
+using std::unique_ptr;
using std::cout;
using std::endl;
using std::string;
@@ -92,7 +92,7 @@ namespace JSTests {
public:
void run() {
/* Currently reset does not clear data in v8 or spidermonkey scopes. See SECURITY-10
- auto_ptr<Scope> s;
+ unique_ptr<Scope> s;
s.reset( globalScriptEngine->newScope() );
s->setBoolean( "x" , true );
@@ -655,7 +655,7 @@ namespace JSTests {
class NumberLong {
public:
void run() {
- auto_ptr<Scope> s( globalScriptEngine->newScope() );
+ unique_ptr<Scope> s( globalScriptEngine->newScope() );
BSONObjBuilder b;
long long val = (long long)( 0xbabadeadbeefbaddULL );
b.append( "a", val );
@@ -715,7 +715,7 @@ namespace JSTests {
class NumberLong2 {
public:
void run() {
- auto_ptr<Scope> s( globalScriptEngine->newScope() );
+ unique_ptr<Scope> s( globalScriptEngine->newScope() );
BSONObj in;
{
@@ -742,7 +742,7 @@ namespace JSTests {
class NumberLongUnderLimit {
public:
void run() {
- auto_ptr<Scope> s( globalScriptEngine->newScope() );
+ unique_ptr<Scope> s( globalScriptEngine->newScope() );
BSONObjBuilder b;
// limit is 2^53
@@ -788,7 +788,7 @@ namespace JSTests {
class InvalidTimestamp {
public:
void run() {
- auto_ptr<Scope> s( globalScriptEngine->newScope() );
+ unique_ptr<Scope> s( globalScriptEngine->newScope() );
// Timestamp 't' component cannot exceed max for int32_t.
BSONObj in;
@@ -966,7 +966,7 @@ namespace JSTests {
if( !globalScriptEngine->utf8Ok() )
return;
- auto_ptr<Scope> s;
+ unique_ptr<Scope> s;
s.reset( globalScriptEngine->newScope() );
BSONObj b;
@@ -1928,7 +1928,7 @@ namespace JSTests {
BSONObj start = BSON( "x" << 5.0 );
BSONObj empty;
- auto_ptr<Scope> s;
+ unique_ptr<Scope> s;
s.reset( globalScriptEngine->newScope() );
ScriptingFunction f = s->createFunction( "return this.x + 6;" );
@@ -1946,7 +1946,7 @@ namespace JSTests {
class ScopeOut {
public:
void run() {
- auto_ptr<Scope> s;
+ unique_ptr<Scope> s;
s.reset( globalScriptEngine->newScope() );
s->invokeSafe( "x = 5;" , 0, 0 );
@@ -1972,7 +1972,7 @@ namespace JSTests {
class RenameTest {
public:
void run() {
- auto_ptr<Scope> s;
+ unique_ptr<Scope> s;
s.reset( globalScriptEngine->newScope() );
s->setNumber( "x" , 5 );
diff --git a/src/mongo/dbtests/mock/mock_dbclient_connection.cpp b/src/mongo/dbtests/mock/mock_dbclient_connection.cpp
index 28a04779d25..46cb3f2b732 100644
--- a/src/mongo/dbtests/mock/mock_dbclient_connection.cpp
+++ b/src/mongo/dbtests/mock/mock_dbclient_connection.cpp
@@ -75,7 +75,7 @@ namespace mongo {
return false;
}
- std::auto_ptr<mongo::DBClientCursor> MockDBClientConnection::query(const string& ns,
+ std::unique_ptr<mongo::DBClientCursor> MockDBClientConnection::query(const string& ns,
mongo::Query query,
int nToReturn,
int nToSkip,
@@ -88,7 +88,7 @@ namespace mongo {
mongo::BSONArray result(_remoteServer->query(_remoteServerInstanceID, ns, query,
nToReturn, nToSkip, fieldsToReturn, queryOptions, batchSize));
- std::auto_ptr<mongo::DBClientCursor> cursor;
+ std::unique_ptr<mongo::DBClientCursor> cursor;
cursor.reset(new MockDBClientCursor(this, result));
return cursor;
}
@@ -97,7 +97,7 @@ namespace mongo {
throw;
}
- std::auto_ptr<mongo::DBClientCursor> nullPtr;
+ std::unique_ptr<mongo::DBClientCursor> nullPtr;
return nullPtr;
}
diff --git a/src/mongo/dbtests/mock/mock_dbclient_connection.h b/src/mongo/dbtests/mock/mock_dbclient_connection.h
index 8fa1a890c90..38016a0eb8e 100644
--- a/src/mongo/dbtests/mock/mock_dbclient_connection.h
+++ b/src/mongo/dbtests/mock/mock_dbclient_connection.h
@@ -68,7 +68,7 @@ namespace mongo {
bool runCommand(const std::string& dbname, const mongo::BSONObj& cmdObj,
mongo::BSONObj &info, int options = 0);
- std::auto_ptr<mongo::DBClientCursor> query(const std::string &ns,
+ std::unique_ptr<mongo::DBClientCursor> query(const std::string &ns,
mongo::Query query = mongo::Query(),
int nToReturn = 0,
int nToSkip = 0,
diff --git a/src/mongo/dbtests/mock_dbclient_conn_test.cpp b/src/mongo/dbtests/mock_dbclient_conn_test.cpp
index 09a88ea316a..e88bf1f5054 100644
--- a/src/mongo/dbtests/mock_dbclient_conn_test.cpp
+++ b/src/mongo/dbtests/mock_dbclient_conn_test.cpp
@@ -84,7 +84,7 @@ namespace mongo_test {
{
MockDBClientConnection conn(&server);
- std::auto_ptr<mongo::DBClientCursor> cursor = conn.query(ns);
+ std::unique_ptr<mongo::DBClientCursor> cursor = conn.query(ns);
ASSERT(!cursor->more());
server.insert(ns, BSON("x" << 1));
@@ -93,7 +93,7 @@ namespace mongo_test {
{
MockDBClientConnection conn(&server);
- std::auto_ptr<mongo::DBClientCursor> cursor = conn.query(ns);
+ std::unique_ptr<mongo::DBClientCursor> cursor = conn.query(ns);
ASSERT(cursor->more());
BSONObj firstDoc = cursor->next();
@@ -109,7 +109,7 @@ namespace mongo_test {
// Make sure that repeated calls will still give you the same result
{
MockDBClientConnection conn(&server);
- std::auto_ptr<mongo::DBClientCursor> cursor = conn.query(ns);
+ std::unique_ptr<mongo::DBClientCursor> cursor = conn.query(ns);
ASSERT(cursor->more());
BSONObj firstDoc = cursor->next();
@@ -131,7 +131,7 @@ namespace mongo_test {
{
MockDBClientConnection conn(&server);
- std::auto_ptr<mongo::DBClientCursor> cursor = conn.query(ns);
+ std::unique_ptr<mongo::DBClientCursor> cursor = conn.query(ns);
ASSERT(cursor->more());
BSONObj firstDoc = cursor->next();
@@ -142,7 +142,7 @@ namespace mongo_test {
{
MockDBClientConnection conn(&server);
- std::auto_ptr<mongo::DBClientCursor> cursor = conn.query(ns);
+ std::unique_ptr<mongo::DBClientCursor> cursor = conn.query(ns);
ASSERT(cursor->more());
BSONObj firstDoc = cursor->next();
@@ -162,7 +162,7 @@ namespace mongo_test {
server.insert(ns, BSON("x" << 1));
MockDBClientConnection conn(&server);
- std::auto_ptr<mongo::DBClientCursor> cursor = conn.query("other.ns");
+ std::unique_ptr<mongo::DBClientCursor> cursor = conn.query("other.ns");
ASSERT(!cursor->more());
}
@@ -187,7 +187,7 @@ namespace mongo_test {
{
MockDBClientConnection conn(&server);
- std::auto_ptr<mongo::DBClientCursor> cursor = conn.query(ns1);
+ std::unique_ptr<mongo::DBClientCursor> cursor = conn.query(ns1);
ASSERT(cursor->more());
BSONObj firstDoc = cursor->next();
@@ -202,7 +202,7 @@ namespace mongo_test {
{
MockDBClientConnection conn(&server);
- std::auto_ptr<mongo::DBClientCursor> cursor = conn.query(ns2);
+ std::unique_ptr<mongo::DBClientCursor> cursor = conn.query(ns2);
ASSERT(cursor->more());
BSONObj firstDoc = cursor->next();
@@ -221,7 +221,7 @@ namespace mongo_test {
{
MockDBClientConnection conn(&server);
- std::auto_ptr<mongo::DBClientCursor> cursor = conn.query(ns3);
+ std::unique_ptr<mongo::DBClientCursor> cursor = conn.query(ns3);
ASSERT(cursor->more());
BSONObj firstDoc = cursor->next();
@@ -237,7 +237,7 @@ namespace mongo_test {
{
MockDBClientConnection conn(&server);
- std::auto_ptr<mongo::DBClientCursor> cursor = conn.query(ns);
+ std::unique_ptr<mongo::DBClientCursor> cursor = conn.query(ns);
ASSERT(!cursor->more());
conn.insert(ns, BSON("x" << 1));
@@ -251,7 +251,7 @@ namespace mongo_test {
{
MockDBClientConnection conn(&server);
- std::auto_ptr<mongo::DBClientCursor> cursor = conn.query(ns);
+ std::unique_ptr<mongo::DBClientCursor> cursor = conn.query(ns);
ASSERT(!cursor->more());
}
@@ -259,7 +259,7 @@ namespace mongo_test {
// Make sure that repeated calls will still give you the same result
{
MockDBClientConnection conn(&server);
- std::auto_ptr<mongo::DBClientCursor> cursor = conn.query(ns);
+ std::unique_ptr<mongo::DBClientCursor> cursor = conn.query(ns);
ASSERT(!cursor->more());
}
@@ -287,13 +287,13 @@ namespace mongo_test {
MockDBClientConnection conn(&server);
conn.remove(ns2, Query(), false);
- std::auto_ptr<mongo::DBClientCursor> cursor = conn.query(ns2);
+ std::unique_ptr<mongo::DBClientCursor> cursor = conn.query(ns2);
ASSERT(!cursor->more());
}
{
MockDBClientConnection conn(&server);
- std::auto_ptr<mongo::DBClientCursor> cursor = conn.query(ns1);
+ std::unique_ptr<mongo::DBClientCursor> cursor = conn.query(ns1);
ASSERT(cursor->more());
BSONObj firstDoc = cursor->next();
@@ -308,7 +308,7 @@ namespace mongo_test {
{
MockDBClientConnection conn(&server);
- std::auto_ptr<mongo::DBClientCursor> cursor = conn.query(ns3);
+ std::unique_ptr<mongo::DBClientCursor> cursor = conn.query(ns3);
ASSERT(cursor->more());
BSONObj firstDoc = cursor->next();
@@ -341,7 +341,7 @@ namespace mongo_test {
{
MockDBClientConnection conn(&server);
- std::auto_ptr<mongo::DBClientCursor> cursor = conn.query(ns);
+ std::unique_ptr<mongo::DBClientCursor> cursor = conn.query(ns);
ASSERT(cursor->more());
BSONObj firstDoc = cursor->next();
diff --git a/src/mongo/dbtests/namespacetests.cpp b/src/mongo/dbtests/namespacetests.cpp
index f8b6c0d95f1..1fa48c03631 100644
--- a/src/mongo/dbtests/namespacetests.cpp
+++ b/src/mongo/dbtests/namespacetests.cpp
@@ -370,7 +370,7 @@ namespace NamespaceTests {
RecordId last, first;
{
- auto_ptr<Runner> runner(InternalPlanner::collectionScan(&txn,
+ unique_ptr<Runner> runner(InternalPlanner::collectionScan(&txn,
ns(),
collection(),
InternalPlanner::BACKWARD));
@@ -378,7 +378,7 @@ namespace NamespaceTests {
ASSERT( !last.isNull() );
}
{
- auto_ptr<Runner> runner(InternalPlanner::collectionScan(&txn,
+ unique_ptr<Runner> runner(InternalPlanner::collectionScan(&txn,
ns(),
collection(),
InternalPlanner::FORWARD));
@@ -392,7 +392,7 @@ namespace NamespaceTests {
{
RecordId loc;
- auto_ptr<Runner> runner(InternalPlanner::collectionScan(&txn,
+ unique_ptr<Runner> runner(InternalPlanner::collectionScan(&txn,
ns(),
collection(),
InternalPlanner::FORWARD));
@@ -400,7 +400,7 @@ namespace NamespaceTests {
ASSERT( first == loc);
}
{
- auto_ptr<Runner> runner(InternalPlanner::collectionScan(&txn,
+ unique_ptr<Runner> runner(InternalPlanner::collectionScan(&txn,
ns(),
collection(),
InternalPlanner::BACKWARD));
diff --git a/src/mongo/dbtests/query_multi_plan_runner.cpp b/src/mongo/dbtests/query_multi_plan_runner.cpp
index 8525f2bdade..c43b5ab111b 100644
--- a/src/mongo/dbtests/query_multi_plan_runner.cpp
+++ b/src/mongo/dbtests/query_multi_plan_runner.cpp
@@ -58,14 +58,14 @@ namespace mongo {
namespace QueryMultiPlanRunner {
using boost::scoped_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::vector;
/**
* Create query solution.
*/
QuerySolution* createQuerySolution() {
- std::auto_ptr<QuerySolution> soln(new QuerySolution());
+ std::unique_ptr<QuerySolution> soln(new QuerySolution());
soln->cacheData.reset(new SolutionCacheData());
soln->cacheData->solnType = SolutionCacheData::COLLSCAN_SOLN;
soln->cacheData->tree.reset(new PlanCacheIndexTree());
@@ -132,9 +132,9 @@ namespace QueryMultiPlanRunner {
ixparams.bounds.endKeyInclusive = true;
ixparams.direction = 1;
- auto_ptr<WorkingSet> sharedWs(new WorkingSet());
+ unique_ptr<WorkingSet> sharedWs(new WorkingSet());
IndexScan* ix = new IndexScan(&_txn, ixparams, sharedWs.get(), NULL);
- auto_ptr<PlanStage> firstRoot(new FetchStage(&_txn, sharedWs.get(), ix, NULL, coll));
+ unique_ptr<PlanStage> firstRoot(new FetchStage(&_txn, sharedWs.get(), ix, NULL, coll));
// Plan 1: CollScan with matcher.
CollectionScanParams csparams;
@@ -145,9 +145,9 @@ namespace QueryMultiPlanRunner {
BSONObj filterObj = BSON("foo" << 7);
StatusWithMatchExpression swme = MatchExpressionParser::parse(filterObj);
verify(swme.isOK());
- auto_ptr<MatchExpression> filter(swme.getValue());
+ unique_ptr<MatchExpression> filter(swme.getValue());
// Make the stage.
- auto_ptr<PlanStage> secondRoot(new CollectionScan(&_txn, csparams, sharedWs.get(),
+ unique_ptr<PlanStage> secondRoot(new CollectionScan(&_txn, csparams, sharedWs.get(),
filter.get()));
// Hand the plans off to the runner.
diff --git a/src/mongo/dbtests/query_plan_executor.cpp b/src/mongo/dbtests/query_plan_executor.cpp
index 9d771acdbfe..e79c9980898 100644
--- a/src/mongo/dbtests/query_plan_executor.cpp
+++ b/src/mongo/dbtests/query_plan_executor.cpp
@@ -53,7 +53,7 @@ namespace QueryPlanExecutor {
using boost::scoped_ptr;
using boost::shared_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
class PlanExecutorBase {
@@ -97,7 +97,7 @@ namespace QueryPlanExecutor {
CollectionScanParams csparams;
csparams.collection = coll;
csparams.direction = CollectionScanParams::FORWARD;
- auto_ptr<WorkingSet> ws(new WorkingSet());
+ unique_ptr<WorkingSet> ws(new WorkingSet());
// Canonicalize the query
CanonicalQuery* cq;
@@ -105,7 +105,7 @@ namespace QueryPlanExecutor {
verify(NULL != cq);
// Make the stage.
- auto_ptr<PlanStage> root(new CollectionScan(&_txn, csparams, ws.get(), cq->root()));
+ unique_ptr<PlanStage> root(new CollectionScan(&_txn, csparams, ws.get(), cq->root()));
PlanExecutor* exec;
// Hand the plan off to the executor.
@@ -140,9 +140,9 @@ namespace QueryPlanExecutor {
const Collection* coll = db->getCollection(ns());
- auto_ptr<WorkingSet> ws(new WorkingSet());
+ unique_ptr<WorkingSet> ws(new WorkingSet());
IndexScan* ix = new IndexScan(&_txn, ixparams, ws.get(), NULL);
- auto_ptr<PlanStage> root(new FetchStage(&_txn, ws.get(), ix, NULL, coll));
+ unique_ptr<PlanStage> root(new FetchStage(&_txn, ws.get(), ix, NULL, coll));
CanonicalQuery* cq;
verify(CanonicalQuery::canonicalize(ns(), BSONObj(), &cq).isOK());
@@ -284,8 +284,8 @@ namespace QueryPlanExecutor {
ASSERT_EQUALS(errmsg, "");
// Create the output PlanExecutor that pulls results from the pipeline.
- std::auto_ptr<WorkingSet> ws(new WorkingSet());
- std::auto_ptr<PipelineProxyStage> proxy(
+ std::unique_ptr<WorkingSet> ws(new WorkingSet());
+ std::unique_ptr<PipelineProxyStage> proxy(
new PipelineProxyStage(pipeline, innerExec, ws.get()));
Collection* collection = ctx.getCollection();
diff --git a/src/mongo/dbtests/query_stage_and.cpp b/src/mongo/dbtests/query_stage_and.cpp
index 29db2eaf104..8b59cc7304b 100644
--- a/src/mongo/dbtests/query_stage_and.cpp
+++ b/src/mongo/dbtests/query_stage_and.cpp
@@ -56,7 +56,7 @@ namespace QueryStageAnd {
using boost::scoped_ptr;
using boost::shared_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::set;
class QueryStageAndBase {
@@ -759,7 +759,7 @@ namespace QueryStageAnd {
BSONObj filter = BSON("bar" << 97);
StatusWithMatchExpression swme = MatchExpressionParser::parse(filter);
verify(swme.isOK());
- auto_ptr<MatchExpression> filterExpr(swme.getValue());
+ unique_ptr<MatchExpression> filterExpr(swme.getValue());
scoped_ptr<AndHashStage> ah(new AndHashStage(&ws, filterExpr.get(), coll));
// Foo <= 20
@@ -1338,7 +1338,7 @@ namespace QueryStageAnd {
BSONObj filterObj = BSON("foo" << BSON("$ne" << 1));
StatusWithMatchExpression swme = MatchExpressionParser::parse(filterObj);
verify(swme.isOK());
- auto_ptr<MatchExpression> filterExpr(swme.getValue());
+ unique_ptr<MatchExpression> filterExpr(swme.getValue());
scoped_ptr<AndSortedStage> ah(new AndSortedStage(&ws, filterExpr.get(), coll));
// Scan over foo == 1
diff --git a/src/mongo/dbtests/query_stage_collscan.cpp b/src/mongo/dbtests/query_stage_collscan.cpp
index ab6ea366ea9..ffb204c2623 100644
--- a/src/mongo/dbtests/query_stage_collscan.cpp
+++ b/src/mongo/dbtests/query_stage_collscan.cpp
@@ -50,7 +50,7 @@
namespace QueryStageCollectionScan {
using boost::scoped_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::vector;
//
@@ -90,7 +90,7 @@ namespace QueryStageCollectionScan {
// Make the filter.
StatusWithMatchExpression swme = MatchExpressionParser::parse(filterObj);
verify(swme.isOK());
- auto_ptr<MatchExpression> filterExpr(swme.getValue());
+ unique_ptr<MatchExpression> filterExpr(swme.getValue());
// Make a scan and have the runner own it.
WorkingSet* ws = new WorkingSet();
diff --git a/src/mongo/dbtests/query_stage_count.cpp b/src/mongo/dbtests/query_stage_count.cpp
index d2bca4701a4..7adc5b6996f 100644
--- a/src/mongo/dbtests/query_stage_count.cpp
+++ b/src/mongo/dbtests/query_stage_count.cpp
@@ -44,7 +44,7 @@
namespace QueryStageCount {
using boost::scoped_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::vector;
const int kDocuments = 100;
@@ -147,10 +147,10 @@ namespace QueryStageCount {
setup();
getLocs();
- auto_ptr<WorkingSet> ws(new WorkingSet);
+ unique_ptr<WorkingSet> ws(new WorkingSet);
StatusWithMatchExpression swme = MatchExpressionParser::parse(request.query);
- auto_ptr<MatchExpression> expression(swme.getValue());
+ unique_ptr<MatchExpression> expression(swme.getValue());
PlanStage* scan;
if (indexed) {
diff --git a/src/mongo/dbtests/query_stage_fetch.cpp b/src/mongo/dbtests/query_stage_fetch.cpp
index e33d9b08420..d03a619a9b2 100644
--- a/src/mongo/dbtests/query_stage_fetch.cpp
+++ b/src/mongo/dbtests/query_stage_fetch.cpp
@@ -48,7 +48,7 @@
namespace QueryStageFetch {
using boost::shared_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::set;
class QueryStageFetchBase {
@@ -108,7 +108,7 @@ namespace QueryStageFetch {
ASSERT_EQUALS(size_t(1), locs.size());
// Create a mock stage that returns the WSM.
- auto_ptr<QueuedDataStage> mockStage(new QueuedDataStage(&ws));
+ unique_ptr<QueuedDataStage> mockStage(new QueuedDataStage(&ws));
// Mock data.
{
@@ -126,7 +126,7 @@ namespace QueryStageFetch {
mockStage->pushBack(mockMember);
}
- auto_ptr<FetchStage> fetchStage(new FetchStage(&_txn, &ws, mockStage.release(),
+ unique_ptr<FetchStage> fetchStage(new FetchStage(&_txn, &ws, mockStage.release(),
NULL, coll));
WorkingSetID id = WorkingSet::INVALID_ID;
@@ -170,7 +170,7 @@ namespace QueryStageFetch {
ASSERT_EQUALS(size_t(1), locs.size());
// Create a mock stage that returns the WSM.
- auto_ptr<QueuedDataStage> mockStage(new QueuedDataStage(&ws));
+ unique_ptr<QueuedDataStage> mockStage(new QueuedDataStage(&ws));
// Mock data.
{
@@ -188,10 +188,10 @@ namespace QueryStageFetch {
BSONObj filterObj = BSON("foo" << 6);
StatusWithMatchExpression swme = MatchExpressionParser::parse(filterObj);
verify(swme.isOK());
- auto_ptr<MatchExpression> filterExpr(swme.getValue());
+ unique_ptr<MatchExpression> filterExpr(swme.getValue());
// Matcher requires that foo==6 but we only have data with foo==5.
- auto_ptr<FetchStage> fetchStage(
+ unique_ptr<FetchStage> fetchStage(
new FetchStage(&_txn, &ws, mockStage.release(), filterExpr.get(), coll));
// First call should return a fetch request as it's not in memory.
diff --git a/src/mongo/dbtests/query_stage_ixscan.cpp b/src/mongo/dbtests/query_stage_ixscan.cpp
index e3f5f8877cc..e56ba1128f4 100644
--- a/src/mongo/dbtests/query_stage_ixscan.cpp
+++ b/src/mongo/dbtests/query_stage_ixscan.cpp
@@ -159,7 +159,7 @@ namespace QueryStageIxscan {
// Make the {x: 1} index multikey by inserting a doc where 'x' is an array.
insert(fromjson("{_id: 1, x: [1, 2, 3]}"));
- std::auto_ptr<IndexScan> ixscan(
+ std::unique_ptr<IndexScan> ixscan(
createIndexScanSimpleRange(BSON("x" << 1), BSON("x" << 3)));
// Verify that SpecificStats of 'ixscan' have been properly initialized.
diff --git a/src/mongo/dbtests/query_stage_keep.cpp b/src/mongo/dbtests/query_stage_keep.cpp
index 743d1f7bdd2..00de94c770d 100644
--- a/src/mongo/dbtests/query_stage_keep.cpp
+++ b/src/mongo/dbtests/query_stage_keep.cpp
@@ -143,7 +143,7 @@ namespace QueryStageKeep {
// Create a KeepMutations stage to merge in the 10 flagged objects.
// Takes ownership of 'cs'
MatchExpression* nullFilter = NULL;
- std::auto_ptr<KeepMutationsStage> keep(new KeepMutationsStage(nullFilter, &ws, cs));
+ std::unique_ptr<KeepMutationsStage> keep(new KeepMutationsStage(nullFilter, &ws, cs));
for (size_t i = 0; i < 10; ++i) {
WorkingSetID id = getNextResult(keep.get());
@@ -191,7 +191,7 @@ namespace QueryStageKeep {
// Create a KeepMutationsStage with an EOF child, and flag 50 objects. We expect these
// objects to be returned by the KeepMutationsStage.
MatchExpression* nullFilter = NULL;
- std::auto_ptr<KeepMutationsStage> keep(new KeepMutationsStage(nullFilter, &ws,
+ std::unique_ptr<KeepMutationsStage> keep(new KeepMutationsStage(nullFilter, &ws,
new EOFStage()));
for (size_t i = 0; i < 50; ++i) {
WorkingSetID id = ws.allocate();
diff --git a/src/mongo/dbtests/query_stage_limit_skip.cpp b/src/mongo/dbtests/query_stage_limit_skip.cpp
index bc4697327de..afb4436e4b9 100644
--- a/src/mongo/dbtests/query_stage_limit_skip.cpp
+++ b/src/mongo/dbtests/query_stage_limit_skip.cpp
@@ -46,7 +46,7 @@ using namespace mongo;
namespace {
using boost::scoped_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::max;
using std::min;
@@ -54,7 +54,7 @@ namespace {
/* Populate a QueuedDataStage and return it. Caller owns it. */
QueuedDataStage* getMS(WorkingSet* ws) {
- auto_ptr<QueuedDataStage> ms(new QueuedDataStage(ws));
+ unique_ptr<QueuedDataStage> ms(new QueuedDataStage(ws));
// Put N ADVANCED results into the mock stage, and some other stalling results (YIELD/TIME).
for (int i = 0; i < N; ++i) {
diff --git a/src/mongo/dbtests/query_stage_merge_sort.cpp b/src/mongo/dbtests/query_stage_merge_sort.cpp
index 0c3813e5a37..f4fa4ea9bd7 100644
--- a/src/mongo/dbtests/query_stage_merge_sort.cpp
+++ b/src/mongo/dbtests/query_stage_merge_sort.cpp
@@ -46,7 +46,7 @@
namespace QueryStageMergeSortTests {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::set;
using std::string;
@@ -527,7 +527,7 @@ namespace QueryStageMergeSortTests {
// Sort by foo:1
MergeSortStageParams msparams;
msparams.pattern = BSON("foo" << 1);
- auto_ptr<MergeSortStage> ms(new MergeSortStage(msparams, &ws, coll));
+ unique_ptr<MergeSortStage> ms(new MergeSortStage(msparams, &ws, coll));
IndexScanParams params;
params.bounds.isSimpleRange = true;
diff --git a/src/mongo/dbtests/query_stage_sort.cpp b/src/mongo/dbtests/query_stage_sort.cpp
index dc267b9a8b1..b9b34bda21f 100644
--- a/src/mongo/dbtests/query_stage_sort.cpp
+++ b/src/mongo/dbtests/query_stage_sort.cpp
@@ -46,7 +46,7 @@
namespace QueryStageSortTests {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::set;
class QueryStageSortTestBase {
@@ -104,15 +104,15 @@ namespace QueryStageSortTests {
PlanExecutor* makePlanExecutorWithSortStage(Collection* coll) {
PlanExecutor* exec;
// Build the mock scan stage which feeds the data.
- std::auto_ptr<WorkingSet> ws(new WorkingSet());
- auto_ptr<QueuedDataStage> ms(new QueuedDataStage(ws.get()));
+ std::unique_ptr<WorkingSet> ws(new WorkingSet());
+ unique_ptr<QueuedDataStage> ms(new QueuedDataStage(ws.get()));
insertVarietyOfObjects(ms.get(), coll);
SortStageParams params;
params.collection = coll;
params.pattern = BSON("foo" << 1);
params.limit = limit();
- auto_ptr<SortStage> ss(new SortStage(params, ws.get(), ms.release()));
+ unique_ptr<SortStage> ss(new SortStage(params, ws.get(), ms.release()));
// The PlanExecutor will be automatically registered on construction due to the auto
// yield policy, so it can receive invalidations when we remove documents later.
@@ -308,7 +308,7 @@ namespace QueryStageSortTests {
set<RecordId> locs;
getLocs(&locs, coll);
- std::auto_ptr<PlanExecutor> exec(makePlanExecutorWithSortStage(coll));
+ std::unique_ptr<PlanExecutor> exec(makePlanExecutorWithSortStage(coll));
SortStage * ss = static_cast<SortStage*>(exec->getRootStage());
QueuedDataStage* ms = static_cast<QueuedDataStage*>(ss->getChildren()[0]);
@@ -415,7 +415,7 @@ namespace QueryStageSortTests {
set<RecordId> locs;
getLocs(&locs, coll);
- std::auto_ptr<PlanExecutor> exec(makePlanExecutorWithSortStage(coll));
+ std::unique_ptr<PlanExecutor> exec(makePlanExecutorWithSortStage(coll));
SortStage * ss = static_cast<SortStage*>(exec->getRootStage());
QueuedDataStage* ms = static_cast<QueuedDataStage*>(ss->getChildren()[0]);
diff --git a/src/mongo/dbtests/query_stage_tests.cpp b/src/mongo/dbtests/query_stage_tests.cpp
index 83298723775..c5365d140ae 100644
--- a/src/mongo/dbtests/query_stage_tests.cpp
+++ b/src/mongo/dbtests/query_stage_tests.cpp
@@ -45,7 +45,7 @@
namespace QueryStageTests {
- using std::auto_ptr;
+ using std::unique_ptr;
class IndexScanBase {
public:
@@ -78,7 +78,7 @@ namespace QueryStageTests {
StatusWithMatchExpression swme = MatchExpressionParser::parse(filterObj);
verify(swme.isOK());
- auto_ptr<MatchExpression> filterExpr(swme.getValue());
+ unique_ptr<MatchExpression> filterExpr(swme.getValue());
WorkingSet* ws = new WorkingSet();
diff --git a/src/mongo/dbtests/query_stage_update.cpp b/src/mongo/dbtests/query_stage_update.cpp
index c2686462dbe..92f95f5fdb6 100644
--- a/src/mongo/dbtests/query_stage_update.cpp
+++ b/src/mongo/dbtests/query_stage_update.cpp
@@ -55,7 +55,7 @@
namespace QueryStageUpdate {
using boost::scoped_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::vector;
class QueryStageUpdateBase {
@@ -219,7 +219,7 @@ namespace QueryStageUpdate {
params.canonicalQuery = cq.get();
scoped_ptr<WorkingSet> ws(new WorkingSet());
- auto_ptr<EOFStage> eofStage(new EOFStage());
+ unique_ptr<EOFStage> eofStage(new EOFStage());
scoped_ptr<UpdateStage> updateStage(
new UpdateStage(&_txn, params, ws.get(), collection, eofStage.release()));
@@ -296,7 +296,7 @@ namespace QueryStageUpdate {
updateParams.canonicalQuery = cq.get();
scoped_ptr<WorkingSet> ws(new WorkingSet());
- auto_ptr<CollectionScan> cs(
+ unique_ptr<CollectionScan> cs(
new CollectionScan(&_txn, collScanParams, ws.get(), cq->root()));
scoped_ptr<UpdateStage> updateStage(
diff --git a/src/mongo/dbtests/querytests.cpp b/src/mongo/dbtests/querytests.cpp
index d668cb8e2d4..01415387dd6 100644
--- a/src/mongo/dbtests/querytests.cpp
+++ b/src/mongo/dbtests/querytests.cpp
@@ -56,7 +56,7 @@ namespace mongo {
namespace QueryTests {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::cout;
using std::endl;
using std::string;
@@ -264,7 +264,7 @@ namespace QueryTests {
insert( ns, BSON( "a" << 1 ) );
insert( ns, BSON( "a" << 2 ) );
insert( ns, BSON( "a" << 3 ) );
- auto_ptr< DBClientCursor > cursor = _client.query( ns, BSONObj(), 2 );
+ unique_ptr< DBClientCursor > cursor = _client.query( ns, BSONObj(), 2 );
long long cursorId = cursor->getCursorId();
cursor->decouple();
cursor.reset();
@@ -301,7 +301,7 @@ namespace QueryTests {
}
// Create a cursor on the collection, with a batch size of 200.
- auto_ptr<DBClientCursor> cursor = _client.query( ns, "", 0, 0, 0, 0, 200 );
+ unique_ptr<DBClientCursor> cursor = _client.query( ns, "", 0, 0, 0, 0, 200 );
CursorId cursorId = cursor->getCursorId();
// Count 500 results, spanning a few batches of documents.
@@ -353,7 +353,7 @@ namespace QueryTests {
}
// Create a cursor on the collection, with a batch size of 200.
- auto_ptr<DBClientCursor> cursor = _client.query( ns, "", 0, 0, 0, 0, 200 );
+ unique_ptr<DBClientCursor> cursor = _client.query( ns, "", 0, 0, 0, 0, 200 );
CursorId cursorId = cursor->getCursorId();
// Count 500 results, spanning a few batches of documents.
@@ -422,7 +422,7 @@ namespace QueryTests {
insert( ns, BSON( "a" << 0 ) );
insert( ns, BSON( "a" << 1 ) );
insert( ns, BSON( "a" << 2 ) );
- auto_ptr< DBClientCursor > c = _client.query( ns, QUERY( "a" << GT << 0 ).hint( BSON( "$natural" << 1 ) ), 1, 0, 0, QueryOption_CursorTailable );
+ unique_ptr< DBClientCursor > c = _client.query( ns, QUERY( "a" << GT << 0 ).hint( BSON( "$natural" << 1 ) ), 1, 0, 0, QueryOption_CursorTailable );
// If only one result requested, a cursor is not saved.
ASSERT_EQUALS( 0, c->getCursorId() );
ASSERT( c->more() );
@@ -441,7 +441,7 @@ namespace QueryTests {
insert( ns, BSON( "a" << 0 ) );
insert( ns, BSON( "a" << 1 ) );
insert( ns, BSON( "a" << 2 ) );
- auto_ptr< DBClientCursor > c = _client.query( ns, Query().hint( BSON( "$natural" << 1 ) ), 2, 0, 0, QueryOption_CursorTailable );
+ unique_ptr< DBClientCursor > c = _client.query( ns, Query().hint( BSON( "$natural" << 1 ) ), 2, 0, 0, QueryOption_CursorTailable );
ASSERT( 0 != c->getCursorId() );
while( c->more() )
c->next();
@@ -463,7 +463,7 @@ namespace QueryTests {
void run() {
const char *ns = "unittests.querytests.EmptyTail";
_client.createCollection( ns, 1900, true );
- auto_ptr< DBClientCursor > c = _client.query( ns, Query().hint( BSON( "$natural" << 1 ) ), 2, 0, 0, QueryOption_CursorTailable );
+ unique_ptr< DBClientCursor > c = _client.query( ns, Query().hint( BSON( "$natural" << 1 ) ), 2, 0, 0, QueryOption_CursorTailable );
ASSERT_EQUALS( 0, c->getCursorId() );
ASSERT( c->isDead() );
insert( ns, BSON( "a" << 0 ) );
@@ -483,7 +483,7 @@ namespace QueryTests {
_client.createCollection( ns, 8192, true, 2 );
insert( ns, BSON( "a" << 0 ) );
insert( ns, BSON( "a" << 1 ) );
- auto_ptr< DBClientCursor > c = _client.query( ns, Query().hint( BSON( "$natural" << 1 ) ), 2, 0, 0, QueryOption_CursorTailable );
+ unique_ptr< DBClientCursor > c = _client.query( ns, Query().hint( BSON( "$natural" << 1 ) ), 2, 0, 0, QueryOption_CursorTailable );
c->next();
c->next();
ASSERT( !c->more() );
@@ -507,7 +507,7 @@ namespace QueryTests {
_client.createCollection( ns, 8192, true, 2 );
insert( ns, BSON( "a" << 0 ) );
insert( ns, BSON( "a" << 1 ) );
- auto_ptr< DBClientCursor > c = _client.query( ns, Query().hint( BSON( "$natural" << 1 ) ), 2, 0, 0, QueryOption_CursorTailable );
+ unique_ptr< DBClientCursor > c = _client.query( ns, Query().hint( BSON( "$natural" << 1 ) ), 2, 0, 0, QueryOption_CursorTailable );
c->next();
c->next();
ASSERT( !c->more() );
@@ -533,7 +533,7 @@ namespace QueryTests {
_client.createCollection( ns, 1330, true );
insert( ns, BSON( "a" << 0 ) );
insert( ns, BSON( "a" << 1 ) );
- auto_ptr< DBClientCursor > c = _client.query( ns, Query().hint( BSON( "$natural" << 1 ) ), 2, 0, 0, QueryOption_CursorTailable );
+ unique_ptr< DBClientCursor > c = _client.query( ns, Query().hint( BSON( "$natural" << 1 ) ), 2, 0, 0, QueryOption_CursorTailable );
c->next();
c->next();
ASSERT( !c->more() );
@@ -553,7 +553,7 @@ namespace QueryTests {
void run() {
const char *ns = "unittests.querytests.TailCappedOnly";
_client.insert( ns, BSONObj() );
- auto_ptr< DBClientCursor > c = _client.query( ns, BSONObj(), 0, 0, 0, QueryOption_CursorTailable );
+ unique_ptr< DBClientCursor > c = _client.query( ns, BSONObj(), 0, 0, 0, QueryOption_CursorTailable );
ASSERT( c->isDead() );
}
};
@@ -578,10 +578,10 @@ namespace QueryTests {
_client.runCommand( "unittests", BSON( "create" << "querytests.TailableQueryOnId" << "capped" << true << "size" << 8192 << "autoIndexId" << true ), info );
insertA( ns, 0 );
insertA( ns, 1 );
- auto_ptr< DBClientCursor > c1 = _client.query( ns, QUERY( "a" << GT << -1 ), 0, 0, 0, QueryOption_CursorTailable );
+ unique_ptr< DBClientCursor > c1 = _client.query( ns, QUERY( "a" << GT << -1 ), 0, 0, 0, QueryOption_CursorTailable );
OID id;
id.init("000000000000000000000000");
- auto_ptr< DBClientCursor > c2 = _client.query( ns, QUERY( "value" << GT << id ), 0, 0, 0, QueryOption_CursorTailable );
+ unique_ptr< DBClientCursor > c2 = _client.query( ns, QUERY( "value" << GT << id ), 0, 0, 0, QueryOption_CursorTailable );
c1->next();
c1->next();
ASSERT( !c1->more() );
@@ -609,7 +609,7 @@ namespace QueryTests {
insert( ns, BSON( "ts" << 0 ) );
insert( ns, BSON( "ts" << 1 ) );
insert( ns, BSON( "ts" << 2 ) );
- auto_ptr< DBClientCursor > c = _client.query( ns, QUERY( "ts" << GT << 1 ).hint( BSON( "$natural" << 1 ) ), 0, 0, 0, QueryOption_OplogReplay );
+ unique_ptr< DBClientCursor > c = _client.query( ns, QUERY( "ts" << GT << 1 ).hint( BSON( "$natural" << 1 ) ), 0, 0, 0, QueryOption_OplogReplay );
ASSERT( c->more() );
ASSERT_EQUALS( 2, c->next().getIntField( "ts" ) );
ASSERT( !c->more() );
@@ -645,7 +645,7 @@ namespace QueryTests {
insert( ns, BSON( "ts" << one ) );
insert( ns, BSON( "ts" << two ) );
insert( ns, BSON( "ts" << three ) );
- auto_ptr<DBClientCursor> c =
+ unique_ptr<DBClientCursor> c =
_client.query( ns, QUERY( "ts" << GTE << two ).hint( BSON( "$natural" << 1 ) ),
0, 0, 0, QueryOption_OplogReplay | QueryOption_CursorTailable );
ASSERT( c->more() );
@@ -668,7 +668,7 @@ namespace QueryTests {
insert( ns, BSON( "ts" << 0 ) );
insert( ns, BSON( "ts" << 1 ) );
insert( ns, BSON( "ts" << 2 ) );
- auto_ptr< DBClientCursor > c = _client.query(
+ unique_ptr< DBClientCursor > c = _client.query(
ns, QUERY( "ts" << GT << 1 ).hint( BSON( "$natural" << 1 ) ).explain(),
0, 0, 0, QueryOption_OplogReplay );
ASSERT( c->more() );
@@ -968,7 +968,7 @@ namespace QueryTests {
check( 1, 2, 2, 2, 2, hints[ i ] );
check( 1, 2, 2, 1, 1, hints[ i ] );
- auto_ptr< DBClientCursor > c = query( 1, 2, 2, 2, hints[ i ] );
+ unique_ptr< DBClientCursor > c = query( 1, 2, 2, 2, hints[ i ] );
BSONObj obj = c->next();
ASSERT_EQUALS( 1, obj.getIntField( "a" ) );
ASSERT_EQUALS( 2, obj.getIntField( "b" ) );
@@ -979,7 +979,7 @@ namespace QueryTests {
}
}
private:
- auto_ptr< DBClientCursor > query( int minA, int minB, int maxA, int maxB, const BSONObj &hint ) {
+ unique_ptr< DBClientCursor > query( int minA, int minB, int maxA, int maxB, const BSONObj &hint ) {
Query q;
q = q.minKey( BSON( "a" << minA << "b" << minB ) ).maxKey( BSON( "a" << maxA << "b" << maxB ) );
if ( !hint.isEmpty() )
@@ -989,7 +989,7 @@ namespace QueryTests {
void check( int minA, int minB, int maxA, int maxB, int expectedCount, const BSONObj &hint = empty_ ) {
ASSERT_EQUALS( expectedCount, count( query( minA, minB, maxA, maxB, hint ) ) );
}
- int count( auto_ptr< DBClientCursor > c ) {
+ int count( unique_ptr< DBClientCursor > c ) {
int ret = 0;
while( c->more() ) {
++ret;
@@ -1113,7 +1113,7 @@ namespace QueryTests {
_client.dropCollection( "unittests.querytests.DifferentNumbers" );
}
void t( const char * ns ) {
- auto_ptr< DBClientCursor > cursor = _client.query( ns, Query().sort( "7" ) );
+ unique_ptr< DBClientCursor > cursor = _client.query( ns, Query().sort( "7" ) );
while ( cursor->more() ) {
BSONObj o = cursor->next();
verify( o.valid() );
@@ -1214,7 +1214,7 @@ namespace QueryTests {
int a = count();
- auto_ptr< DBClientCursor > c = _client.query( ns() , QUERY( "i" << GT << 0 ).hint( BSON( "$natural" << 1 ) ), 0, 0, 0, QueryOption_CursorTailable );
+ unique_ptr< DBClientCursor > c = _client.query( ns() , QUERY( "i" << GT << 0 ).hint( BSON( "$natural" << 1 ) ), 0, 0, 0, QueryOption_CursorTailable );
int n=0;
while ( c->more() ) {
BSONObj z = c->next();
@@ -1362,7 +1362,7 @@ namespace QueryTests {
_client.insert( ns(), BSON( "ts" << i++ ) );
int min = _client.query( ns(), Query().sort( BSON( "$natural" << 1 ) ) )->next()[ "ts" ].numberInt();
for( int j = -1; j < i; ++j ) {
- auto_ptr< DBClientCursor > c = _client.query( ns(), QUERY( "ts" << GTE << j ), 0, 0, 0, QueryOption_OplogReplay );
+ unique_ptr< DBClientCursor > c = _client.query( ns(), QUERY( "ts" << GTE << j ), 0, 0, 0, QueryOption_OplogReplay );
ASSERT( c->more() );
BSONObj next = c->next();
ASSERT( !next[ "ts" ].eoo() );
@@ -1392,7 +1392,7 @@ namespace QueryTests {
_client.insert( ns(), BSON( "ts" << i++ ) );
int min = _client.query( ns(), Query().sort( BSON( "$natural" << 1 ) ) )->next()[ "ts" ].numberInt();
for( int j = -1; j < i; ++j ) {
- auto_ptr< DBClientCursor > c = _client.query( ns(), QUERY( "ts" << GTE << j ), 0, 0, 0, QueryOption_OplogReplay );
+ unique_ptr< DBClientCursor > c = _client.query( ns(), QUERY( "ts" << GTE << j ), 0, 0, 0, QueryOption_OplogReplay );
ASSERT( c->more() );
BSONObj next = c->next();
ASSERT( !next[ "ts" ].eoo() );
@@ -1418,14 +1418,14 @@ namespace QueryTests {
size_t startNumCursors = numCursorsOpen();
// Check OplogReplay mode with missing collection.
- auto_ptr< DBClientCursor > c0 = _client.query( ns(), QUERY( "ts" << GTE << 50 ), 0, 0, 0, QueryOption_OplogReplay );
+ unique_ptr< DBClientCursor > c0 = _client.query( ns(), QUERY( "ts" << GTE << 50 ), 0, 0, 0, QueryOption_OplogReplay );
ASSERT( !c0->more() );
BSONObj info;
ASSERT( _client.runCommand( "unittests", BSON( "create" << "querytests.findingstart" << "capped" << true << "$nExtents" << 5 << "autoIndexId" << false ), info ) );
// Check OplogReplay mode with empty collection.
- auto_ptr< DBClientCursor > c = _client.query( ns(), QUERY( "ts" << GTE << 50 ), 0, 0, 0, QueryOption_OplogReplay );
+ unique_ptr< DBClientCursor > c = _client.query( ns(), QUERY( "ts" << GTE << 50 ), 0, 0, 0, QueryOption_OplogReplay );
ASSERT( !c->more() );
// Check with some docs in the collection.
@@ -1495,7 +1495,7 @@ namespace QueryTests {
for( int i = 0; i < 150; ++i ) {
insert( ns(), BSONObj() );
}
- auto_ptr<DBClientCursor> c = _client.query( ns(), Query() );
+ unique_ptr<DBClientCursor> c = _client.query( ns(), Query() );
ASSERT( c->more() );
long long cursorId = c->getCursorId();
@@ -1521,7 +1521,7 @@ namespace QueryTests {
{
// With five results and a batch size of 5, a cursor is created since we don't know
// there are no more results.
- std::auto_ptr<DBClientCursor> c = _client.query( ns(), Query(), 5 );
+ std::unique_ptr<DBClientCursor> c = _client.query( ns(), Query(), 5 );
ASSERT(c->more());
ASSERT_NE(0, c->getCursorId());
for (int i = 0; i < 5; ++i) {
@@ -1533,7 +1533,7 @@ namespace QueryTests {
{
// With a batchsize of 6 we know there are no more results so we don't create a
// cursor.
- std::auto_ptr<DBClientCursor> c = _client.query( ns(), Query(), 6 );
+ std::unique_ptr<DBClientCursor> c = _client.query( ns(), Query(), 6 );
ASSERT(c->more());
ASSERT_EQ(0, c->getCursorId());
}
@@ -1549,7 +1549,7 @@ namespace QueryTests {
}
void run() {
_client.insert( ns(), vector<BSONObj>( 3, BSONObj() ) );
- auto_ptr<DBClientCursor> cursor = _client.query( ns(), BSONObj(), 0, 0, 0, 0, 2 );
+ unique_ptr<DBClientCursor> cursor = _client.query( ns(), BSONObj(), 0, 0, 0, 0, 2 );
ASSERT_EQUALS( 2, cursor->objsLeftInBatch() );
long long cursorId = cursor->getCursorId();
diff --git a/src/mongo/dbtests/repltests.cpp b/src/mongo/dbtests/repltests.cpp
index 74c250fc098..cb1872f6dd8 100644
--- a/src/mongo/dbtests/repltests.cpp
+++ b/src/mongo/dbtests/repltests.cpp
@@ -54,7 +54,7 @@ using namespace mongo::repl;
namespace ReplTests {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::string;
using std::stringstream;
@@ -120,7 +120,7 @@ namespace ReplTests {
check( o, one( o ) );
}
void checkAll( const BSONObj &o ) const {
- auto_ptr< DBClientCursor > c = _client.query( ns(), o );
+ unique_ptr< DBClientCursor > c = _client.query( ns(), o );
verify( c->more() );
while( c->more() ) {
check( o, c->next() );
@@ -718,7 +718,7 @@ namespace ReplTests {
string s() const {
stringstream ss;
- auto_ptr<DBClientCursor> cc = _client.query( ns() , Query().sort( BSON( "_id" << 1 ) ) );
+ unique_ptr<DBClientCursor> cc = _client.query( ns() , Query().sort( BSON( "_id" << 1 ) ) );
bool first = true;
while ( cc->more() ) {
if ( first ) first = false;
diff --git a/src/mongo/dbtests/sharding.cpp b/src/mongo/dbtests/sharding.cpp
index bd5ac493c24..9bc6068c9fb 100644
--- a/src/mongo/dbtests/sharding.cpp
+++ b/src/mongo/dbtests/sharding.cpp
@@ -48,7 +48,7 @@
namespace ShardingTests {
using boost::shared_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::make_pair;
using std::map;
using std::pair;
@@ -218,7 +218,7 @@ namespace ShardingTests {
string keyName = "_id";
createChunks( keyName );
- auto_ptr<DBClientCursor> cursor =
+ unique_ptr<DBClientCursor> cursor =
_client.query(ChunkType::ConfigNS, QUERY(ChunkType::ns(collName())));
set<int> minorVersions;
diff --git a/src/mongo/dbtests/threadedtests.cpp b/src/mongo/dbtests/threadedtests.cpp
index b03f5877e17..3ef74711c04 100644
--- a/src/mongo/dbtests/threadedtests.cpp
+++ b/src/mongo/dbtests/threadedtests.cpp
@@ -57,7 +57,7 @@
namespace ThreadedTests {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::cout;
using std::endl;
using std::string;
@@ -366,7 +366,7 @@ namespace ThreadedTests {
*/
RWLockRecursiveNongreedy lk( "eliot2" , 120 * 1000 );
cout << "RWLock impl: " << lk.implType() << endl;
- auto_ptr<RWLockRecursiveNongreedy::Shared> a( new RWLockRecursiveNongreedy::Shared(lk) );
+ unique_ptr<RWLockRecursiveNongreedy::Shared> a( new RWLockRecursiveNongreedy::Shared(lk) );
AtomicUInt32 x1(0);
cout << "A : " << &x1 << endl;
boost::thread t1( stdx::bind( worker1 , &lk , &x1 ) );
@@ -404,7 +404,7 @@ namespace ThreadedTests {
RWLockRecursiveNongreedy lk( "eliot2" , 120 * 1000 );
- auto_ptr<RWLockRecursiveNongreedy::Shared> a( new RWLockRecursiveNongreedy::Shared( lk ) );
+ unique_ptr<RWLockRecursiveNongreedy::Shared> a( new RWLockRecursiveNongreedy::Shared( lk ) );
AtomicUInt32 x2(0);
diff --git a/src/mongo/dbtests/updatetests.cpp b/src/mongo/dbtests/updatetests.cpp
index fa7271bcb6b..e5159780a6e 100644
--- a/src/mongo/dbtests/updatetests.cpp
+++ b/src/mongo/dbtests/updatetests.cpp
@@ -45,7 +45,7 @@
namespace UpdateTests {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::numeric_limits;
using std::string;
using std::stringstream;
@@ -375,7 +375,7 @@ namespace UpdateTests {
string s() {
stringstream ss;
- auto_ptr<DBClientCursor> cc = _client.query( ns() , Query().sort( BSON( "_id" << 1 ) ) );
+ unique_ptr<DBClientCursor> cc = _client.query( ns() , Query().sort( BSON( "_id" << 1 ) ) );
bool first = true;
while ( cc->more() ) {
if ( first ) first = false;
diff --git a/src/mongo/logger/log_domain.h b/src/mongo/logger/log_domain.h
index f55f04dd6f4..715e5822ed0 100644
--- a/src/mongo/logger/log_domain.h
+++ b/src/mongo/logger/log_domain.h
@@ -81,7 +81,7 @@ namespace logger {
};
// TODO(schwerin): Replace with unique_ptr in C++11.
- typedef std::auto_ptr<EventAppender> AppenderAutoPtr;
+ typedef std::unique_ptr<EventAppender> AppenderAutoPtr;
LogDomain();
~LogDomain();
@@ -118,7 +118,7 @@ namespace logger {
/**
* Detaches the appender referenced by "handle" from this domain, releasing ownership of it.
- * Returns an auto_ptr to the handler to the caller, who is now responsible for its
+ * Returns an unique_ptr to the handler to the caller, who is now responsible for its
* deletion. Caller should consider "handle" is invalid after this call.
*/
AppenderAutoPtr detachAppender(AppenderHandle handle);
diff --git a/src/mongo/logger/log_test.cpp b/src/mongo/logger/log_test.cpp
index ca60eb28040..7983c6a4ea8 100644
--- a/src/mongo/logger/log_test.cpp
+++ b/src/mongo/logger/log_test.cpp
@@ -93,7 +93,7 @@ namespace {
ASSERT_EQUALS(0, dynamic_cast<CountAppender*>(countAppender.get())->getCount());
// Appending to the domain after attaching the appender does affect the appender.
- MessageLogDomain::AppenderHandle handle = domain.attachAppender(countAppender);
+ MessageLogDomain::AppenderHandle handle = domain.attachAppender(std::move(countAppender));
domain.append(MessageEventEphemeral(Date_t(), LogSeverity::Log(), "", "2"));
countAppender = domain.detachAppender(handle);
ASSERT_EQUALS(1, dynamic_cast<CountAppender*>(countAppender.get())->getCount());
diff --git a/src/mongo/logger/rotatable_file_manager.cpp b/src/mongo/logger/rotatable_file_manager.cpp
index c5e9a3245d6..88f95c37dbf 100644
--- a/src/mongo/logger/rotatable_file_manager.cpp
+++ b/src/mongo/logger/rotatable_file_manager.cpp
@@ -49,7 +49,7 @@ namespace logger {
return StatusWithRotatableFileWriter(ErrorCodes::FileAlreadyOpen,
"File \"" + fileName + "\" already opened.");
}
- std::auto_ptr<RotatableFileWriter> writer(new RotatableFileWriter);
+ std::unique_ptr<RotatableFileWriter> writer(new RotatableFileWriter);
RotatableFileWriter::Use writerUse(writer.get());
Status status = writerUse.setFileName(fileName, append);
if (!status.isOK())
diff --git a/src/mongo/s/balance.cpp b/src/mongo/s/balance.cpp
index af8e79eca0c..89104383807 100644
--- a/src/mongo/s/balance.cpp
+++ b/src/mongo/s/balance.cpp
@@ -67,7 +67,7 @@ namespace mongo {
using boost::scoped_ptr;
using boost::shared_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::map;
using std::set;
using std::string;
diff --git a/src/mongo/s/catalog/catalog_manager.cpp b/src/mongo/s/catalog/catalog_manager.cpp
index 44b0f78dbf1..02da9c79c58 100644
--- a/src/mongo/s/catalog/catalog_manager.cpp
+++ b/src/mongo/s/catalog/catalog_manager.cpp
@@ -44,7 +44,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
namespace {
@@ -78,7 +78,7 @@ namespace {
const BSONObj& doc,
BatchedCommandResponse* response) {
- auto_ptr<BatchedInsertRequest> insert(new BatchedInsertRequest());
+ unique_ptr<BatchedInsertRequest> insert(new BatchedInsertRequest());
insert->addToDocuments(doc);
BatchedCommandRequest request(insert.release());
@@ -91,7 +91,7 @@ namespace {
}
// Make sure to add ids to the request, since this is an insert operation
- auto_ptr<BatchedCommandRequest> requestWithIds(
+ unique_ptr<BatchedCommandRequest> requestWithIds(
BatchedCommandRequest::cloneWithIds(request));
const BatchedCommandRequest& requestToSend =
requestWithIds.get() ? *requestWithIds : request;
@@ -107,13 +107,13 @@ namespace {
bool multi,
BatchedCommandResponse* response) {
- auto_ptr<BatchedUpdateDocument> updateDoc(new BatchedUpdateDocument());
+ unique_ptr<BatchedUpdateDocument> updateDoc(new BatchedUpdateDocument());
updateDoc->setQuery(query);
updateDoc->setUpdateExpr(update);
updateDoc->setUpsert(upsert);
updateDoc->setMulti(multi);
- auto_ptr<BatchedUpdateRequest> updateRequest(new BatchedUpdateRequest());
+ unique_ptr<BatchedUpdateRequest> updateRequest(new BatchedUpdateRequest());
updateRequest->addToUpdates(updateDoc.release());
updateRequest->setWriteConcern(WriteConcernOptions::Majority);
@@ -134,11 +134,11 @@ namespace {
int limit,
BatchedCommandResponse* response) {
- auto_ptr<BatchedDeleteDocument> deleteDoc(new BatchedDeleteDocument);
+ unique_ptr<BatchedDeleteDocument> deleteDoc(new BatchedDeleteDocument);
deleteDoc->setQuery(query);
deleteDoc->setLimit(limit);
- auto_ptr<BatchedDeleteRequest> deleteRequest(new BatchedDeleteRequest());
+ unique_ptr<BatchedDeleteRequest> deleteRequest(new BatchedDeleteRequest());
deleteRequest->addToDeletes(deleteDoc.release());
deleteRequest->setWriteConcern(WriteConcernOptions::Majority);
diff --git a/src/mongo/s/catalog/legacy/cluster_client_internal.cpp b/src/mongo/s/catalog/legacy/cluster_client_internal.cpp
index ce698c1b6f1..3ad791e13ce 100644
--- a/src/mongo/s/catalog/legacy/cluster_client_internal.cpp
+++ b/src/mongo/s/catalog/legacy/cluster_client_internal.cpp
@@ -46,7 +46,7 @@
namespace mongo {
using boost::scoped_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::string;
using std::vector;
@@ -223,7 +223,7 @@ namespace mongo {
}
// Helper function for safe cursors
- DBClientCursor* _safeCursor(auto_ptr<DBClientCursor> cursor) {
+ DBClientCursor* _safeCursor(unique_ptr<DBClientCursor> cursor) {
// TODO: Make error handling more consistent, it's annoying that cursors error out by
// throwing exceptions *and* being empty
uassert(16625, str::stream() << "cursor not found, transport error", cursor.get());
diff --git a/src/mongo/s/catalog/legacy/cluster_client_internal.h b/src/mongo/s/catalog/legacy/cluster_client_internal.h
index f6e764a80e0..8a140e171cd 100644
--- a/src/mongo/s/catalog/legacy/cluster_client_internal.h
+++ b/src/mongo/s/catalog/legacy/cluster_client_internal.h
@@ -55,6 +55,6 @@ namespace mongo {
// Helper function which throws for invalid cursor initialization.
// Note: cursor ownership will be passed to this function.
- DBClientCursor* _safeCursor(std::auto_ptr<DBClientCursor> cursor);
+ DBClientCursor* _safeCursor(std::unique_ptr<DBClientCursor> cursor);
}
diff --git a/src/mongo/s/catalog/legacy/config_upgrade_helpers.cpp b/src/mongo/s/catalog/legacy/config_upgrade_helpers.cpp
index b62a6dfe0c2..d6b300db8a1 100644
--- a/src/mongo/s/catalog/legacy/config_upgrade_helpers.cpp
+++ b/src/mongo/s/catalog/legacy/config_upgrade_helpers.cpp
@@ -47,7 +47,7 @@
namespace mongo {
using boost::scoped_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::string;
diff --git a/src/mongo/s/catalog/legacy/distlock.cpp b/src/mongo/s/catalog/legacy/distlock.cpp
index 97a48af810d..48379989edc 100644
--- a/src/mongo/s/catalog/legacy/distlock.cpp
+++ b/src/mongo/s/catalog/legacy/distlock.cpp
@@ -45,7 +45,7 @@
namespace mongo {
using boost::scoped_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::list;
using std::set;
diff --git a/src/mongo/s/chunk.cpp b/src/mongo/s/chunk.cpp
index a68a7fa90ed..ffefe5829eb 100644
--- a/src/mongo/s/chunk.cpp
+++ b/src/mongo/s/chunk.cpp
@@ -57,7 +57,7 @@
namespace mongo {
using boost::shared_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::map;
using std::ostringstream;
using std::set;
@@ -260,7 +260,7 @@ namespace {
// Splitting close to the lower bound means that the split point will be the
// upper bound. Chunk range upper bounds are exclusive so skip a document to
// make the lower half of the split end up with a single document.
- auto_ptr<DBClientCursor> cursor = conn->query(_manager->getns(),
+ unique_ptr<DBClientCursor> cursor = conn->query(_manager->getns(),
q,
1, /* nToReturn */
1 /* nToSkip */);
diff --git a/src/mongo/s/chunk_manager_targeter_test.cpp b/src/mongo/s/chunk_manager_targeter_test.cpp
index fe798dcfa92..85e674fd1c1 100644
--- a/src/mongo/s/chunk_manager_targeter_test.cpp
+++ b/src/mongo/s/chunk_manager_targeter_test.cpp
@@ -42,7 +42,7 @@ namespace {
using namespace mongo;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::make_pair;
/**
@@ -66,7 +66,7 @@ namespace {
const char* queryStr,
const IndexBounds& expectedBounds) {
- auto_ptr<CanonicalQuery> query(canonicalize(queryStr));
+ unique_ptr<CanonicalQuery> query(canonicalize(queryStr));
ASSERT(query.get() != NULL);
BSONObj key = fromjson(keyStr);
@@ -88,7 +88,7 @@ namespace {
// Assume shard key is { a: 1 }
void checkIndexBounds(const char* queryStr, const OrderedIntervalList& expectedOil) {
- auto_ptr<CanonicalQuery> query(canonicalize(queryStr));
+ unique_ptr<CanonicalQuery> query(canonicalize(queryStr));
ASSERT(query.get() != NULL);
BSONObj key = fromjson("{a: 1}");
@@ -278,7 +278,7 @@ namespace {
Interval expectedInterval(BSON("" << 1 << "" << 1), true, true);
const char* queryStr = "{foo: {$all: [ {$elemMatch: {a:1, b:1}} ]}}";
- auto_ptr<CanonicalQuery> query(canonicalize(queryStr));
+ unique_ptr<CanonicalQuery> query(canonicalize(queryStr));
ASSERT(query.get() != NULL);
BSONObj key = fromjson("{'foo.a': 1}");
@@ -355,7 +355,7 @@ namespace {
// { a: 0 } -> hashed a: [hash(0), hash(0)]
TEST(CMCollapseTreeTest, HashedSinglePoint) {
const char* queryStr = "{ a: 0 }";
- auto_ptr<CanonicalQuery> query(canonicalize(queryStr));
+ unique_ptr<CanonicalQuery> query(canonicalize(queryStr));
ASSERT(query.get() != NULL);
BSONObj key = fromjson("{a: 'hashed'}");
diff --git a/src/mongo/s/client/scc_fast_query_handler.cpp b/src/mongo/s/client/scc_fast_query_handler.cpp
index 70894893f18..f09dd767a21 100644
--- a/src/mongo/s/client/scc_fast_query_handler.cpp
+++ b/src/mongo/s/client/scc_fast_query_handler.cpp
@@ -45,7 +45,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::string;
using std::vector;
@@ -94,7 +94,7 @@ namespace mongo {
// operation must then be correctly discarded by the calling thread.
//
- auto_ptr<DBClientCursor> cursor;
+ unique_ptr<DBClientCursor> cursor;
try {
@@ -225,7 +225,7 @@ namespace mongo {
return hosts;
}
- auto_ptr<DBClientCursor> SCCFastQueryHandler::handleQuery(const vector<string>& hostStrings,
+ unique_ptr<DBClientCursor> SCCFastQueryHandler::handleQuery(const vector<string>& hostStrings,
const string& ns,
Query query,
int nToReturn,
@@ -250,7 +250,7 @@ namespace mongo {
30 * 1000);
uassertStatusOK(status.getStatus());
- auto_ptr<DBClientCursor> cursor(status.getValue());
+ unique_ptr<DBClientCursor> cursor(status.getValue());
return cursor;
}
diff --git a/src/mongo/s/client/scc_fast_query_handler.h b/src/mongo/s/client/scc_fast_query_handler.h
index 3cf1af119d1..bc942556389 100644
--- a/src/mongo/s/client/scc_fast_query_handler.h
+++ b/src/mongo/s/client/scc_fast_query_handler.h
@@ -56,7 +56,7 @@ namespace mongo {
virtual bool canHandleQuery(const std::string& ns, Query query);
- virtual std::auto_ptr<DBClientCursor> handleQuery(const std::vector<std::string>& hostStrings,
+ virtual std::unique_ptr<DBClientCursor> handleQuery(const std::vector<std::string>& hostStrings,
const std::string &ns,
Query query,
int nToReturn,
diff --git a/src/mongo/s/client/shard_connection.cpp b/src/mongo/s/client/shard_connection.cpp
index df4a34fdc88..225b4c80b05 100644
--- a/src/mongo/s/client/shard_connection.cpp
+++ b/src/mongo/s/client/shard_connection.cpp
@@ -49,7 +49,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::map;
using std::set;
using std::string;
@@ -208,7 +208,7 @@ namespace {
Status* s = _getStatus(addr);
- auto_ptr<DBClientBase> c;
+ unique_ptr<DBClientBase> c;
if (s->avail) {
c.reset(s->avail);
s->avail = 0;
diff --git a/src/mongo/s/cluster_write.cpp b/src/mongo/s/cluster_write.cpp
index 8145ee80530..0fcc15e539d 100644
--- a/src/mongo/s/cluster_write.cpp
+++ b/src/mongo/s/cluster_write.cpp
@@ -52,7 +52,7 @@
namespace mongo {
using boost::shared_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::vector;
using std::map;
using std::string;
@@ -166,7 +166,7 @@ namespace mongo {
BSONObj indexDoc = createIndexDoc(ns, keys, unique);
// Go through the shard insert path
- std::auto_ptr<BatchedInsertRequest> insert(new BatchedInsertRequest());
+ std::unique_ptr<BatchedInsertRequest> insert(new BatchedInsertRequest());
insert->addToDocuments(indexDoc);
BatchedCommandRequest request(insert.release());
@@ -208,7 +208,7 @@ namespace mongo {
BatchedCommandResponse* response ) {
// Add _ids to insert request if req'd
- auto_ptr<BatchedCommandRequest> idRequest(BatchedCommandRequest::cloneWithIds(origRequest));
+ unique_ptr<BatchedCommandRequest> idRequest(BatchedCommandRequest::cloneWithIds(origRequest));
const BatchedCommandRequest& request = NULL != idRequest.get() ? *idRequest : origRequest;
const NamespaceString& nss = request.getNSS();
diff --git a/src/mongo/s/collection_metadata.cpp b/src/mongo/s/collection_metadata.cpp
index de9e05ebca4..98f62c90a01 100644
--- a/src/mongo/s/collection_metadata.cpp
+++ b/src/mongo/s/collection_metadata.cpp
@@ -38,7 +38,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::make_pair;
using std::string;
@@ -104,7 +104,7 @@ namespace mongo {
return NULL;
}
- auto_ptr<CollectionMetadata> metadata( new CollectionMetadata );
+ unique_ptr<CollectionMetadata> metadata( new CollectionMetadata );
metadata->_keyPattern = this->_keyPattern;
metadata->_keyPattern.getOwned();
metadata->fillKeyPatternFields();
@@ -157,7 +157,7 @@ namespace mongo {
return NULL;
}
- auto_ptr<CollectionMetadata> metadata( new CollectionMetadata );
+ unique_ptr<CollectionMetadata> metadata( new CollectionMetadata );
metadata->_keyPattern = this->_keyPattern;
metadata->_keyPattern.getOwned();
metadata->fillKeyPatternFields();
@@ -201,7 +201,7 @@ namespace mongo {
return NULL;
}
- auto_ptr<CollectionMetadata> metadata( new CollectionMetadata );
+ unique_ptr<CollectionMetadata> metadata( new CollectionMetadata );
metadata->_keyPattern = this->_keyPattern;
metadata->_keyPattern.getOwned();
metadata->fillKeyPatternFields();
@@ -237,7 +237,7 @@ namespace mongo {
return NULL;
}
- auto_ptr<CollectionMetadata> metadata( new CollectionMetadata );
+ unique_ptr<CollectionMetadata> metadata( new CollectionMetadata );
metadata->_keyPattern = this->_keyPattern;
metadata->_keyPattern.getOwned();
metadata->fillKeyPatternFields();
@@ -338,7 +338,7 @@ namespace mongo {
}
}
- auto_ptr<CollectionMetadata> metadata(new CollectionMetadata);
+ unique_ptr<CollectionMetadata> metadata(new CollectionMetadata);
metadata->_keyPattern = this->_keyPattern;
metadata->_keyPattern.getOwned();
metadata->fillKeyPatternFields();
@@ -427,7 +427,7 @@ namespace mongo {
return NULL;
}
- auto_ptr<CollectionMetadata> metadata( new CollectionMetadata );
+ unique_ptr<CollectionMetadata> metadata( new CollectionMetadata );
metadata->_keyPattern = this->_keyPattern;
metadata->_keyPattern.getOwned();
metadata->fillKeyPatternFields();
diff --git a/src/mongo/s/collection_metadata_test.cpp b/src/mongo/s/collection_metadata_test.cpp
index cb8bdfebc02..ac233249729 100644
--- a/src/mongo/s/collection_metadata_test.cpp
+++ b/src/mongo/s/collection_metadata_test.cpp
@@ -49,7 +49,7 @@ namespace {
using namespace mongo;
using boost::scoped_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::make_pair;
using std::string;
using std::vector;
diff --git a/src/mongo/s/commands/cluster_find_cmd.cpp b/src/mongo/s/commands/cluster_find_cmd.cpp
index f92c486c6ee..648a1fe5256 100644
--- a/src/mongo/s/commands/cluster_find_cmd.cpp
+++ b/src/mongo/s/commands/cluster_find_cmd.cpp
@@ -36,7 +36,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
using std::vector;
@@ -97,7 +97,7 @@ namespace mongo {
if (!lpqStatus.isOK()) {
return lpqStatus;
}
- auto_ptr<LiteParsedQuery> lpq(rawLpq);
+ unique_ptr<LiteParsedQuery> lpq(rawLpq);
BSONObjBuilder explainCmdBob;
ClusterExplain::wrapAsExplain(cmdObj, verbosity, &explainCmdBob);
diff --git a/src/mongo/s/commands/cluster_pipeline_cmd.cpp b/src/mongo/s/commands/cluster_pipeline_cmd.cpp
index 201e7cfe5ed..a5b039797a7 100644
--- a/src/mongo/s/commands/cluster_pipeline_cmd.cpp
+++ b/src/mongo/s/commands/cluster_pipeline_cmd.cpp
@@ -387,12 +387,12 @@ namespace {
"should only be running an aggregate command here",
str::equals(cmd.firstElementFieldName(), "aggregate"));
- scoped_ptr<DBClientCursor> cursor(conn->query(db + ".$cmd",
- cmd,
- -1, // nToReturn
- 0, // nToSkip
- NULL, // fieldsToReturn
- queryOptions));
+ auto cursor = conn->query(db + ".$cmd",
+ cmd,
+ -1, // nToReturn
+ 0, // nToSkip
+ NULL, // fieldsToReturn
+ queryOptions);
massert(17014,
str::stream() << "aggregate command didn't return results on host: "
<< conn->toString(),
diff --git a/src/mongo/s/config.cpp b/src/mongo/s/config.cpp
index a39c6622e0a..3794d16adf4 100644
--- a/src/mongo/s/config.cpp
+++ b/src/mongo/s/config.cpp
@@ -58,7 +58,7 @@
namespace mongo {
using boost::scoped_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::set;
using std::string;
@@ -341,7 +341,7 @@ namespace mongo {
// we are not locked now, and want to load a new ChunkManager
- auto_ptr<ChunkManager> tempChunkManager;
+ unique_ptr<ChunkManager> tempChunkManager;
{
boost::lock_guard<boost::mutex> lll ( _hitConfigServerLock );
diff --git a/src/mongo/s/d_split.cpp b/src/mongo/s/d_split.cpp
index 04de751a85d..98d62c7029a 100644
--- a/src/mongo/s/d_split.cpp
+++ b/src/mongo/s/d_split.cpp
@@ -67,7 +67,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::ostringstream;
using std::set;
@@ -172,7 +172,7 @@ namespace mongo {
max = Helpers::toKeyFormat( kp.extendRangeBound( max, false ) );
}
- auto_ptr<PlanExecutor> exec(InternalPlanner::indexScan(txn, collection, idx,
+ unique_ptr<PlanExecutor> exec(InternalPlanner::indexScan(txn, collection, idx,
min, max, false,
InternalPlanner::FORWARD));
exec->setYieldPolicy(PlanExecutor::YIELD_AUTO);
@@ -411,7 +411,7 @@ namespace mongo {
long long currCount = 0;
long long numChunks = 0;
- auto_ptr<PlanExecutor> exec(
+ unique_ptr<PlanExecutor> exec(
InternalPlanner::indexScan(txn, collection, idx, min, max,
false, InternalPlanner::FORWARD));
@@ -762,7 +762,7 @@ namespace mongo {
updates.append( op.obj() );
// remember this chunk info for logging later
- auto_ptr<ChunkType> chunk(new ChunkType());
+ unique_ptr<ChunkType> chunk(new ChunkType());
chunk->setMin(startKey);
chunk->setMax(endKey);
chunk->setVersion(nextChunkVersion);
@@ -914,7 +914,7 @@ namespace mongo {
BSONObj newmin = Helpers::toKeyFormat(kp.extendRangeBound(chunk->getMin(), false));
BSONObj newmax = Helpers::toKeyFormat(kp.extendRangeBound(chunk->getMax(), true));
- auto_ptr<PlanExecutor> exec(
+ unique_ptr<PlanExecutor> exec(
InternalPlanner::indexScan(txn, collection, idx, newmin, newmax, false));
// check if exactly one document found
diff --git a/src/mongo/s/metadata_loader.cpp b/src/mongo/s/metadata_loader.cpp
index 17eeb356ff1..74ca1597a7d 100644
--- a/src/mongo/s/metadata_loader.cpp
+++ b/src/mongo/s/metadata_loader.cpp
@@ -44,7 +44,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::endl;
using std::make_pair;
using std::map;
diff --git a/src/mongo/s/metadata_loader_test.cpp b/src/mongo/s/metadata_loader_test.cpp
index 8f34ec843a5..112873824f9 100644
--- a/src/mongo/s/metadata_loader_test.cpp
+++ b/src/mongo/s/metadata_loader_test.cpp
@@ -51,7 +51,7 @@ namespace {
using namespace mongo;
using boost::scoped_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
using std::vector;
@@ -504,7 +504,7 @@ namespace {
};
TEST_F(MultipleMetadataFixture, PromotePendingNA) {
- auto_ptr<ChunkType> chunk( new ChunkType() );
+ unique_ptr<ChunkType> chunk( new ChunkType() );
chunk->setNS("foo.bar");
chunk->setShard("shard0000");
chunk->setMin( BSON( "x" << MINKEY ) );
@@ -542,7 +542,7 @@ namespace {
TEST_F(MultipleMetadataFixture, PromotePendingNAVersion) {
OID epoch = OID::gen();
- auto_ptr<ChunkType> chunk( new ChunkType() );
+ unique_ptr<ChunkType> chunk( new ChunkType() );
chunk->setNS("foo.bar");
chunk->setShard("shard0000");
chunk->setMin( BSON( "x" << MINKEY ) );
@@ -587,7 +587,7 @@ namespace {
OwnedPointerVector<ChunkType> chunks;
- auto_ptr<ChunkType> chunk( new ChunkType() );
+ unique_ptr<ChunkType> chunk( new ChunkType() );
chunk->setNS("foo.bar");
chunk->setShard("shard0000");
chunk->setMin( BSON( "x" << MINKEY ) );
@@ -672,7 +672,7 @@ namespace {
OwnedPointerVector<ChunkType> chunks;
- auto_ptr<ChunkType> chunk( new ChunkType() );
+ unique_ptr<ChunkType> chunk( new ChunkType() );
chunk->setNS("foo.bar");
chunk->setShard("shard0000");
chunk->setMin( BSON( "x" << MINKEY ) );
diff --git a/src/mongo/s/shard_key_pattern.cpp b/src/mongo/s/shard_key_pattern.cpp
index 6669d68b007..613eb84a2bc 100644
--- a/src/mongo/s/shard_key_pattern.cpp
+++ b/src/mongo/s/shard_key_pattern.cpp
@@ -44,7 +44,7 @@ namespace mongo {
using boost::scoped_ptr;
using boost::shared_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::pair;
using std::make_pair;
using std::vector;
diff --git a/src/mongo/s/write_ops/batch_downconvert.h b/src/mongo/s/write_ops/batch_downconvert.h
index 1c48b4e0ef1..e3c6cc56f6a 100644
--- a/src/mongo/s/write_ops/batch_downconvert.h
+++ b/src/mongo/s/write_ops/batch_downconvert.h
@@ -69,8 +69,8 @@ namespace mongo {
// Helper that acts as an auto-ptr for write and wc errors
struct GLEErrors {
- std::auto_ptr<WriteErrorDetail> writeError;
- std::auto_ptr<WCErrorDetail> wcError;
+ std::unique_ptr<WriteErrorDetail> writeError;
+ std::unique_ptr<WCErrorDetail> wcError;
};
/**
diff --git a/src/mongo/s/write_ops/batch_upconvert.cpp b/src/mongo/s/write_ops/batch_upconvert.cpp
index e81d35ea9db..e3c37249255 100644
--- a/src/mongo/s/write_ops/batch_upconvert.cpp
+++ b/src/mongo/s/write_ops/batch_upconvert.cpp
@@ -46,7 +46,7 @@ namespace mongo {
using boost::scoped_ptr;
using mongoutils::str::stream;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
using std::vector;
@@ -54,7 +54,7 @@ namespace mongo {
int opType = msg.operation();
- auto_ptr<BatchedCommandRequest> request;
+ unique_ptr<BatchedCommandRequest> request;
if ( opType == dbInsert ) {
msgToBatchInserts( msg, requests );
}
diff --git a/src/mongo/s/write_ops/batch_write_exec.h b/src/mongo/s/write_ops/batch_write_exec.h
index 90907a47443..a55f716194a 100644
--- a/src/mongo/s/write_ops/batch_write_exec.h
+++ b/src/mongo/s/write_ops/batch_write_exec.h
@@ -93,7 +93,7 @@ namespace mongo {
MultiCommandDispatch* _dispatcher;
// Stats
- std::auto_ptr<BatchWriteExecStats> _stats;
+ std::unique_ptr<BatchWriteExecStats> _stats;
};
struct HostOpTime {
diff --git a/src/mongo/s/write_ops/batch_write_op.cpp b/src/mongo/s/write_ops/batch_write_op.cpp
index c12c36d328e..b1032410c7a 100644
--- a/src/mongo/s/write_ops/batch_write_op.cpp
+++ b/src/mongo/s/write_ops/batch_write_op.cpp
@@ -32,7 +32,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::make_pair;
using std::set;
using std::stringstream;
@@ -485,7 +485,7 @@ namespace mongo {
request->setOrdered( _clientRequest->getOrdered() );
}
- auto_ptr<BatchedRequestMetadata> requestMetadata( new BatchedRequestMetadata() );
+ unique_ptr<BatchedRequestMetadata> requestMetadata( new BatchedRequestMetadata() );
requestMetadata->setShardName( targetedBatch.getEndpoint().shardName );
requestMetadata->setShardVersion( targetedBatch.getEndpoint().shardVersion );
requestMetadata->setSession( 0 );
@@ -585,7 +585,7 @@ namespace mongo {
// Special handling for write concern errors, save for later
if ( response.isWriteConcernErrorSet() ) {
- auto_ptr<ShardWCError> wcError( new ShardWCError( targetedBatch.getEndpoint(),
+ unique_ptr<ShardWCError> wcError( new ShardWCError( targetedBatch.getEndpoint(),
*response.getWriteConcernError() ));
_wcErrors.mutableVector().push_back( wcError.release() );
}
@@ -688,7 +688,7 @@ namespace mongo {
int numErrors = ordered ? 1 : numWrites;
for ( int i = 0; i < numErrors; i++ ) {
- auto_ptr<WriteErrorDetail> errorClone( new WriteErrorDetail );
+ unique_ptr<WriteErrorDetail> errorClone( new WriteErrorDetail );
error.cloneTo( errorClone.get() );
errorClone->setIndex( i );
writeErrResponse->addToErrDetails( errorClone.release() );
diff --git a/src/mongo/s/write_ops/batch_write_op_test.cpp b/src/mongo/s/write_ops/batch_write_op_test.cpp
index 4c55036627c..6a00115531b 100644
--- a/src/mongo/s/write_ops/batch_write_op_test.cpp
+++ b/src/mongo/s/write_ops/batch_write_op_test.cpp
@@ -37,7 +37,7 @@
namespace {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
using std::vector;
@@ -135,7 +135,7 @@ namespace {
int index,
BatchedCommandResponse* response ) {
- auto_ptr<WriteErrorDetail> error( new WriteErrorDetail );
+ unique_ptr<WriteErrorDetail> error( new WriteErrorDetail );
error->setErrCode( code );
error->setErrMessage( message );
error->setIndex( index );
@@ -145,7 +145,7 @@ namespace {
static void addWCError( BatchedCommandResponse* response ) {
- auto_ptr<WCErrorDetail> error( new WCErrorDetail );
+ unique_ptr<WCErrorDetail> error( new WCErrorDetail );
error->setErrCode( ErrorCodes::WriteConcernFailed );
error->setErrMessage( "mock wc error" );
diff --git a/src/mongo/s/write_ops/batched_command_request.cpp b/src/mongo/s/write_ops/batched_command_request.cpp
index e4f39905a12..b3f4d9911bb 100644
--- a/src/mongo/s/write_ops/batched_command_request.cpp
+++ b/src/mongo/s/write_ops/batched_command_request.cpp
@@ -33,7 +33,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
using std::vector;
@@ -295,7 +295,7 @@ namespace mongo {
|| origCmdRequest.isInsertIndexRequest())
return NULL;
- auto_ptr<BatchedInsertRequest> idRequest;
+ unique_ptr<BatchedInsertRequest> idRequest;
BatchedInsertRequest* origRequest = origCmdRequest.getInsertRequest();
const vector<BSONObj>& inserts = origRequest->getDocuments();
diff --git a/src/mongo/s/write_ops/batched_command_response.cpp b/src/mongo/s/write_ops/batched_command_response.cpp
index 2af007c4602..cce5fa660cc 100644
--- a/src/mongo/s/write_ops/batched_command_response.cpp
+++ b/src/mongo/s/write_ops/batched_command_response.cpp
@@ -33,7 +33,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
using mongoutils::str::stream;
@@ -408,7 +408,7 @@ namespace mongo {
for (std::vector<BatchedUpsertDetail*>::const_iterator it = upsertDetails.begin();
it != upsertDetails.end();
++it) {
- auto_ptr<BatchedUpsertDetail> tempBatchedUpsertDetail(new BatchedUpsertDetail);
+ unique_ptr<BatchedUpsertDetail> tempBatchedUpsertDetail(new BatchedUpsertDetail);
(*it)->cloneTo(tempBatchedUpsertDetail.get());
addToUpsertDetails(tempBatchedUpsertDetail.release());
}
@@ -493,7 +493,7 @@ namespace mongo {
for (std::vector<WriteErrorDetail*>::const_iterator it = errDetails.begin();
it != errDetails.end();
++it) {
- auto_ptr<WriteErrorDetail> tempBatchErrorDetail(new WriteErrorDetail);
+ unique_ptr<WriteErrorDetail> tempBatchErrorDetail(new WriteErrorDetail);
(*it)->cloneTo(tempBatchErrorDetail.get());
addToErrDetails(tempBatchErrorDetail.release());
}
diff --git a/src/mongo/s/write_ops/batched_delete_request.cpp b/src/mongo/s/write_ops/batched_delete_request.cpp
index a1f3b6cd049..b0c6a3f7a7a 100644
--- a/src/mongo/s/write_ops/batched_delete_request.cpp
+++ b/src/mongo/s/write_ops/batched_delete_request.cpp
@@ -33,7 +33,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
using mongoutils::str::stream;
@@ -161,7 +161,7 @@ namespace mongo {
for(std::vector<BatchedDeleteDocument*>::const_iterator it = _deletes.begin();
it != _deletes.end();
++it) {
- auto_ptr<BatchedDeleteDocument> tempBatchDeleteDocument(new BatchedDeleteDocument);
+ unique_ptr<BatchedDeleteDocument> tempBatchDeleteDocument(new BatchedDeleteDocument);
(*it)->cloneTo(tempBatchDeleteDocument.get());
other->addToDeletes(tempBatchDeleteDocument.release());
}
@@ -211,7 +211,7 @@ namespace mongo {
for (std::vector<BatchedDeleteDocument*>::const_iterator it = deletes.begin();
it != deletes.end();
++it) {
- auto_ptr<BatchedDeleteDocument> tempBatchDeleteDocument(new BatchedDeleteDocument);
+ unique_ptr<BatchedDeleteDocument> tempBatchDeleteDocument(new BatchedDeleteDocument);
(*it)->cloneTo(tempBatchDeleteDocument.get());
addToDeletes(tempBatchDeleteDocument.release());
}
diff --git a/src/mongo/s/write_ops/batched_insert_request_test.cpp b/src/mongo/s/write_ops/batched_insert_request_test.cpp
index ba553e254b4..5be837ae17a 100644
--- a/src/mongo/s/write_ops/batched_insert_request_test.cpp
+++ b/src/mongo/s/write_ops/batched_insert_request_test.cpp
@@ -37,7 +37,7 @@
namespace {
using namespace mongo;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
TEST(RoundTrip, Normal) {
@@ -83,7 +83,7 @@ namespace {
request.addToDocuments(insertA);
request.addToDocuments(insertB);
- auto_ptr<BatchedCommandRequest> idCmdRequest;
+ unique_ptr<BatchedCommandRequest> idCmdRequest;
idCmdRequest.reset(BatchedCommandRequest::cloneWithIds(cmdRequest));
ASSERT(idCmdRequest.get());
@@ -112,7 +112,7 @@ namespace {
request.addToDocuments(insertB);
request.addToDocuments(insertC);
- auto_ptr<BatchedCommandRequest> idCmdRequest;
+ unique_ptr<BatchedCommandRequest> idCmdRequest;
idCmdRequest.reset(BatchedCommandRequest::cloneWithIds(cmdRequest));
ASSERT(idCmdRequest.get());
@@ -141,7 +141,7 @@ namespace {
request.addToDocuments(insertA);
request.addToDocuments(insertB);
- auto_ptr<BatchedCommandRequest> idCmdRequest;
+ unique_ptr<BatchedCommandRequest> idCmdRequest;
idCmdRequest.reset(BatchedCommandRequest::cloneWithIds(cmdRequest));
ASSERT(!idCmdRequest.get());
}
diff --git a/src/mongo/s/write_ops/batched_request_metadata.cpp b/src/mongo/s/write_ops/batched_request_metadata.cpp
index d2f83929b0c..e3403196151 100644
--- a/src/mongo/s/write_ops/batched_request_metadata.cpp
+++ b/src/mongo/s/write_ops/batched_request_metadata.cpp
@@ -32,7 +32,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
const BSONField<string> BatchedRequestMetadata::shardName("shardName");
@@ -139,7 +139,7 @@ namespace mongo {
}
void BatchedRequestMetadata::setShardVersion(const ChunkVersion& shardVersion) {
- auto_ptr<ChunkVersion> temp(new ChunkVersion);
+ unique_ptr<ChunkVersion> temp(new ChunkVersion);
shardVersion.cloneTo(temp.get());
_shardVersion.reset(temp.release());
}
diff --git a/src/mongo/s/write_ops/batched_update_request.cpp b/src/mongo/s/write_ops/batched_update_request.cpp
index 98b5c1ccf27..f2dda0be1de 100644
--- a/src/mongo/s/write_ops/batched_update_request.cpp
+++ b/src/mongo/s/write_ops/batched_update_request.cpp
@@ -34,7 +34,7 @@
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
using mongoutils::str::stream;
@@ -181,7 +181,7 @@ namespace mongo {
for(std::vector<BatchedUpdateDocument*>::const_iterator it = _updates.begin();
it != _updates.end();
++it) {
- auto_ptr<BatchedUpdateDocument> tempBatchUpdateDocument(new BatchedUpdateDocument);
+ unique_ptr<BatchedUpdateDocument> tempBatchUpdateDocument(new BatchedUpdateDocument);
(*it)->cloneTo(tempBatchUpdateDocument.get());
other->addToUpdates(tempBatchUpdateDocument.release());
}
@@ -232,7 +232,7 @@ namespace mongo {
for (std::vector<BatchedUpdateDocument*>::const_iterator it = updates.begin();
it != updates.end();
++it) {
- auto_ptr<BatchedUpdateDocument> tempBatchUpdateDocument(new BatchedUpdateDocument);
+ unique_ptr<BatchedUpdateDocument> tempBatchUpdateDocument(new BatchedUpdateDocument);
(*it)->cloneTo(tempBatchUpdateDocument.get());
addToUpdates(tempBatchUpdateDocument.release());
}
diff --git a/src/mongo/scripting/engine.cpp b/src/mongo/scripting/engine.cpp
index 675c8e8600b..b573dba620d 100644
--- a/src/mongo/scripting/engine.cpp
+++ b/src/mongo/scripting/engine.cpp
@@ -52,7 +52,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;
@@ -222,7 +222,7 @@ namespace {
string coll = _localDBName + ".system.js";
scoped_ptr<DBClientBase> directDBClient(createDirectClient(txn));
- auto_ptr<DBClientCursor> c = directDBClient->query(coll, Query(), 0, 0, NULL,
+ unique_ptr<DBClientCursor> c = directDBClient->query(coll, Query(), 0, 0, NULL,
QueryOption_SlaveOk, 0);
massert(16669, "unable to get db client cursor from query", c.get());
@@ -458,7 +458,7 @@ namespace {
};
/** Get a scope from the pool of scopes matching the supplied pool name */
- auto_ptr<Scope> ScriptEngine::getPooledScope(OperationContext* txn,
+ unique_ptr<Scope> ScriptEngine::getPooledScope(OperationContext* txn,
const string& db,
const string& scopeType) {
const string fullPoolName = db + scopeType;
@@ -468,7 +468,7 @@ namespace {
s->registerOperation(txn);
}
- auto_ptr<Scope> p;
+ unique_ptr<Scope> p;
p.reset(new PooledScope(fullPoolName, s));
p->setLocalDB(db);
p->loadStored(txn, true);
diff --git a/src/mongo/scripting/engine.h b/src/mongo/scripting/engine.h
index e970f82b4e7..9b99d438fc4 100644
--- a/src/mongo/scripting/engine.h
+++ b/src/mongo/scripting/engine.h
@@ -220,7 +220,7 @@ namespace mongo {
* This must include authenticated users.
* @return the scope
*/
- std::auto_ptr<Scope> getPooledScope(OperationContext* txn,
+ std::unique_ptr<Scope> getPooledScope(OperationContext* txn,
const std::string& db,
const std::string& scopeType);
diff --git a/src/mongo/shell/bench.cpp b/src/mongo/shell/bench.cpp
index 9f016a5b65f..b0ecb34c0bb 100644
--- a/src/mongo/shell/bench.cpp
+++ b/src/mongo/shell/bench.cpp
@@ -75,7 +75,7 @@ namespace {
namespace mongo {
- using std::auto_ptr;
+ using std::unique_ptr;
using std::cout;
using std::endl;
using std::map;
@@ -374,7 +374,7 @@ namespace mongo {
BSONObj context = e["context"].eoo() ? BSONObj() : e["context"].Obj();
- auto_ptr<Scope> scope;
+ unique_ptr<Scope> scope;
ScriptingFunction scopeFunc = 0;
BSONObj scopeObj;
@@ -457,7 +457,7 @@ namespace mongo {
BSONObj filter = e["filter"].eoo() ? BSONObj() : e["filter"].Obj();
int expected = e["expected"].eoo() ? -1 : e["expected"].Int();
- auto_ptr<DBClientCursor> cursor;
+ unique_ptr<DBClientCursor> cursor;
int count;
BSONObj fixedQuery = fixQuery(e["query"].Obj(), bsonTemplateEvaluator);
diff --git a/src/mongo/shell/dbshell.cpp b/src/mongo/shell/dbshell.cpp
index ceafa7375b5..d159224057b 100644
--- a/src/mongo/shell/dbshell.cpp
+++ b/src/mongo/shell/dbshell.cpp
@@ -682,7 +682,7 @@ int _main( int argc, char* argv[], char **envp ) {
mongo::ScriptEngine::setConnectCallback( mongo::shell_utils::onConnect );
mongo::ScriptEngine::setup();
mongo::globalScriptEngine->setScopeInitCallback( mongo::shell_utils::initScope );
- auto_ptr< mongo::Scope > scope( mongo::globalScriptEngine->newScope() );
+ unique_ptr< mongo::Scope > scope( mongo::globalScriptEngine->newScope() );
shellMainScope = scope.get();
if( shellGlobalParams.runShell )
diff --git a/src/mongo/tools/bridge.cpp b/src/mongo/tools/bridge.cpp
index 2d00d6f644b..2644ccc8eaf 100644
--- a/src/mongo/tools/bridge.cpp
+++ b/src/mongo/tools/bridge.cpp
@@ -143,7 +143,7 @@ public:
}
};
-auto_ptr< MyListener > listener;
+unique_ptr< MyListener > listener;
void cleanup( int sig ) {
diff --git a/src/mongo/util/net/message_server_port.cpp b/src/mongo/util/net/message_server_port.cpp
index 682a7361ede..4a4e73fa4b0 100644
--- a/src/mongo/util/net/message_server_port.cpp
+++ b/src/mongo/util/net/message_server_port.cpp
@@ -105,7 +105,7 @@ namespace {
virtual void accepted(boost::shared_ptr<Socket> psocket, long long connectionId ) {
ScopeGuard sleepAfterClosingPort = MakeGuard(sleepmillis, 2);
- std::auto_ptr<MessagingPortWithHandler> portWithHandler(
+ std::unique_ptr<MessagingPortWithHandler> portWithHandler(
new MessagingPortWithHandler(psocket, _handler, connectionId));
if ( ! Listener::globalTicketHolder.tryAcquire() ) {
diff --git a/src/mongo/util/options_parser/option_section.cpp b/src/mongo/util/options_parser/option_section.cpp
index 1e31ce44374..5d3646554ee 100644
--- a/src/mongo/util/options_parser/option_section.cpp
+++ b/src/mongo/util/options_parser/option_section.cpp
@@ -140,10 +140,10 @@ namespace optionenvironment {
* those conversions are inconsistent with our own. See SERVER-14110 For an example.
*/
template <typename Type>
- Status typeToBoostStringType(std::auto_ptr<po::value_semantic>* boostType,
+ Status typeToBoostStringType(std::unique_ptr<po::value_semantic>* boostType,
const Value defaultValue = Value(),
const Value implicitValue = Value()) {
- std::auto_ptr<po::typed_value<std::string> >
+ std::unique_ptr<po::typed_value<std::string> >
boostTypeBuilder(po::value<std::string>());
if (!implicitValue.isEmpty()) {
@@ -172,7 +172,7 @@ namespace optionenvironment {
boostTypeBuilder->default_value(sb.str());
}
- *boostType = boostTypeBuilder;
+ *boostType = std::move(boostTypeBuilder);
return Status::OK();
}
@@ -180,7 +180,7 @@ namespace optionenvironment {
/** Helper function to convert the values of our OptionType enum into the classes that
* boost::program_option uses to pass around this information
*/
- Status typeToBoostType(std::auto_ptr<po::value_semantic>* boostType,
+ Status typeToBoostType(std::unique_ptr<po::value_semantic>* boostType,
OptionType type,
const Value defaultValue = Value(),
const Value implicitValue = Value(),
@@ -188,7 +188,7 @@ namespace optionenvironment {
switch (type) {
case StringVector:
{
- *boostType = std::auto_ptr<po::value_semantic>(
+ *boostType = std::unique_ptr<po::value_semantic>(
po::value< std::vector<std::string> >());
if (!implicitValue.isEmpty()) {
@@ -209,7 +209,7 @@ namespace optionenvironment {
{
// Boost doesn't support maps, so we just register a vector parameter and
// parse it as "key=value" strings
- *boostType = std::auto_ptr<po::value_semantic>(
+ *boostType = std::unique_ptr<po::value_semantic>(
po::value< std::vector<std::string> >());
if (!implicitValue.isEmpty()) {
@@ -236,19 +236,19 @@ namespace optionenvironment {
// whether we are telling boost that an option is a switch type or that an
// option is a bool type.
if (!getSwitchAsBool) {
- *boostType = std::auto_ptr<po::value_semantic>(po::bool_switch());
+ *boostType = std::unique_ptr<po::value_semantic>(po::bool_switch());
return Status::OK();
}
else {
// Switches should be true if they are present with no explicit value.
- *boostType = std::auto_ptr<po::typed_value<bool> >(po::value<bool>()
+ *boostType = std::unique_ptr<po::typed_value<bool> >(po::value<bool>()
->implicit_value(true));
return Status::OK();
}
}
case Bool:
{
- std::auto_ptr<po::typed_value<bool> > boostTypeBuilder(po::value<bool>());
+ std::unique_ptr<po::typed_value<bool> > boostTypeBuilder(po::value<bool>());
if (!implicitValue.isEmpty()) {
bool implicitValueType;
@@ -272,7 +272,7 @@ namespace optionenvironment {
boostTypeBuilder->default_value(defaultValueType);
}
- *boostType = boostTypeBuilder;
+ *boostType = std::move(boostTypeBuilder);
return Status::OK();
}
@@ -312,7 +312,7 @@ namespace optionenvironment {
// either visible or we are requesting hidden options
if ((!visibleOnly || (oditerator->_isVisible)) &&
(oditerator->_sources & sources)) {
- std::auto_ptr<po::value_semantic> boostType;
+ std::unique_ptr<po::value_semantic> boostType;
Status ret = typeToBoostType(&boostType,
oditerator->_type,
includeDefaults ? oditerator->_default : Value(),