Skip to content

[struct_pack] 是否支持智能指针 #813

@bolanbujing

Description

@bolanbujing

我写了个小测试:
std::shared_ptr<int> y = std::make_shared<int>(); auto z = struct_pack::serialize< std::vector<uint8_t>>( y);

报错信息是:
error: cannot decompose inaccessible member ‘std::__shared_ptr<int, __gnu_cxx::_S_atomic>::_M_ptr’ of ‘std::__shared_ptr<int, __gnu_cxx::_S_atomic>’
1212 | auto &&[a1, a2] = object;
| ^~~~~~~~

我们的业务需要序列化 std::shared_ptr<vector<std::shared_ptr<int>>>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions