On Wednesday, 8 February 2017 at 07:41:29 UTC, Ali Çehreli wrote:
test.naturalSort would sort the array in place before calling
writeln and 'test' would appear naturally sorted as well. I've
fixed it like this:
Great! Thank you!
On 02/06/2017 09:00 PM, Dmitry wrote:
> On Monday, 6 February 2017 at 18:57:17 UTC, Ali Çehreli wrote:
>> I think it's now std.algorithm.chunkBy. Please fix Rosetta
>
> Thank you!
> I fixed
Thank you!
> but anyway it works incorrect (it doesn't any changes):
The problem was with the following
On 02/07/2017 01:17 AM, Chris Katko wrote:
void function3(T)(T) //hypothetical, specify the datatype in the
argument list
{
T data;
}
Related:
https://dlang.org/library/object/type_info.html
and
https://dlang.org/library/object/object.factory.html
This compiles but I'm not
On Tuesday, 7 February 2017 at 21:40:04 UTC, Dukc wrote:
On Tuesday, 7 February 2017 at 10:21:20 UTC, Mike Parker wrote:
function2!float(); //?
function3!float(); //?
Yes, this is how it's done.
Not quite with function3, because it takes one unnamed runtime
parameter. It can be call
On 02/07/2017 02:04 PM, Bastiaan Veelo wrote:
>> This optimization cannot work if the array is a static array inside
>> the same struct. It would work with a dynamic array but then it would
>> probably be slower than applying the *(ptr+index) technique.
>
> You mean slower than the _payload[index
On Tuesday, 7 February 2017 at 20:33:35 UTC, Ali Çehreli wrote:
On 02/07/2017 02:11 AM, Bastiaan Veelo wrote:
> We do not need to take measures against the GC?
Of course we have to and the struct that I wrote is illegal
because it is self-referencing through the _ptr member. (D has
the right
On Tuesday, 7 February 2017 at 09:21:18 UTC, Kagamin wrote:
Can't find a reason why it's not inferred @safe (on linux). Any
idea?
Perhaps you are trying to read as a type for which a conversion
from string to it is @system? Not sure if that's possible.
On Tuesday, 7 February 2017 at 10:21:20 UTC, Mike Parker wrote:
function2!float(); //?
function3!float(); //?
Yes, this is how it's done.
Not quite with function3, because it takes one unnamed runtime
parameter. It can be called like function1 however. The value of
the parameter doe
On Tuesday, 7 February 2017 at 20:28:30 UTC, Ali Çehreli wrote:
You forgot to call that most important function. ;)
Hah of course. I assumed the name would give it some special
meaning, like postblit.
1) I don't understand the first assert there, which does not
pass for me, so I commented i
Pressed send too soon, before considering your GC question.
On 02/07/2017 02:11 AM, Bastiaan Veelo wrote:
> We do not need to take measures against the GC?
Of course we have to and the struct that I wrote is illegal because it
is self-referencing through the _ptr member. (D has the right to mo
On 02/07/2017 02:11 AM, Bastiaan Veelo wrote:
> void init() {
> assert( first < cast(size_t)_payload.ptr); //
> Address space underrun.
> assert(-first < size_t.max - cast(size_t)_payload.ptr); //
> Address space overrun.
> this._ptr = _payload.ptr - first
auto arr = uninitializedArray!(int[][])(ROWS,COLS);
arr.each!"a[]=-1";
This looks like what I was looking for. At least I think I
understand what's going on here. The other two suggestions are
beyond my scope yet, but I'll come back, when I improved on my D
skills. Thanks for your replies.
On Sunday, 5 February 2017 at 20:33:06 UTC, berni wrote:
With X not known at compile time:
auto arr = new int[][](X,X);
for (int i=0;i
Is there anything better for this? I mean, the program will
fill the array with zeroes, just to overwrite all of them with
-1. That's wasted execution time a
On Tuesday, 7 February 2017 at 13:37:01 UTC, Atila Neves wrote:
Here still example
https://pp.vk.me/c636630/v636630885/46579/neSdIip1ySI.jpg
On Tuesday, 7 February 2017 at 13:37:01 UTC, Atila Neves wrote:
On Tuesday, 7 February 2017 at 10:46:24 UTC, kinke wrote:
I've only every done trivial C++ integration before. As soon as
I tried something "real" it all broke down incredibly fast.
Probably going to have to file some bugs on name
On Tuesday, 7 February 2017 at 10:46:24 UTC, kinke wrote:
On Tuesday, 7 February 2017 at 10:15:09 UTC, Atila Neves wrote:
I can declare a C++ struct like so:
extern(C++, mynamespace)
struct Foo {
//...
}
But... I don't want to repeat the initialisation code for that
struct's default constr
On Tuesday, 7 February 2017 at 10:15:09 UTC, Atila Neves wrote:
I can declare a C++ struct like so:
extern(C++, mynamespace)
struct Foo {
//...
}
But... I don't want to repeat the initialisation code for that
struct's default constructor. I can't declare one in D because
D doesn't allow de
On Tuesday, 7 February 2017 at 09:17:04 UTC, Chris Katko wrote:
Can I pass a type, instead of a variable of a type, to a
template function in order to decide the datatype of T in a
function?
Yes. That's rather the point.
function1(f); //works
That is actually shorthand for this:
func
I can declare a C++ struct like so:
extern(C++, mynamespace)
struct Foo {
//...
}
But... I don't want to repeat the initialisation code for that
struct's default constructor. I can't declare one in D because D
doesn't allow default constructors for structs. What's my way
out? Thanks,
Ati
On Monday, 6 February 2017 at 23:42:55 UTC, Ali Çehreli wrote:
Then you use _ptr when indexing:
// Support e = arr[5];
ref T opIndex(ptrdiff_t index) {
assert(index >= first);
assert(index <= last);
return *(_ptr + index);
}
Ali
Thank you very much for your
On Tuesday, 7 February 2017 at 09:21:18 UTC, Kagamin wrote:
Can't find a reason why it's not inferred @safe (on linux). Any
idea?
Uh ? It's safe
Just tried
import std.stdio;
void main(string[] args) @safe
{
File f;
ubyte[] z;
z = f.rawRead(z);
}
And it compiles (DMD 2.
Can't find a reason why it's not inferred @safe (on linux). Any
idea?
Can I pass a type, instead of a variable of a type, to a template
function in order to decide the datatype of T in a function?
void function(T)(T x) //works
{
T data;
//do stuff with T, ignoring x.
}
void function2(T)() //hypothetical, specify the type... somehow?
{
T
23 matches
Mail list logo