Conversation
| [](auto val) -> int_or_unsigned_constant<Scalar> { | ||
| if (val != UNDEFINED) { | ||
| return {val}; | ||
| } | ||
| return {UNDEFINED}; | ||
| return from_int(val); | ||
| }); |
There was a problem hiding this comment.
It's possible to remove this lambda all together, with something like
static_cast<int_or_constant<Scalar> (*)(Scalar)>(from_int)but this felt a bit unwieldy to me, so I opted to keep the lambda.
There was a problem hiding this comment.
And you can't just replace the lambda with from_int ?
There was a problem hiding this comment.
Unfortunately not; transform is unable to infer the type of from_int. I think this is because from_int is an overloaded function template. Something like this seems to work:
auto r = rx::iterator_range(self.begin(), self.end())
| rx::transform<int_or_constant<Scalar> (*)(Scalar)>(
&from_int);Should we go with that instead?
There was a problem hiding this comment.
Nah, the lambda is better. Sorry for the noise.
|
This is a draft until I can get the tests passing |
I don't see anything obviously wrong with the changes in this pr, I wonder what's going on with the ci |
This PR includes some minor quality-of-life improvements such as removing redundant aliases, changing parameters to const-references, and using the
from_intfunction more.