@@ -31,23 +31,39 @@ constexpr bool is_adapter_v = is_same_type_template_v<T, std::stack> || is_same_
3131
3232// Serialize adapter classes std::stack, std::queue, std::priority_queue
3333template <typename T>
34- class serialize_impl <T, std::enable_if_t <is_adapter_v<std:: remove_pointer_t <T> >>>
34+ class serialize_impl <T, std::enable_if_t <is_adapter_v<T >>>
3535{
36- struct S : std:: remove_pointer_t <T>
36+ struct S : T
3737 {
38- using std:: remove_pointer_t <T> ::c; // access protected container
38+ using T ::c; // access protected container
3939 };
4040
4141 void operator ()(T& v, serializer& ser, ser_opt_t options)
4242 {
43- if constexpr ( std::is_pointer_v<T> ) {
44- if ( ser.mode () == serializer::UNPACK ) v = new std::remove_pointer_t <T>;
45- SST_SER (static_cast <S&>(*v).c , options); // serialize the underlying container
46- }
47- else {
43+ switch ( ser.mode () ) {
44+ case serializer::MAP:
45+ ser.mapper ().map_hierarchy_start (ser.getMapName (), new ObjectMapContainer<T>(&v));
46+ SST_SER_NAME (static_cast <S&>(v).c , " container" , options); // serialize the underlying container
47+ ser.mapper ().map_hierarchy_end ();
48+ break ;
49+
50+ default :
4851 SST_SER (static_cast <S&>(v).c , options); // serialize the underlying container
52+ break ;
4953 }
5054 }
55+
56+ SST_FRIEND_SERIALIZE ();
57+ };
58+
59+ template <typename T>
60+ class serialize_impl <T*, std::enable_if_t <is_adapter_v<T>>>
61+ {
62+ void operator ()(T*& obj, serializer& ser, ser_opt_t options)
63+ {
64+ if ( ser.mode () == serializer::UNPACK ) obj = new T;
65+ SST_SER (*obj, options);
66+ }
5167 SST_FRIEND_SERIALIZE ();
5268};
5369
0 commit comments