Modify

Ticket #5265 (closed Patches: fixed)

Opened 3 years ago

Last modified 3 months ago

unordered_set and unordered_map serialization

Reported by: Jim Bell <jim@…> Owned by: 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

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

Change History

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

boost/serialization/unordered_set.hpp

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

boost/serialization/unordered_map.hpp

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

boost/serialization/unordered_collections_load_imp.hpp

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

boost/serialization/unordered_collections_save_imp.hpp

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

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

comment:1 Changed 3 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 3 years ago by Jim Bell <jim@…>

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

comment:2 Changed 3 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 17 months 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 3 months ago by ramey

  • Status changed from new to closed
  • Resolution set to fixed

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

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


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

 
Note: See TracTickets for help on using tickets.