-
Notifications
You must be signed in to change notification settings - Fork 46
meta::visit added in accordance to meta::for_each. (only c++17) #73
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
base: master
Are you sure you want to change the base?
Conversation
| { | ||
| template<typename Fn, typename Type> | ||
| struct visit{ | ||
| static constexpr void call(Fn f){ f(Type{}); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to use this struct dispatch to defer no to have void as Type instantiate
in FnPtr.
include/meta/meta.hpp
Outdated
|
|
||
| #if META_CXX_INLINE_VARIABLES | ||
| /// `visit(List, I, Fn)` calls the \p UnaryFunction for the \p i | ||
| /// -th argument in the \p List. No-opt if \p i not in range. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not want to throw exception here -> no-op if not in range. Should we make that UB and leave the check to the user?
| #endif | ||
|
|
||
| #ifndef META_CXX_VISIT | ||
| #define META_CXX_VISIT (META_CXX_VER >= META_CXX_STD_17) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need full c++17 support -> constexpr everywhere...
a7a6d05 to
b39c151
Compare
|
Rebased onto master. |
This is my first shot. Maybe there are better solutions. I tried hard to stick to the current for_each implementation and use the same approach.
-> Tests/Doc added.