私はthe mongocxx query exemplesを探していましたが、を使用している点は何ですか?auto&
はここにありません。 documentationでmongocxxカーソルとrvalue参照
auto cursor = db["restaurants"].find({}, opts);
for (auto&& doc : cursor) {
std::cout << bsoncxx::to_json(doc) << std::endl;
}
、彼らはそれをこのように使用します。
mongocxx::cursor cursor = collection.find(document{} << finalize);
for(auto doc : cursor) {
std::cout << bsoncxx::to_json(doc) << "\n";
}
私が一番ここプラクティス、そしてその理由は何for(auto& doc : cursor)
を使いたいですか?このビットで