Skip to content

Commit

Permalink
🚨 fix warning
Browse files Browse the repository at this point in the history
  • Loading branch information
nlohmann committed Jul 6, 2020
1 parent b04dc05 commit efcc826
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ pedantic_gcc:
-Wmismatched-tags \
-Wmissing-attributes \
-Wmissing-braces \
-Wmissing-declarations \
-Wno-missing-declarations \
-Wmissing-field-initializers \
-Wmissing-include-dirs \
-Wmissing-profile \
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ The `to_json`/`from_json` functions for the `person` struct above can be created

```cpp
namespace ns {
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(person, name, address, age);
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(person, name, address, age)
}
```
Expand All @@ -901,7 +901,7 @@ namespace ns {
int postcode;
public:
NLOHMANN_DEFINE_TYPE_INTRUSIVE(address, street, housenumber, postcode);
NLOHMANN_DEFINE_TYPE_INTRUSIVE(address, street, housenumber, postcode)
};
}
```
Expand Down
46 changes: 23 additions & 23 deletions test/src/unit-udt_macro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ namespace persons
class person_with_private_data
{
private:
std::string name;
std::string name = "";
int age = 0;
json metadata;
json metadata = nullptr;

public:
bool operator==(const person_with_private_data& rhs) const
Expand All @@ -48,58 +48,58 @@ class person_with_private_data
}

person_with_private_data() = default;
person_with_private_data(std::string name, int age, json metadata)
: name(std::move(name))
, age(age)
, metadata(std::move(metadata))
person_with_private_data(std::string name_, int age_, json metadata_)
: name(std::move(name_))
, age(age_)
, 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
{
public:
std::string name;
int age = 0;
json metadata;
std::string name = "";
int age = 0;
json metadata = nullptr;

bool operator==(const person_without_private_data_1& rhs) const
{
return name == rhs.name && age == rhs.age && metadata == rhs.metadata;
}

person_without_private_data_1() = default;
person_without_private_data_1(std::string name, int age, json metadata)
: name(std::move(name))
, age(age)
, metadata(std::move(metadata))
person_without_private_data_1(std::string name_, int age_, json metadata_)
: name(std::move(name_))
, age(age_)
, 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
{
public:
std::string name;
int age = 0;
json metadata;
std::string name = "";
int age = 0;
json metadata = nullptr;

bool operator==(const person_without_private_data_2& rhs) const
{
return name == rhs.name && age == rhs.age && metadata == rhs.metadata;
}

person_without_private_data_2() = default;
person_without_private_data_2(std::string name, int age, json metadata)
: name(std::move(name))
, age(age)
, metadata(std::move(metadata))
person_without_private_data_2(std::string name_, int age_, json metadata_)
: name(std::move(name_))
, age(age_)
, 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

TEST_CASE_TEMPLATE("Serialization/deserialization via NLOHMANN_DEFINE_TYPE_INTRUSIVE", T,
Expand Down

0 comments on commit efcc826

Please sign in to comment.