8000 view functor generation by h-2 · Pull Request #153 · seqan/seqan3 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

view functor generation #153

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

Merged
merged 2 commits into from
Mar 5, 2018
Merged

view functor generation #153

merged 2 commits into from
Mar 5, 2018

Conversation

h-2
Copy link
Member
@h-2 h-2 commented Mar 2, 2018

fixes #142

@h-2 h-2 assigned rrahn Mar 2, 2018
@h-2 h-2 requested review from rrahn and sarahet March 2, 2018 15:20
// be e.g. "int" and not "int &&", but we really want the tuple in the functor
// to always only contain lvalue or rvalue references
// [adding rvalue reference to lvalue reference is NOP which we want]
return {std::add_rvalue_reference_t<arg_types>(args)...};
Copy link
Member Author

Choose a reason for hiding this comment

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

I found this last-minute, before it generated dangling stack references if the argument type inside the view was &.
😅

Copy link
Member Author
@h-2 h-2 Mar 2, 2018

Choose a reason for hiding this comment

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

hm, or maybe I didnt fix it 🤔

8000
@h-2 h-2 force-pushed the internal/view_detail branch 4 times, most recently from bc9e2a4 to fd7f4fc Compare March 2, 2018 18:09
@h-2 h-2 added the in progress label Mar 2, 2018
@h-2 h-2 force-pushed the internal/view_detail branch from 542d19f to 075b1d3 Compare March 2, 2018 19:25
@h-2 h-2 removed the in progress label Mar 2, 2018
@h-2
Copy link
Member Author
h-2 commented Mar 2, 2018

ok, done from my POV

/*************++ without args ************************/

// not actually a view
template <typename urng_t>
Copy link
Member

Choose a reason for hiding this comment

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

sry for the stupid question, but what is a urange? what does the u stand for?

Copy link
Member Author

Choose a reason for hiding this comment

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

TL;DR: u stands for underyling range. It is the range object this views operates on.

Since view functors operate on another range and return a new range (more precisely a view), I used to call the types the input range (irng_t irange) and the output range. However this is confusing, because input range and output range are actually concepts that describe certain characteristics of the range, not whether they are returned from a functor or put into one...
So the range returned is actually also a seqan3::input_range_concept and not a seqan3::output_range_concept. Seeing that this was confusing I already renamed the "output range" to "returned range" in our documentation.

I now discussed with @rrahn that we also rename the input to "underlying range". This is a TODO for the existing views, but in this PR and #154, well as our Tutorial already adapt this naming.

@marehr
Copy link
Member
marehr commented Mar 3, 2018 via email

Copy link
Contributor
@rrahn rrahn left a comment

Choose a reason for hiding this comment

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

As discussed, we can make this even more developer friendly by merging both classes into one.


//!\brief Helper function to unpack the tuple.
template <typename urng_t, size_t... Is>
auto explode(urng_t && urange, std::index_sequence<Is...> const &)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just minor thing. This function should be scoped in a protected region.
Not really an exposable interface.
The same holds for the arguments member.

@h-2 h-2 force-pushed the internal/view_detail branch from 075b1d3 to 859b545 Compare March 5, 2018 13:56
@h-2 h-2 force-pushed the internal/view_detail branch from 859b545 to 0f37a47 Compare March 5, 2018 14:20
@h-2
Copy link
Member Author
h-2 commented Mar 5, 2018

@rrahn I think I addressed all your concerns. For the arguments member of the intermediate functor type I have renamed it _arguments, because make a data member non-public prevents aggregate initialisation leading to half a page of constructors having to be defined which would make the whole thing more difficult to read, I think.

@rrahn
Copy link
Contributor
rrahn commented Mar 5, 2018

lgtm

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.

Add a nice wrapper class to avoid implementing pipe-operator for custom views.
3 participants
0