Opened 11 years ago
Last modified 7 years ago
#6618 new Bugs
boost::container::flat_map not transparently accepting move-only values
Reported by: | Owned by: | Ion Gaztañaga | |
---|---|---|---|
Milestone: | To Be Determined | Component: | container |
Version: | Boost 1.48.0 | Severity: | Problem |
Keywords: | flat_map, moveable not copyable | Cc: | DaveTallman@… |
Description
I would have expected to be able to store move-only values in a boost::container::flat_map, and to have no code changes except in the header files, since it is supposed to be a drop-in replacement for std::map. However, I cannot create a key-value pair of a type it will accept, because of const errors. The attached program shows the problem.
Perhaps allowing a non-const std::pair reference to be passed to insert would help, or even a new make_pair helper function that returned a BOOST_RV_REF(value_type)?
The same thing happens with boost::container::map.
Attachments (3)
Change History (5)
by , 11 years ago
Attachment: | simple_req.cpp added |
---|
by , 11 years ago
Attachment: | simple_req.2.cpp added |
---|
Typo in that first source file I attached. Trying again.
comment:1 by , 9 years ago
Is it the same as this problem reported to the mailing list? Was that issue ever fixed?
I'm getting this with Boost 1.49. There doesn't seem to be any way to store move-only objects in a map.
comment:2 by , 7 years ago
Maybe I'm wrong Ion, but shouldn't you use a move aware pair? Sorry, if this is already the case.
Source file that will not compile under g++ (GCC) 4.1.2 20080704 (Red Hat 4.1.2-52)