On Tuesday, October 8, 2019 9:40:33 AM MDT Paul Backus via Digitalmars-d-
learn wrote:
> On Sunday, 6 October 2019 at 20:34:55 UTC, Brett wrote:
> > If it can be done and make to work well with ranges it would
> > allow many algorithms to be very easily expressed and make
> > ranges more powerful.
On Sunday, 6 October 2019 at 20:34:55 UTC, Brett wrote:
If it can be done and make to work well with ranges it would
allow many algorithms to be very easily expressed and make
ranges more powerful.
You can make it a range by adding an "alias this" to the original
array:
struct
Here is a sort of proof of concept:
struct CtsExtend
{
static auto opCall(T)(T a)
{
struct _CtsExtend
{
T _a;
auto opIndex(int i)
{
if (i < 0)
On Saturday, 5 October 2019 at 00:38:06 UTC, Brett wrote:
Typically a lot of algorithms have corner cases such as
referencing elements that end up out of bounds at the start or
end (k-c or k+c).
[...]
mir-algorithm package provides lazy padding and concatenation
routines
Typically a lot of algorithms have corner cases such as
referencing elements that end up out of bounds at the start or
end (k-c or k+c).
Is there any way to handle such things easily without having to
worry about the corners?
E.g., have it return a default value such as 0, or repeat the