dropbox / json11

A tiny JSON library for C++11.
MIT License
2.55k stars 615 forks source link

Json::m_ptr looks like std::unique_ptr would be more suited #45

Closed Amleto closed 8 years ago

Amleto commented 8 years ago

Json::m_ptr looks like std::unique_ptr would be more suited? I didn't see any sharing that suggests shared_ptr is needed, but only eye-balled it.

j4cbo commented 8 years ago

The implicit copy constructor of Json will copy the shared_ptr, thus making a shallow copy of the object (increasing the refcount). This is safe since the underlying objects are immutable; the intention was to make Json a lightweight handle-like type.