Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refl::util::detail::filter(..) inverts order of member list #64

Closed
RalphSteinhagen opened this issue Jan 7, 2022 · 2 comments
Closed

Comments

@RalphSteinhagen
Copy link
Contributor

There might be a regression in the last refl-cpp release:
refl::util::detail::filter(..) seems to invert the member order which has a notable impact on the find_first() method.

#include <iostream>
#include <https://raw.githubusercontent.com/veselink1/refl-cpp/master/include/refl.hpp>

struct Point {
    float x;
    float y;
    float z;
};
REFL_TYPE(Point)
    REFL_FIELD(x)
    REFL_FIELD(y)
    REFL_FIELD(z)
REFL_END

constexpr auto members = refl::reflect<Point>().members;
constexpr auto condition = [](auto member) { return true; };
static_assert(find_first(members, condition).name == "x");  // <- fails but should be correct
// static_assert(find_first(members, condition).name == "z"); // works

See compiler-explorer for further details and a live demo of this feature.

@RalphSteinhagen RalphSteinhagen changed the title refl::util::detail::filter(..) inverts order of member refl::util::detail::filter(..) inverts order of member list Jan 7, 2022
RalphSteinhagen added a commit to RalphSteinhagen/refl-cpp that referenced this issue Jan 7, 2022
apparently the 'append_t' needed to change to 'prepend_t' introduced in #a5819553

possible fix for issue veselink1#64
@veselink1
Copy link
Owner

That's pretty bad! Thanks for reporting!

veselink1 pushed a commit that referenced this issue Jan 8, 2022
apparently the 'append_t' needed to change to 'prepend_t' introduced in #a5819553

possible fix for issue #64
@RalphSteinhagen
Copy link
Contributor Author

Fixed by mdrged PR #65

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants