#undef NDEBUG
struct Person {
constexpr Person(int a, int e) noexcept
: age{a}
, experience{e}
{
}
friend constexpr auto operator==(Person lhs, Person rhs) noexcept -> bool = default;
int age{};
int experience{};
};
auto main() -> int
{
assert(people.capacity() == 32);
people.push_back(Person{20, 0});
assert(people.back().age == 20);
people.emplace_back(90, 100);
assert(people.back().age == 90);
auto const copy = people;
auto levelUp = [](auto p) {
p.experience += 1;
return p;
};
assert(people[0].experience == 1);
assert(people[1].experience == 101);
return 0;
}
#define assert(...)
Definition cassert.hpp:19
constexpr auto transform(InputIt first, InputIt last, OutputIt dest, UnaryOp op) -> OutputIt
Applies the given function to a range and stores the result in another range, beginning at dest....
Definition transform.hpp:24
constexpr auto copy(InputIt first, InputIt last, OutputIt destination) -> OutputIt
Copies the elements in the range, defined by [first, last), to another range beginning at destination...
Definition copy.hpp:18
constexpr auto end
Definition end.hpp:56
constexpr auto begin
Definition begin.hpp:61
Dynamically-resizable fixed-capacity vector.
Definition static_vector.hpp:329