[CXX-556] overload methods that accept views to take ownership if passed a value Created: 13/Mar/15  Updated: 08/Jan/24  Resolved: 07/Dec/15

Status: Closed
Project: C++ Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Adam Midvidy Assignee: DO NOT USE - Backlog - Platform Team
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by CXX-738 Add variant type for bson document vi... Closed
Epic Link: C++11 Driver MongoDB 3.2

 Description   

this conversion operator seems nice, but is very error prone.

example:

options::find opts;
find.sort(document{} << "foo" << 1 << finalize);
col.find({}, opts);

The temporary value created is converted to a view and then stored in the options struct. Then it is left dangling, which causes a crash in the subsequent call to find.



 Comments   
Comment by Adam Midvidy [ 06/Apr/15 ]

going to punt on this for now.

I need to read mnmlstc::variant, compare it to boost.variant and make an informed decision about whether we should use it.

Comment by Adam Midvidy [ 19/Mar/15 ]

https://github.com/mongodb/mongo-cxx-driver/pull/269/files

Comment by Adam Midvidy [ 13/Mar/15 ]

cc mira.carey@mongodb.com

Generated at Wed Feb 07 21:59:33 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.