Opened 12 years ago

Closed 9 years ago

Last modified 8 years ago

#5265 closed Patches (fixed)

unordered_set and unordered_map serialization

Reported by: Jim Bell <jim@…> Owned by: Robert Ramey
Milestone: Boost 1.47.0 Component: serialization
Version: Boost Development Trunk Severity: Problem
Keywords: unordered unordered_set unordered_multiset unordered_map unordered_multimap Cc: jim@…

Description

This patch provides serialization for std::tr1 containers unordered_set, unordered_multiset, unordered_map, and unordered_multimap.

Code using boost::unordered_... must instead use std::tr1. The interface is identical.

It includes boost TR1 header files for portability (<boost/tr1/unordered_set.hpp> or <boost/tr1/unordered_map.hpp>). See <http://lists.boost.org/boost-users/2011/02/66535.php>

The patch file adapts the serialization tests test_map.cpp and test_set.cpp to include unordered variants. This patch requires changeset 69520 (see Ticket #5254).

This has been verified on MinGW-32/gcc-4.4 and MSVC-8. It should produce no spurious warnings on compile.

Attachments (6)

unordered_set.hpp (5.7 KB ) - added by Jim Bell <jim@…> 12 years ago.
boost/serialization/unordered_set.hpp
unordered_map.hpp (6.2 KB ) - added by Jim Bell <jim@…> 12 years ago.
boost/serialization/unordered_map.hpp
unordered_collections_load_imp.hpp (2.2 KB ) - added by Jim Bell <jim@…> 12 years ago.
boost/serialization/unordered_collections_load_imp.hpp
unordered_collections_save_imp.hpp (3.0 KB ) - added by Jim Bell <jim@…> 12 years ago.
boost/serialization/unordered_collections_save_imp.hpp
test_unordered.patch (7.0 KB ) - added by Jim Bell <jim@…> 12 years ago.
Patch for libs/serialization/test (test_map.cpp and test_set.cpp)
unordered_collections_load_imp.2.hpp (2.5 KB ) - added by Jim Bell <jim@…> 12 years ago.
boost/serialization/unordered_collections_load_imp.hpp (v2 -- supercedes previous)

Download all attachments as: .zip

Change History (14)

by Jim Bell <jim@…>, 12 years ago

Attachment: unordered_set.hpp added

boost/serialization/unordered_set.hpp

by Jim Bell <jim@…>, 12 years ago

Attachment: unordered_map.hpp added

boost/serialization/unordered_map.hpp

by Jim Bell <jim@…>, 12 years ago

boost/serialization/unordered_collections_load_imp.hpp

by Jim Bell <jim@…>, 12 years ago

boost/serialization/unordered_collections_save_imp.hpp

by Jim Bell <jim@…>, 12 years ago

Attachment: test_unordered.patch added

Patch for libs/serialization/test (test_map.cpp and test_set.cpp)

comment:1 by jsd@…, 12 years ago

'boost/serialization/detail/stack_constructor.hpp' seems to be missing from the includes in 'boost/serialization/unordered_collections_load_imp.hpp'

gcc version 4.5.1 20100924 (Red Hat 4.5.1-4) (GCC), fedora 14

by Jim Bell <jim@…>, 12 years ago

boost/serialization/unordered_collections_load_imp.hpp (v2 -- supercedes previous)

comment:2 by Jim Bell <jim@…>, 12 years ago

jsd: thanks for the feedback.

I merged into unordered_collections_load_imp.hpp the same headers that collections_load_imp.hpp includes, boost/serialization/detail/stack_constructor.hpp being one. I checked unordered_collections_save_imp.hpp and it seemed ok.

Passes all tests against MinGW-gcc-4.4 and MSVC-8.

comment:3 by anonymous, 10 years ago

what about boost own containers? how can they provide serialization for stl containers and not for boost::own containers, damn

comment:4 by Robert Ramey, 9 years ago

Resolution: fixed
Status: newclosed

I've added this to the library. I made changes to be compatible with c++11 rather than TR1. Will show up in the development branch shortly.

Robert Ramey

in reply to:  4 comment:5 by anonymous, 8 years ago

Replying to ramey:

I've added this to the library. I made changes to be compatible with c++11 rather than TR1. Will show up in the development branch shortly.

Robert Ramey

How shortly is "shortly"? I can't find it yet and it's at least 3 years now.

Thanks for a beautiful library

comment:6 by maxim.yegorushkin@…, 8 years ago

I just hit this issue today, when these patches will be integrated into boost please?

comment:7 by querier, 8 years ago

Could this please be merged? I'm copying the file for local use, but I'd really like this to be distributed with boost.

comment:8 by Robert Ramey, 8 years ago

my records show:

commit to develop commit 2140063

include/boost/serialization/stack.hpp include/boost/serialization/unordered_collections_load_imp.hpp include/boost/serialization/unordered_collections_save_imp.hpp include/boost/serialization/unordered_map.hpp include/boost/serialization/unordered_set.hpp include/boost/serialization/void_cast.hpp test/Jamfile.v2 test/test_array.cpp test/test_deque.cpp test/test_list.cpp test/test_map.cpp test/test_pimpl.cpp test/test_priority_queue.cpp test/test_private_base.cpp test/test_queue.cpp test/test_set.cpp test/test_stack.cpp test/test_vector.cpp

and merge to master commit 484874f

....

Does this not address this ticket?

Note: See TracTickets for help on using tickets.