Skip to content

Commit

Permalink
make constructor public
Browse files Browse the repository at this point in the history
  • Loading branch information
9il committed Apr 26, 2016
1 parent a5502af commit f8eaa9d
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions std/experimental/ndslice/slice.d
Expand Up @@ -1147,30 +1147,37 @@ struct Slice(size_t _N, _Range)
mixin(mathIndexStrideCode);
}

this(ref in size_t[PureN] lengths, ref in sizediff_t[PureN] strides, PureRange range)
static if (!hasPtrBehavior!PureRange)
this(ref in size_t[PureN] lengths, ref in sizediff_t[PureN] strides, PtrShell!PureRange shell)
{
foreach (i; Iota!(0, PureN))
_lengths[i] = lengths[i];
foreach (i; Iota!(0, PureN))
_strides[i] = strides[i];
static if (hasPtrBehavior!PureRange)
_ptr = range;
else
_ptr._range = range;

_ptr = shell;
}

static if (!hasPtrBehavior!PureRange)
this(ref in size_t[PureN] lengths, ref in sizediff_t[PureN] strides, PtrShell!PureRange shell)
public:

/++
This constructor should be used only for integration with other languages or libraries such as Julia and numpy.
Params:
lengths = lengths
strides = strides
range = range or pointer to iterate on
+/
this(ref in size_t[PureN] lengths, ref in sizediff_t[PureN] strides, PureRange range)
{
foreach (i; Iota!(0, PureN))
_lengths[i] = lengths[i];
foreach (i; Iota!(0, PureN))
_strides[i] = strides[i];
_ptr = shell;
static if (hasPtrBehavior!PureRange)
_ptr = range;
else
_ptr._range = range;
}

public:

/++
Returns: static array of lengths
Expand Down

0 comments on commit f8eaa9d

Please sign in to comment.