Add documentation

This commit is contained in:
Raphael Grimm 2021-11-01 15:59:56 +01:00 committed by barcode
parent f43c6b433d
commit 5204ebb0d0
2 changed files with 21 additions and 0 deletions

View File

@ -7,6 +7,23 @@ namespace nlohmann
namespace detail
{
/*!
@brief Default base class of the @ref basic_json class.
So that the correct implementation of the copy / move ctors / assign operators
of @ref basic_json does not require complex case distinctions
(no base class / custom base class), @ref basic_json always a base class.
By default this class is used, since empty and thus has no effect on the
behaviour of @ref basic_json.
So that the correct implementation of the copy / move ctors / assign operators
of @ref basic_json does not require complex case distinctions
(no base class / custom base class used as customization point),
@ref basic_json always has a base class.
By default, this class is used because it is empty and thus has no effect
on the behavior of @ref basic_json.
*/
struct json_default_base {};
template<class T>

View File

@ -35,6 +35,8 @@ SOFTWARE.
#include <nlohmann/json.hpp>
// Test extending nlohmann::json by using a custom base class.
// Add some metadata to each node ant test the behaviour of copy / move
template<class MetaDataType>
class json_metadata
{
@ -201,6 +203,8 @@ TEST_CASE("JSON Node Metadata")
}
}
// Test extending nlohmann::json by using a custom base class.
// Add a custom member function template iterating over the whole json tree.
class visitor_adaptor
{
public: