💡 add comment to describe j.m_value.destroy(j.m_type) calls

pull/2872/head
Niels Lohmann 2021-07-15 20:34:50 +02:00
parent f6863e062c
commit ecaac22656
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69
2 changed files with 14 additions and 0 deletions

View File

@ -22,6 +22,13 @@ namespace detail
// constructors //
//////////////////
/*
* Note all external_constructor<>::construct functions need to call
* j.m_value.destroy(j.m_type) to avoid a memory leak in case j contains an
* allocated value (e.g., a string). See bug issue
* https://github.com/nlohmann/json/issues/2865 for more information.
*/
template<value_t> struct external_constructor;
template<>

View File

@ -4480,6 +4480,13 @@ namespace detail
// constructors //
//////////////////
/*
* Note all external_constructor<>::construct functions need to call
* j.m_value.destroy(j.m_type) to avoid a memory leak in case j contains an
* allocated value (e.g., a string). See bug issue
* https://github.com/nlohmann/json/issues/2865 for more information.
*/
template<value_t> struct external_constructor;
template<>