On 03/06/14 05:57, Charles Parker wrote:
Chris, that was it I needed to do both things. It then complained
about trying to allocate the in_edges and out_edges arrays in the
constructor which is how I thought dynamic arrays are allocated
on the heap. I removed the 2 new statements, and both
On Tuesday, 3 June 2014 at 05:40:44 UTC, Edwin van Leeuwen wrote:
On Monday, 2 June 2014 at 23:44:01 UTC, Rene Zwanenburg wrote:
On Monday, 2 June 2014 at 20:09:12 UTC, Edwin van Leeuwen
wrote:
As you may have guessed, a workaround is to copy the iteration
variable yourself:
unittest {
On 06/02/2014 10:40 PM, Edwin van Leeuwen wrote:
On Monday, 2 June 2014 at 23:44:01 UTC, Rene Zwanenburg wrote:
On Monday, 2 June 2014 at 20:09:12 UTC, Edwin van Leeuwen wrote:
As you may have guessed, a workaround is to copy the iteration
variable yourself:
unittest {
size_t
I've run across this myself. The workaround I used was to call a
function from inside the foreach loop, and in that function you
construct the delegate (with the index variable passed as a
parameter).
Hah, sorry, I didn't read the last post. I did exactly what Ali
just suggested.
On Tuesday, 3 June 2014 at 07:00:35 UTC, Ali Çehreli wrote:
Here is a workaround:
unittest {
size_t delegate()[size_t] events;
auto makeClosure(size_t i) {
return { return i; };
}
foreach( i; 1..4 ) {
events[i] = makeClosure(i);
}
assert( events[1]()
Ali Çehreli:
Here is a workaround:
unittest {
size_t delegate()[size_t] events;
auto makeClosure(size_t i) {
return { return i; };
}
foreach( i; 1..4 ) {
events[i] = makeClosure(i);
}
You can also use two lambdas to do that, without the
makeClosure:
The title
More ref return fixes in std.datetime now that the compiler
allows them
of
https://github.com/D-Programming-Language/phobos/pull/2227/files
made me curious to what is meant by ref return. Is this a recent
improvement in DMD?
On Tue, 03 Jun 2014 10:14:21 +
Nordlöw via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:
The title
More ref return fixes in std.datetime now that the compiler
allows them
of
https://github.com/D-Programming-Language/phobos/pull/2227/files
made me curious to what is
No. We've been able to return by ref for ages. However, when
Thx
On Monday, 2 June 2014 at 23:27:03 UTC, Meta wrote:
On Monday, 2 June 2014 at 22:18:39 UTC, bioinfornatics wrote:
Hi,
I would like store the delegate to another var but when i try i
get:
testTraitsWithDelegate.d(13): Error: expression template
__lambda2 is void and has no value
I do not
On Tuesday, 3 June 2014 at 12:27:45 UTC, bioinfornatics wrote:
On Monday, 2 June 2014 at 23:27:03 UTC, Meta wrote:
On Monday, 2 June 2014 at 22:18:39 UTC, bioinfornatics wrote:
Hi,
I would like store the delegate to another var but when i try
i
get:
testTraitsWithDelegate.d(13): Error:
On Mon, 02 Jun 2014 17:25:24 -0400, John Colvin
john.loughran.col...@gmail.com wrote:
On Monday, 2 June 2014 at 20:23:12 UTC, Steven Schveighoffer wrote:
On Mon, 02 Jun 2014 15:58:01 -0400, Steven Schveighoffer
schvei...@yahoo.com wrote:
I'm trying to think of a way to do this without
On Mon, 02 Jun 2014 19:43:58 -0400, Rene Zwanenburg
renezwanenb...@gmail.com wrote:
On Monday, 2 June 2014 at 20:09:12 UTC, Edwin van Leeuwen wrote:
I'm probably missing something basic, but I am confused by what is
going on in the following code.
unittest {
size_t delegate()[size_t]
On 06/03/2014 05:57 AM, bioinfornatics wrote:
On Tuesday, 3 June 2014 at 12:27:45 UTC, bioinfornatics wrote:
I would like store the delegate to another var but when i try i
get:
testTraitsWithDelegate.d(13): Error: expression template
__lambda2 is void and has no value
I do not want to
On Tuesday, 3 June 2014 at 15:00:05 UTC, Ali Çehreli wrote:
On 06/03/2014 05:57 AM, bioinfornatics wrote:
On Tuesday, 3 June 2014 at 12:27:45 UTC, bioinfornatics wrote:
I would like store the delegate to another var but when i
try i
get:
testTraitsWithDelegate.d(13): Error: expression
Is there a function in phobos that lets me do something like
DateTime.format(MM:DD: ) with a DateTime instance?
delegate has a context pointer that it uses when executing
at run-time. However, there can't be a run-time context of a
delegate that is created at compile-time. I think that is why
the segfault.
Is there a reason why it needs to be a delegate?
Replacing every 'delegate' with 'function'
I've made my first attempt to use dub/vibe.d and I'm running into
some issues I can't find on the list.
I'm on Ubuntu 14.04/x86_64, using the latest stable dub (0.9.21).
I can create a new dub project:
“””
$ dub init test vibe.d
Successfully created an empty project in
On Tuesday, 3 June 2014 at 16:16:10 UTC, Chris Saunders wrote:
I've made my first attempt to use dub/vibe.d and I'm running
into some issues I can't find on the list.
I'm on Ubuntu 14.04/x86_64, using the latest stable dub
(0.9.21). I can create a new dub project:
“””
$ dub init test vibe.d
On 05/24/2014 11:01 AM, Ali Çehreli wrote:
On 05/24/2014 10:02 AM, w0rp wrote:
I have been writing my own hashmap which can provide forward ranges
usable in @safe pure nothrow functions, because it's going to be useful
for creating graph data structures with the same. I came to writing my
On Tue, 03 Jun 2014 17:07:02 +0200
Robert Schadek via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
Is there a function in phobos that lets me do something like
DateTime.format(MM:DD: ) with a DateTime instance?
Not currently. It's on my todo list. I intend to get back
On 06/03/2014 07:12 PM, Jonathan M Davis via Digitalmars-d-learn wrote:
On Tue, 03 Jun 2014 17:07:02 +0200
Robert Schadek via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
Is there a function in phobos that lets me do something like
DateTime.format(MM:DD: ) with a
Thanks, I somehow missed the vibe.d forums...
I'd need an ldc solution in the end, but trying dmd is a good
idea. The result is some kind of link error to libevent?:
dub build
vibe-d: [vibe-d, libevent, openssl]
test: [test, vibe-d, libevent, openssl]
Target is up to date. Using existing
On Tuesday, 3 June 2014 at 17:41:27 UTC, Chris Saunders wrote:
Thanks, I somehow missed the vibe.d forums...
I'd need an ldc solution in the end, but trying dmd is a good
idea. The result is some kind of link error to libevent?:
dub build
vibe-d: [vibe-d, libevent, openssl]
test: [test,
On Tuesday, 3 June 2014 at 15:14:06 UTC, bioinfornatics wrote:
without using a delegate, with a function that will not work as
(int a) = a == 42 is a delegate no ?
D will decide the type based on if context is needed. If you look
at the output you had:
, __ctmp1474).this(function (int
On Tue, 03 Jun 2014 19:39:14 +0200
Robert Schadek via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
On 06/03/2014 07:12 PM, Jonathan M Davis via Digitalmars-d-learn
wrote:
On Tue, 03 Jun 2014 17:07:02 +0200
Robert Schadek via Digitalmars-d-learn
On Tuesday, 3 June 2014 at 13:30:13 UTC, Steven Schveighoffer
wrote:
There is a school of thought (to which I subscribe) that says
you shouldn't allocate a separate closure for each loop
iteration.
Basically, a closure will only use the stack frame of the
calling function, not any loop
Are asserts supposed to be evaluated in DMD release? I was getting a
privileged instructions error 0xC096 which was caused by an
assert, when doing some gc programming in druntime
On Tuesday, 3 June 2014 at 19:21:08 UTC, Etienne wrote:
Are asserts supposed to be evaluated in DMD release? I was
getting a privileged instructions error 0xC096 which was
caused by an assert, when doing some gc programming in druntime
Is this part of the runtime precompiled? If not the
Etienne:
Are asserts supposed to be evaluated in DMD release? I was
getting a privileged instructions error 0xC096 which was
caused by an assert, when doing some gc programming in druntime
assert(0) are not removed in release builds. They are a HALT.
Bye,
bearophile
On 06/03/2014 08:22 PM, Jonathan M Davis via Digitalmars-d-learn wrote:
On Tue, 03 Jun 2014 19:39:14 +0200
Robert Schadek via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
On 06/03/2014 07:12 PM, Jonathan M Davis via Digitalmars-d-learn
wrote:
On Tue, 03 Jun 2014 17:07:02
On Tuesday, 3 June 2014 at 18:22:59 UTC, Jonathan M Davis via
Digitalmars-d-learn wrote:
Well, I would prefer to do it myself, but I obviously can't say
that I
wouldn't accept it if someone else did it and did a good job of
it. The main
problem however is that we need to come up with a good
On Tuesday, 3 June 2014 at 22:10:06 UTC, bioinfornatics wrote:
I do not see why it fail in debug output we see that tuple have
a
field with given name.
Your generated output (short and formatted)
alias TL = Tuple!(int,x, bool function( const ref string ),
xStartsWith , bool function(
Hello I am having the following problem. I am trying to turn a
program I have written into a shared object. I have ran into some
problems however. When I use writeln instead of printf my program
segfaults. I have edited the code to just the parts causing the
problem.
=main.d
On Wednesday, 4 June 2014 at 03:49:25 UTC, Harpo wrote:
Hello I am having the following problem. I am trying to turn a
program I have written into a shared object. I have ran into
some problems however. When I use writeln instead of printf my
program segfaults. I have edited the code to just
On Wednesday, 4 June 2014 at 04:46:59 UTC, ed wrote:
On Wednesday, 4 June 2014 at 03:49:25 UTC, Harpo wrote:
Hello I am having the following problem. I am trying to turn a
program I have written into a shared object. I have ran into
some problems however. When I use writeln instead of printf
Thanks! that was perfect.
-Harpo
Is it possible to override std tuple's toString format?
so that
auto a = tuple(hello,1,2,3);
writeln(a);
prints
(hello, 1, 2, 3)
and not
Tuple!(string, int, int, int)(hello, 1, 2, 3)
I'm aware I could write a custom formatter function, but it would
be nice not
On Tue, 03 Jun 2014 22:54:11 +
Brad Anderson via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
On Tuesday, 3 June 2014 at 18:22:59 UTC, Jonathan M Davis via
Digitalmars-d-learn wrote:
Well, I would prefer to do it myself, but I obviously can't say
that I
wouldn't accept
40 matches
Mail list logo