Skip to content

Commit

Permalink
#249: Update comments in the examples
Browse files Browse the repository at this point in the history
  • Loading branch information
thearusable authored and PhilMiller committed Oct 25, 2022
1 parent d01b7fa commit 095e982
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 0 additions & 4 deletions examples/checkpoint_example_polymorphic_macro_nonintrusive.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,6 @@ struct MyObj3 : public MyBase {
}
};

/*
* Example vector that holds a vector of unique_ptr to MyBase
*/

struct ExampleVector {
std::vector<std::unique_ptr<MyBase>> vec;
};
Expand Down
14 changes: 9 additions & 5 deletions examples/checkpoint_example_to_file_nonintrusive.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct MyTestType {
// \brief Default constructor
//
// The default constructor is needed for the (de)serialization.
// (required for serialization)
//
MyTestType() = default;

// \brief Constructor with two parameters
Expand Down Expand Up @@ -148,10 +148,12 @@ int main(int, char**) {
//
auto out = checkpoint::deserializeFromFile<MyTestType>("hello.txt");

if (my_test_inst == *out)
if (my_test_inst == *out) {
std::cout << " Serialization / Deserialization from file worked. \n";
else
} else {
std::cout << " Serialization / Deserialization from file failed. \n";
assert(false);
}

//
// Another option is to de-serialize into an existing object of type 'MyTestType'
Expand All @@ -170,10 +172,12 @@ int main(int, char**) {
// - an integer 'len_' equal to the length of the vector stored in the file.
//

if (my_test_inst == out_2)
if (my_test_inst == out_2) {
std::cout << " Deserialization in-place from file worked. \n";
else
} else {
std::cout << " Deserialization in-place from file failed. \n";
assert(false);
}

return 0;
}
Expand Down

0 comments on commit 095e982

Please sign in to comment.