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

🆕 Add mp_quote_expr to quote with lambda expressions #61

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

krzysztof-jusiak
Copy link

Problem:

  • There is no easy way to quote metafunction directly with lambda expressions.

Solution:

  • Add mp_quote_expr.

Note:

  • mp_quote_expr requires C++20.

@krzysztof-jusiak krzysztof-jusiak force-pushed the mp_quote_expr branch 11 times, most recently from 98605ce to 771b1f0 Compare June 14, 2021 00:03
@krzysztof-jusiak
Copy link
Author

@pdimov would you be able to take a look, please?

@pdimov
Copy link
Member

pdimov commented Jun 16, 2021

Do you have an example of actual use? The example you're adding to the docs doesn't quite do what it says in the description; it replaces all types not having value with void, instead of finding those that have value.

You need to check feature macros against their specified values (e.g. >= 2019xx), not just whether they are defined. (For a lambda to be usable as Expr the compiler also needs to support lambdas in unevaluated contexts, but I suppose the trait doesn't technically require that.)

@krzysztof-jusiak
Copy link
Author

Thanks for your feedback, @pdimov.

Sure, I'll update the example to more descriptive. The basic idea is just to enable C++20 style lambdas (especially with if constexpr and requires) for simplicity of usage (instead of declaring aliases).

Yeah, I was trying that but both clang and gcc didn't set the date correctly.

@krzysztof-jusiak
Copy link
Author

@pdimov Updated the example. Hopefully, the update makes it more clear/descriptive.
I also check again whether feature macros can be used purely without any workarounds but it seems that they always return the same standard date although the implementation differs :/

@krzysztof-jusiak krzysztof-jusiak force-pushed the mp_quote_expr branch 2 times, most recently from 1851388 to e92b0ce Compare June 19, 2021 16:24
Problem:
- There is no easy way to quote metafunction directly with lambda expressions.

Solution:
- Add mp_quote_expr.

Note:
- mp_quote_expr requires C++20.
@krzysztof-jusiak
Copy link
Author

@pdimov I updated feature macros to verify the date as you suggested. I hope that works for you. Is there anything else you would like me to address? Thank you.

@pdimov
Copy link
Member

pdimov commented Jun 19, 2021

It's fine; but I have more pressing things to do at the moment, so I'll need to come back to this later, and maybe not in time for 1.77.

@krzysztof-jusiak
Copy link
Author

No worries @pdimov , fully understood. Thank you. Pinging, just in case you are free and/or to show that the MR isn't stale.

@krzysztof-jusiak
Copy link
Author

Hey @pdimov. I know you are busy, just pinging in case you are available, no worries if not. Thanks.

@pdimov
Copy link
Member

pdimov commented Aug 29, 2021

I sat on this for a while because I wasn't sure what I want to do with it. Adding references doesn't feel like the right thing to do, for example.

But I've now made up my mind and I don't think it belongs in the library, it's not a good fit conceptually. Sorry.

It's still cool and would make a good blog post.

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

Successfully merging this pull request may close these issues.

2 participants