Opened 7 years ago
Closed 7 years ago
#11961 closed Bugs (fixed)
Serialization of stl container with non-copyable value
| Reported by: | Owned by: | Robert Ramey | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | serialization |
| Version: | Boost 1.61.0 | Severity: | Problem |
| Keywords: | non-copyable, stl containers | Cc: |
Description
A stl container which stores a non-copyable value can not be serialized and gives a compile error about copy constructor. I used g++-4.18 with c++11 flag on. I attached my code to this bug, it is a minimal code which reproduces the error.
Attachments (1)
Change History (5)
by , 7 years ago
comment:1 by , 7 years ago
Using g++-5.x can compile the program when container is std::vector bu another containers like std::unordered_map causes the same compile error even with g++-5.x. I have created a question in stackverflow about this bug.
comment:2 by , 7 years ago
By changing line 43 of archive_input_unordered_map.hpp from:
s.insert(t.reference());
to :
s.emplace(piecewise_construct,
forward_as_tuple(std::move(t.reference().first)),
forward_as_tuple(std::move(t.reference().second)));
The error disappear, and it works.
comment:4 by , 7 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.

minimal code which reproduces the error