Opened 11 years ago

Last modified 7 years ago

#6618 new Bugs

boost::container::flat_map not transparently accepting move-only values

Reported by: Charles David Tallman <DaveTallman@…> 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)

simple_req.cpp (1.2 KB ) - added by Charles David Tallman <DaveTallman@…> 11 years ago.
Source file that will not compile under g++ (GCC) 4.1.2 20080704 (Red Hat 4.1.2-52)
ppp (6.1 KB ) - added by Charles David Tallman <DaveTallman@…> 11 years ago.
Text file showing compile errors
simple_req.2.cpp (1.2 KB ) - added by Charles David Tallman <DaveTallman@…> 11 years ago.
Typo in that first source file I attached. Trying again.

Download all attachments as: .zip

Change History (5)

by Charles David Tallman <DaveTallman@…>, 11 years ago

Attachment: simple_req.cpp added

Source file that will not compile under g++ (GCC) 4.1.2 20080704 (Red Hat 4.1.2-52)

by Charles David Tallman <DaveTallman@…>, 11 years ago

Attachment: ppp added

Text file showing compile errors

by Charles David Tallman <DaveTallman@…>, 11 years ago

Attachment: simple_req.2.cpp added

Typo in that first source file I attached. Trying again.

comment:1 by swish@…, 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 viboes, 7 years ago

Maybe I'm wrong Ion, but shouldn't you use a move aware pair? Sorry, if this is already the case.

Note: See TracTickets for help on using tickets.