Skip to content

Conversation

@gabyx
Copy link

@gabyx gabyx commented Feb 14, 2019

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.

{
template<typename Fn, typename Type>
struct visit{
static constexpr void call(Fn f){ f(Type{}); }
Copy link
Author

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.


#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.
Copy link
Author

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)
Copy link
Author

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...

@gabyx gabyx force-pushed the feature/meta-visit branch from a7a6d05 to b39c151 Compare February 17, 2019 10:24
@gabyx
Copy link
Author

gabyx commented Feb 17, 2019

Rebased onto master.
Now it should be clean to review.

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.

1 participant