@@ -31,23 +31,40 @@ 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" ,
47+ options | SerOption::map_read_only); // serialize the underlying container
48+ ser.mapper ().map_hierarchy_end ();
49+ break ;
50+
51+ default :
4852 SST_SER (static_cast <S&>(v).c , options); // serialize the underlying container
53+ break ;
4954 }
5055 }
56+
57+ SST_FRIEND_SERIALIZE ();
58+ };
59+
60+ template <typename T>
61+ class serialize_impl <T*, std::enable_if_t <is_adapter_v<T>>>
62+ {
63+ void operator ()(T*& obj, serializer& ser, ser_opt_t options)
64+ {
65+ if ( ser.mode () == serializer::UNPACK ) obj = new T;
66+ SST_SER (*obj, options);
67+ }
5168 SST_FRIEND_SERIALIZE ();
5269};
5370
0 commit comments