Modify

Opened 7 years ago

Closed 4 years ago

Last modified 3 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@…> 7 years ago.
boost/serialization/unordered_set.hpp
unordered_map.hpp (6.2 KB) - added by Jim Bell <jim@…> 7 years ago.
boost/serialization/unordered_map.hpp
unordered_collections_load_imp.hpp (2.2 KB) - added by Jim Bell <jim@…> 7 years ago.
boost/serialization/unordered_collections_load_imp.hpp
unordered_collections_save_imp.hpp (3.0 KB) - added by Jim Bell <jim@…> 7 years ago.
boost/serialization/unordered_collections_save_imp.hpp
test_unordered.patch (7.0 KB) - added by Jim Bell <jim@…> 7 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@…> 7 years ago.
boost/serialization/unordered_collections_load_imp.hpp (v2 -- supercedes previous)

Download all attachments as: .zip

Change History (14)

Changed 7 years ago by Jim Bell <jim@…>

Attachment: unordered_set.hpp added

boost/serialization/unordered_set.hpp

Changed 7 years ago by Jim Bell <jim@…>

Attachment: unordered_map.hpp added

boost/serialization/unordered_map.hpp

Changed 7 years ago by Jim Bell <jim@…>

boost/serialization/unordered_collections_load_imp.hpp

Changed 7 years ago by Jim Bell <jim@…>

boost/serialization/unordered_collections_save_imp.hpp

Changed 7 years ago by Jim Bell <jim@…>

Attachment: test_unordered.patch added

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

comment:1 Changed 7 years ago by jsd@…

'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

Changed 7 years ago by Jim Bell <jim@…>

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

comment:2 Changed 7 years ago by Jim Bell <jim@…>

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 Changed 5 years ago by anonymous

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

comment:4 Changed 4 years ago by Robert Ramey

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

comment:5 in reply to:  4 Changed 4 years ago by anonymous

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 Changed 3 years ago by maxim.yegorushkin@…

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

comment:7 Changed 3 years ago by querier

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 Changed 3 years ago by Robert Ramey

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?

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Robert Ramey.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.