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

is_reflectable documentation #164

Open
anarthal opened this issue Mar 21, 2024 · 2 comments
Open

is_reflectable documentation #164

anarthal opened this issue Mar 21, 2024 · 2 comments
Labels
help wanted PR with a fix wouod be appreciated

Comments

@anarthal
Copy link
Contributor

I've been trying to understand is_reflectable, but I fail to get what to pass as second argument. My case looks like this:

template <class RowType>
class static_results {
    static_assert(pfr::is_pfr_reflectable<RowType, Something>::value, "RowType must be reflectable");
    // Implementation
};

I want to check that my user type provided me with a RowType that is a structure that can be reflected, i.e. I can call structure_to_tuple, for_each_field and friends on it.

@anarthal
Copy link
Contributor Author

I thought I had it with this line:

static_assert(pfr::is_implicitly_reflectable<MyType, struct t>(), "");

But it looks like it only returns a suitable value on C++17 and above. Otherwise it returns always false. From reading the code, it looks like implicit reflection is referring to the structured bindings reflection technique available only on C++17. However, this is never stated in the docs, and the "always return false" behavior is surprising.

@apolukhin
Copy link
Member

I'd appreciate a PR with the fixes :)

@apolukhin apolukhin added the help wanted PR with a fix wouod be appreciated label Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted PR with a fix wouod be appreciated
Projects
None yet
Development

No branches or pull requests

2 participants