4#include <reflection-cpp/reflection.hpp>
12template <
typename Record>
16 DifferenceView(Record
const* lhs, Record
const* rhs)
noexcept:
22 template <
typename Callback>
23 void Iterate(Callback
const& callback)
noexcept
25 Reflection::template_for<0, Reflection::CountMembers<Record>>([&]<
auto I>() {
26 if (std::find(indexes.begin(), indexes.end(), I) != indexes.end())
28 callback(Reflection::GetMemberAt<I>(*lhs), Reflection::GetMemberAt<I>(*rhs));
33 void push_back(
size_t ind)
noexcept
35 indexes.push_back(ind);
38 std::vector<size_t> indexes;
43template <
typename Record>
44DifferenceView<Record> CollectDifferences(Record
const& left, Record
const& right)
noexcept
47 DifferenceView<Record> view { &left, &right };
49 Reflection::CollectDifferences(
50 left, right, [&](
size_t ind, [[maybe_unused]]
auto const& left_elem, [[maybe_unused]]
auto const& right_elem) {