Am 05.07.2016 um 17:22 schrieb Marc Schütz:
> auto concat(T : E[n], E, size_t n)(const E[][] args...) @nogc
> {
> size_t offset = 0;
> T result = void;
> foreach(arr; args) {
> result[offset .. offset+arr.length] = arr;
> offset += arr.length;
> }
> assert(offset
Am 05.07.2016 um 17:12 schrieb Johannes Loher:
> Am 05.07.2016 um 16:39 schrieb Rene Zwanenburg:
>> On Tuesday, 5 July 2016 at 12:34:20 UTC, Johannes Loher wrote:
>>> I tried this, but it does not work correctly with slices.
>>
>> The length of a slice is a runtime value, which is why it can't be u
auto concat(T : E[n], E, size_t n)(const E[][] args...) @nogc
{
size_t offset = 0;
T result = void;
foreach(arr; args) {
result[offset .. offset+arr.length] = arr;
offset += arr.length;
}
assert(offset == result.length);
return result;
}
static immutable ub
Am 05.07.2016 um 16:39 schrieb Rene Zwanenburg:
> On Tuesday, 5 July 2016 at 12:34:20 UTC, Johannes Loher wrote:
>> I tried this, but it does not work correctly with slices.
>
> The length of a slice is a runtime value, which is why it can't be used
> to set static array size. What were you trying
On Tuesday, 5 July 2016 at 12:34:20 UTC, Johannes Loher wrote:
I tried this, but it does not work correctly with slices.
The length of a slice is a runtime value, which is why it can't
be used to set static array size. What were you trying to
achieve? Avoid copying the input arrays, or accept
Am 05.07.2016 um 00:41 schrieb Rene Zwanenburg:
> On Monday, 4 July 2016 at 19:22:52 UTC, Johannes Loher wrote:
>> This looks really nice, but I have several occurences of this, with
>> different arrays (and lengths), so i would need to create several of
>> those structs. But it looks really clean
On Monday, 4 July 2016 at 19:22:52 UTC, Johannes Loher wrote:
This looks really nice, but I have several occurences of this,
with different arrays (and lengths), so i would need to create
several of those structs. But it looks really clean :)
You can use a template to remove the boilerplate. H
Am 04.07.2016 um 19:24 schrieb ZombineDev:
> On Monday, 4 July 2016 at 14:31:41 UTC, Johannes Loher wrote:
>> In a project I am currently working on, I have lot's of code of the
>> following form:
>>
>> static immutable ubyte[4] sigma0 = [101, 120, 112, 97]; static
>> immutable ubyte[4] sigma1 = [
Am 04.07.2016 um 20:33 schrieb Ali Çehreli:
> On 07/04/2016 07:31 AM, Johannes Loher wrote:
>> In a project I am currently working on, I have lot's of code of the
>> following form:
>>
>> static immutable ubyte[4] sigma0 = [101, 120, 112, 97];
>> static immutable ubyte[4] sigma1 = [110, 100, 32,
On 07/04/2016 07:31 AM, Johannes Loher wrote:
> In a project I am currently working on, I have lot's of code of the
> following form:
>
> static immutable ubyte[4] sigma0 = [101, 120, 112, 97];
> static immutable ubyte[4] sigma1 = [110, 100, 32, 51];
> static immutable ubyte[4] sigma2 = [ 50,
On Monday, 4 July 2016 at 14:31:41 UTC, Johannes Loher wrote:
In a project I am currently working on, I have lot's of code of
the following form:
static immutable ubyte[4] sigma0 = [101, 120, 112, 97]; static
immutable ubyte[4] sigma1 = [110, 100, 32, 51]; static
immutable ubyte[4] sigma2
In a project I am currently working on, I have lot's of code of the
following form:
static immutable ubyte[4] sigma0 = [101, 120, 112, 97];
static immutable ubyte[4] sigma1 = [110, 100, 32, 51];
static immutable ubyte[4] sigma2 = [ 50, 45, 98, 121];
static immutable ubyte[4] sigma3 = [116, 10
12 matches
Mail list logo