Skip to content

Commit 8b0dbd7

Browse files
committed
Review example
1 parent cc131a3 commit 8b0dbd7

File tree

6 files changed

+8
-6
lines changed

6 files changed

+8
-6
lines changed

examples/xtd.core.examples/collections/ienumerable/src/ienumerable.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class program {
1010
// Simple business object.
1111
struct person : public object, public iequatable<person>, public icomparable<person> {
1212
public:
13+
person() = default;
1314
person(const string& first_name, const string last_name) : first_name {first_name}, last_name {last_name} {}
1415

1516
string first_name;

examples/xtd.core.examples/linq/enumerable_all2/src/enumerable_all2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ auto main() -> int {
2121
};
2222

2323
// Determine whether all pet names in the array start with 'B'.
24-
bool all_start_with_b = enumerable::all<pet>(pets.begin(), pets.end(), [](const pet& pet) {
24+
bool all_start_with_b = enumerable::from(pets.begin(), pets.end()).all([](const pet& pet) {
2525
return pet.name.starts_with("B");
2626
});
2727

examples/xtd.core.examples/linq/enumerable_any3/src/enumerable_any3.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ using namespace xtd::linq;
88

99
auto main() -> int {
1010
auto numbers = list {1, 2};
11-
auto has_elements = enumerable::any<int>(numbers.begin(), numbers.end());
11+
auto has_elements = enumerable::from(numbers.begin(), numbers.end()).any();
1212

1313
console::write_line("The list {0} empty.", has_elements ? "is not" : "is");
1414
}

examples/xtd.core.examples/linq/enumerable_any4/src/enumerable_any4.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ auto main() -> int {
2222
};
2323

2424
// Determine whether all pet names in the array start with 'B'.
25-
bool unvaccinated = enumerable::any<pet>(pets.begin(), pets.end(), [](const pet& pet) {
25+
bool unvaccinated = enumerable::from(pets.begin(), pets.end()).any([](const pet& pet) {
2626
return pet.age > 1 && !pet.vaccinated;
2727
});
2828

examples/xtd.core.examples/linq/enumerable_append2/src/enumerable_append2.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ auto main() -> int {
1111
auto numbers = list {1, 2, 3, 4};
1212

1313
// Trying to append any value of the same type
14-
enumerable::append(numbers.begin(), numbers.end(), 5);
14+
enumerable::from(numbers.begin(), numbers.end()).append(5);
1515

1616
// It doesn't work because the original list has not been changed
1717
console::write_line(string::join(", ", numbers));
1818

1919
// It works now because we are using a changed copy of the original list
20-
console::write_line(string::join(", ", enumerable::append(numbers.begin(), numbers.end(), 5)));
20+
console::write_line(string::join(", ", enumerable::from(numbers.begin(), numbers.end()).append(5)));
2121

2222
// If you prefer, you can create a new list explicitly
23-
auto new_numbers = enumerable::append(numbers.begin(), numbers.end(), 5).to_list();
23+
auto new_numbers = enumerable::from(numbers.begin(), numbers.end()).append(5).to_list();
2424

2525
// And then write to the console output
2626
console::write_line(string::join(", ", new_numbers));

examples/xtd.core.examples/linq/enumerable_count_by/src/enumerable_count_by.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using namespace xtd;
44

55
struct student : iequatable<student> {
6+
student() = default;
67
student(const string& name, const string& score) : name {name}, score {score} {}
78

89
string name;

0 commit comments

Comments
 (0)