Skip to content

Rewrite not_tuple, add FWD macro - #13

Merged
Bronek merged 4 commits into
mainfrom
feature/rewrite_not_tuple_and_utility
Jan 18, 2024
Merged

Bronek merged 4 commits into
mainfrom
feature/rewrite_not_tuple_and_utility

Conversation

@Bronek

@Bronek Bronek commented Jan 17, 2024

Copy link
Copy Markdown
Member

A minor change to rewrite (and simplify) not_tuple, gets rid of get interface (another reason to call it "not tuple") and instead limits the interface to function invocation only (which is exactly what functor needs). With thanks to @atomgalaxy for the idea.

Also added FWD macro and reorganised small bits and pieces into utility.hpp header.

@Bronek
Bronek force-pushed the feature/rewrite_not_tuple_and_utility branch from f7cf440 to c3b3454 Compare January 17, 2024 18:14
@codecov

codecov Bot commented Jan 17, 2024 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (b416757) 99.09% compared to head (2dcff6f) 98.91%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #13      +/-   ##
==========================================
- Coverage   99.09%   98.91%   -0.18%     
==========================================
  Files          10        9       -1     
  Lines         110       92      -18     
  Branches        6        6              
==========================================
- Hits          109       91      -18     
  Partials        1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

requires std::invocable<decltype(fn),
decltype(std::forward<decltype(v)>(v).value())>
requires std::invocable<decltype(fn), decltype(FWD(v).value())>
&& (!std::is_void_v<decltype(v.value())>)

@atomgalaxy atomgalaxy Jan 17, 2024 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a feeling you might be better off if you made a "some_void_expected" concept...

In that case, you probably don't need this restriction at all, since the above invocable will SFINAE anyway, and then the below one is the right one if you also constrain it with some_void_expected

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea, will switch to concepts in a separate PR

Comment thread include/functional/detail/not_tuple.hpp Resolved
Comment thread include/functional/detail/not_tuple.hpp Resolved
Comment thread include/functional/functor.hpp Outdated
detail::get<I>(std::forward<decltype(self)>(self).data)...);
}(std::make_integer_sequence<unsigned, size>{});
constexpr static typename functor_type::apply fn{};
return data_t::invoke(FWD(self).data, FWD(fn), FWD(v));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this peeves me off - would be so nice if we inlined not_tuple into here and just... not have two more inlining contexts...

future improvement.

Comment thread include/functional/inspect.hpp Resolved
Comment thread include/functional/detail/not_tuple.hpp Resolved
@Bronek
Bronek force-pushed the feature/rewrite_not_tuple_and_utility branch from ed9a2e9 to 4e16405 Compare January 18, 2024 15:19
@Bronek
Bronek force-pushed the feature/rewrite_not_tuple_and_utility branch from 4e16405 to 2dcff6f Compare January 18, 2024 15:34
@Bronek
Bronek merged commit cea7837 into main Jan 18, 2024
@Bronek
Bronek deleted the feature/rewrite_not_tuple_and_utility branch October 12, 2024 17:46
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