-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat][struct_pack] not support shared_ptr #437
Comments
Thank you. It's in my todolist. |
But, in this case, the shared_ptr is unnecessary. |
If you don't want to shared the nodes, just remove the shared_ptr. enum class type_e {
root = 0,
users = 1,
projs = 2,
};
struct Node {
type_e type;
std::string name;
std::string value;
std::list<Node> children;
}; Serialize/deserilaize shared_ptr will cost additional price. First we need check if the address is same as previous one to shared the object. Second deserialize shared_ptr may cause memory leak and we need to check it. Anyway I will try to support it later. |
thanks for your reply, This library is very cute |
shared_ptr可能会导致循环引用问题,这个不是很好解决吧 |
|
|
I saw the struct_pack library supports many STL containers
but after testing, I regretted that this library does not support the smart point of C++ 11.
like shared_ptr etc.
for example, I have a tree node struct like:
enum class type_e {
root = 0,
users = 1,
projs = 2,
};
struct Node {
type_e type;
std::string name;
std::string value;
std::list<std::shared_ptr<Node>> children;
};
for now, this library cannot serialize/deserialize the above Node structure.
you can reference another nonintrusive library named alpaca, which supports smart point.
The text was updated successfully, but these errors were encountered: