Skip to content

Commit 7a7f325

Browse files
committed
minor: require instance to be constructed before we make a pool
1 parent b9143bb commit 7a7f325

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

examples/mongocxx/instance_management.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,11 @@ void configure(mongocxx::uri uri) {
7878
}
7979
};
8080

81-
mongo_access::instance().configure(
82-
mongocxx::stdx::make_unique<mongocxx::instance>(mongocxx::stdx::make_unique<noop_logger>()),
83-
mongocxx::stdx::make_unique<mongocxx::pool>(std::move(uri)));
81+
auto instance =
82+
mongocxx::stdx::make_unique<mongocxx::instance>(mongocxx::stdx::make_unique<noop_logger>());
83+
84+
mongo_access::instance().configure(std::move(instance),
85+
mongocxx::stdx::make_unique<mongocxx::pool>(std::move(uri)));
8486
}
8587

8688
bool do_work() {

0 commit comments

Comments
 (0)