On Wednesday, 12 May 2021 at 09:52:52 UTC, Alain De Vos wrote:
As oppposed to what i expect code below prints nothing nothing
on the screen. What is wrong and how to fix it ?
```
import std.stdio;
import std.range:iota;
import std.algorithm:map;
bool mywriteln(int x){
writeln(x);
On Monday, 23 November 2020 at 17:39:09 UTC, Adam D. Ruppe wrote:
On Monday, 23 November 2020 at 17:34:27 UTC, visitor wrote:
Hi all,
I would like to know why in the code below, rgba.ptr[0] is
used instead of rgba[0] and allowing the method to be @safe
The .ptr[0] skips bounds checking.
Hi all,
I would like to know why in the code below, rgba.ptr[0] is used
instead of rgba[0] and allowing the method to be @safe
float[4] rgba = 0;
ref inout(float) r() inout pure @trusted { pragma(inline, true);
return rgba.ptr[0]; }
why not :
ref inout(float) r() inout pure @safe {
https://run.dlang.io/is/xiqi4P
not pretty :)) but ...
On Wednesday, 9 September 2020 at 17:02:26 UTC, visitor wrote:
On Friday, 14 February 2020 at 06:41:02 UTC, cc wrote:
import std.meta;
enum A = AliasSeq!(1, 2, 3, 4);
static foreach (idx, field; A) {
static if (__traits(compiles, THREELOOP)) {} else {
static if (field == 3) {
On Friday, 14 February 2020 at 06:41:02 UTC, cc wrote:
import std.meta;
enum A = AliasSeq!(1, 2, 3, 4);
static foreach (idx, field; A) {
static if (__traits(compiles, THREELOOP)) {} else {
static if (field == 3) {
pragma(msg, "Got a 3!");
enum
On Friday, 16 March 2018 at 20:19:59 UTC, aberba wrote:
On Friday, 16 March 2018 at 17:11:17 UTC, visitor wrote:
On Friday, 16 March 2018 at 10:31:51 UTC, Jayam wrote:
I creating one simple desktop application using dlang. I need
to display some html file in my desktop application. How can
On Friday, 16 March 2018 at 10:31:51 UTC, Jayam wrote:
I creating one simple desktop application using dlang. I need
to display some html file in my desktop application. How can
make it works ?
There's also gtkd sourceview :
On Sunday, 4 March 2018 at 19:53:59 UTC, ag0aep6g wrote:
On 03/04/2018 08:45 PM, ag0aep6g wrote:
I don't know what's going on here. The error message doesn't
make sense to me. Might be a bug in the compiler.
This one works:
struct Stack(T) {
T[] stack;
alias stack this;
bool
On Saturday, 6 January 2018 at 19:35:33 UTC, paul wrote:
Hi!
How to concatenate a tuple of strings at compile time?
Something like that maybe ?
import std.stdio;
import std.meta;
enum connected = () {
auto something = AliasSeq!("one", "two", "three");
string res = "";
static
On Thursday, 4 January 2018 at 01:40:21 UTC, Mark wrote:
What I'm trying to do here is to be able to call a function
based off of a key.
class tester {
private void delegate() [char] funcs;
this() {
funcs = ['a': , 'b': ];
}
public void
On Monday, 25 December 2017 at 21:35:18 UTC, visitor wrote:
On Monday, 25 December 2017 at 21:11:08 UTC, aliak wrote:
On Monday, 25 December 2017 at 17:59:54 UTC, visitor wrote:
On Monday, 25 December 2017 at 15:03:08 UTC, aliak wrote:
On Monday, 25 December 2017 at 14:08:08 UTC, Mengu wrote:
On Monday, 25 December 2017 at 21:11:08 UTC, aliak wrote:
On Monday, 25 December 2017 at 17:59:54 UTC, visitor wrote:
On Monday, 25 December 2017 at 15:03:08 UTC, aliak wrote:
On Monday, 25 December 2017 at 14:08:08 UTC, Mengu wrote:
I was kind of hoping for some magical D variadic alias
On Monday, 25 December 2017 at 17:59:54 UTC, visitor wrote:
On Monday, 25 December 2017 at 15:03:08 UTC, aliak wrote:
On Monday, 25 December 2017 at 14:08:08 UTC, Mengu wrote:
I was kind of hoping for some magical D variadic alias
template on Tuple or something that will just deconstruct the
On Monday, 25 December 2017 at 15:03:08 UTC, aliak wrote:
On Monday, 25 December 2017 at 14:08:08 UTC, Mengu wrote:
I was kind of hoping for some magical D variadic alias template
on Tuple or something that will just deconstruct the arguments
in to tuple components.
i don't think it's
On Thursday, 15 December 2016 at 17:44:23 UTC, David Zhang wrote:
would something like this be a solution ?
import std.stdio;
import std.experimental.allocator;
class SomeClass {
int someint = 42;
static SomeClass opCall(int a) {
auto inst = theAllocator.make!SomeClass;
On Monday, 14 December 2015 at 11:45:50 UTC, Namal wrote:
foreach(k;1..11){
auto t = prim_factors(k,P);
v~= [k,product(t)];
}
it crashes because your first t in the loop is an empty array
because 1 is not a prime ( in "prim_sieve" :
On Sunday, 13 December 2015 at 03:08:33 UTC, Namal wrote:
This works for me :
import std.stdio, std.algorithm, std.range;
int[] prim_factors(int n, const int[] P) {
int[] v;
P.filter!( x => x*x <= n).each!( (i) {
while (n % i == 0) {
v ~= i;
n /= i;
ok, i have a working version (memory is nice, twice the speed as
non parallel) ;
http://dpaste.dzfl.pl/504a652c6c47
real0m14.427s
user1m19.347s
sys 0m0.124s
i've got similar performances, without Allocators, using directly
malloc and free
i had to recursively deallocate ...
version with apr (like in c version)
http://dpaste.dzfl.pl/68c0157225e7
compiled with ldc it's indeed a bit faster on average :
real0m1.999s
user0m9.810s
sys 0m0.148
btw Rust version is even faster than my little bit outdated gcc
(4.9)
latest try with allocators :
using Apache Portable Runtime(APR) like in the C version :
http://dpaste.dzfl.pl/6ca8b5ffd6dc
works like a charm, 2.061s on my machine !
if file name is binarytrees.d
dmd -w -inline -O -release -I/usr/include/apr-1.0
-L/usr/lib/x86_64-linux-gnu/libapr-1.so -of"binarytrees"
"binarytrees.d"
C++ version :
real0m3.587s
user0m9.211s
sys 0m7.341s
On Monday, 7 December 2015 at 10:55:25 UTC, Alex wrote:
On Sunday, 6 December 2015 at 12:23:52 UTC, visitor wrote:
Hello, interesting exercise for me to learn about allocators
:-)
Nice to know, a novice can inspire someone :)
i managed to parallelize the code reaching similar
performance, in
On Sunday, 6 December 2015 at 08:35:33 UTC, Alex wrote:
Thanks for commenting to everyone! If anybody has further ideas
- all of them would be appreciated :)
The original site is not interested in any further languages to
be tested, so my experiment ends here for now...
Hello, interesting
gtkd demos for examples, might be of interest, like clock :
https://github.com/gtkd-developers/GtkD/blob/master/demos/cairo/cairo_clock/clock.d
On Monday, 30 November 2015 at 09:56:08 UTC, ref2401 wrote:
DMD 2.069.1
OS Win8.1 Enterprise
in a multiline statement, i believe you must use :
arr.each!((ref e) {
writeln(e);
++e;
})
"=>" is for oneliner
though i don"t understand why it fails silently ??
but there is no specific solution inside GTKD?
for example, in pseudo code
auto surf = new Surface(...); // look for cairo.Surface doc
auto cr = cairo.Context.Context.create(surf);
// pb is an existing gdkpixbuf.Pixbuf
gdk.Cairo.setSourcePixbuf(cr, pb, width, height);
cr.paint();
adding
On Monday, 30 November 2015 at 12:03:08 UTC, anonymous wrote:
On 30.11.2015 11:50, visitor wrote:
though i don"t understand why it fails silently ??
ref2491's original code is valid, but doesn't have the intended
meaning. `e => {foo(e);}` is the same as `(e) {return ()
{foo(e);};}`, i.e. a
28 matches
Mail list logo