🚨 fix warning

parent b04dc055
...@@ -253,7 +253,7 @@ pedantic_gcc: ...@@ -253,7 +253,7 @@ pedantic_gcc:
-Wmismatched-tags \ -Wmismatched-tags \
-Wmissing-attributes \ -Wmissing-attributes \
-Wmissing-braces \ -Wmissing-braces \
-Wmissing-declarations \ -Wno-missing-declarations \
-Wmissing-field-initializers \ -Wmissing-field-initializers \
-Wmissing-include-dirs \ -Wmissing-include-dirs \
-Wmissing-profile \ -Wmissing-profile \
......
...@@ -886,7 +886,7 @@ The `to_json`/`from_json` functions for the `person` struct above can be created ...@@ -886,7 +886,7 @@ The `to_json`/`from_json` functions for the `person` struct above can be created
```cpp ```cpp
namespace ns { namespace ns {
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(person, name, address, age); NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(person, name, address, age)
} }
``` ```
...@@ -901,7 +901,7 @@ namespace ns { ...@@ -901,7 +901,7 @@ namespace ns {
int postcode; int postcode;
public: public:
NLOHMANN_DEFINE_TYPE_INTRUSIVE(address, street, housenumber, postcode); NLOHMANN_DEFINE_TYPE_INTRUSIVE(address, street, housenumber, postcode)
}; };
} }
``` ```
......
...@@ -37,9 +37,9 @@ namespace persons ...@@ -37,9 +37,9 @@ namespace persons
class person_with_private_data class person_with_private_data
{ {
private: private:
std::string name; std::string name = "";
int age = 0; int age = 0;
json metadata; json metadata = nullptr;
public: public:
bool operator==(const person_with_private_data& rhs) const bool operator==(const person_with_private_data& rhs) const
...@@ -48,21 +48,21 @@ class person_with_private_data ...@@ -48,21 +48,21 @@ class person_with_private_data
} }
person_with_private_data() = default; person_with_private_data() = default;
person_with_private_data(std::string name, int age, json metadata) person_with_private_data(std::string name_, int age_, json metadata_)
: name(std::move(name)) : name(std::move(name_))
, age(age) , age(age_)
, metadata(std::move(metadata)) , metadata(std::move(metadata_))
{} {}
NLOHMANN_DEFINE_TYPE_INTRUSIVE(person_with_private_data, age, name, metadata); NLOHMANN_DEFINE_TYPE_INTRUSIVE(person_with_private_data, age, name, metadata)
}; };
class person_without_private_data_1 class person_without_private_data_1
{ {
public: public:
std::string name; std::string name = "";
int age = 0; int age = 0;
json metadata; json metadata = nullptr;
bool operator==(const person_without_private_data_1& rhs) const bool operator==(const person_without_private_data_1& rhs) const
{ {
...@@ -70,21 +70,21 @@ class person_without_private_data_1 ...@@ -70,21 +70,21 @@ class person_without_private_data_1
} }
person_without_private_data_1() = default; person_without_private_data_1() = default;
person_without_private_data_1(std::string name, int age, json metadata) person_without_private_data_1(std::string name_, int age_, json metadata_)
: name(std::move(name)) : name(std::move(name_))
, age(age) , age(age_)
, metadata(std::move(metadata)) , metadata(std::move(metadata_))
{} {}
NLOHMANN_DEFINE_TYPE_INTRUSIVE(person_without_private_data_1, age, name, metadata); NLOHMANN_DEFINE_TYPE_INTRUSIVE(person_without_private_data_1, age, name, metadata)
}; };
class person_without_private_data_2 class person_without_private_data_2
{ {
public: public:
std::string name; std::string name = "";
int age = 0; int age = 0;
json metadata; json metadata = nullptr;
bool operator==(const person_without_private_data_2& rhs) const bool operator==(const person_without_private_data_2& rhs) const
{ {
...@@ -92,14 +92,14 @@ class person_without_private_data_2 ...@@ -92,14 +92,14 @@ class person_without_private_data_2
} }
person_without_private_data_2() = default; person_without_private_data_2() = default;
person_without_private_data_2(std::string name, int age, json metadata) person_without_private_data_2(std::string name_, int age_, json metadata_)
: name(std::move(name)) : name(std::move(name_))
, age(age) , age(age_)
, metadata(std::move(metadata)) , metadata(std::move(metadata_))
{} {}
}; };
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(person_without_private_data_2, age, name, metadata); NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(person_without_private_data_2, age, name, metadata)
} // namespace persons } // namespace persons
TEST_CASE_TEMPLATE("Serialization/deserialization via NLOHMANN_DEFINE_TYPE_INTRUSIVE", T, TEST_CASE_TEMPLATE("Serialization/deserialization via NLOHMANN_DEFINE_TYPE_INTRUSIVE", T,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment