Opened 7 years ago

Closed 7 years ago

#11961 closed Bugs (fixed)

Serialization of stl container with non-copyable value

Reported by: mohsen.tamiz@… 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)

foo.cc (1.3 KB ) - added by mohsen.tamiz@… 7 years ago.
minimal code which reproduces the error

Download all attachments as: .zip

Change History (5)

by mohsen.tamiz@…, 7 years ago

Attachment: foo.cc added

minimal code which reproduces the error

comment:1 by anonymous, 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 anonymous, 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:3 by Robert Ramey, 7 years ago

fixed in 1.61 also fixed for archive_input_unordered_set

comment:4 by Robert Ramey, 7 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.