On 13/07/2015 6:36 p.m., tcak wrote:
To keep the story short (if necessary, I can explain the use-case), if
there any way to abort compilation with a message. I would use "static
if" or "version" to check a situation, and "pragma msg" to show a
message. But I couldn't have found any "proper" way
To keep the story short (if necessary, I can explain the
use-case), if there any way to abort compilation with a message.
I would use "static if" or "version" to check a situation, and
"pragma msg" to show a message. But I couldn't have found any
"proper" way to abort compilation.
I don't know what exactly you're after, but you can use
foreach on a whatever-they're-called-now tuple (there's been a
discussion about the name which I haven't followed; I mean the
kind you get from a TemplateTupleParameter):
void f1() {}
void f2() {}
void callThemAll(functions ...)()
{
On Sunday, 12 July 2015 at 22:26:44 UTC, anonymous wrote:
You don't need the lambda, do you? -> return x.map!fun.array;
You're right.
I don't know what exactly you're after, but you can use foreach
on a whatever-they're-called-now tuple (there's been a
discussion about the name which I h
https://www.reddit.com/r/datasets/comments/3bxlg7/i_have_every_publicly_available_reddit_comment/
On Sunday, 12 July 2015 at 21:07:34 UTC, jmh530 wrote:
private template givemeabettername(alias fun)
{
T givemeabettername(T : U[], U)(T x)
if (isArray!(T))
{
return x.map!(a => fun(a)).array;
You don't need the lambda, do you? -> return x.map!fun.array;
}
}
Very
On Sunday, 12 July 2015 at 20:31:20 UTC, jmh530 wrote:
On Sunday, 12 July 2015 at 17:11:04 UTC, anonymous wrote:
And personally, I'd probably just type out `x.map!fun.array`
every time.
[1] http://dlang.org/hijack.html
Thanks for the comments.
After thinking it over, I think you're absol
On Sunday, 12 July 2015 at 17:11:04 UTC, anonymous wrote:
And personally, I'd probably just type out `x.map!fun.array`
every time.
[1] http://dlang.org/hijack.html
Thanks for the comments.
On Sunday, 12 July 2015 at 17:33:50 UTC, anonymous wrote:
On Sunday, 12 July 2015 at 17:25:17 UTC, Gary Willoughby wrote:
Why does the following code fail to compile if the
`writeln(value);` line is present?
The error message (formatted to be a little more readable):
Error: function test2
On Sunday, 12 July 2015 at 17:25:17 UTC, Gary Willoughby wrote:
Why does the following code fail to compile if the
`writeln(value);` line is present?
The error message (formatted to be a little more readable):
Error: function test2.__unittestL6_1.Foo.opApply
(int delegate(ref string) not
Why does the following code fail to compile if the
`writeln(value);` line is present?
public template ForeachAggregate(T)
{
alias ForeachAggregate = int delegate(ref T) nothrow;
}
unittest
{
import std.stdio;
class Foo
{
private string[] _data =
Finally, I decide to use https://github.com/etcimon/libasync and
now it work well.
Thank you for your answers.
On Sunday, 12 July 2015 at 16:34:17 UTC, jmh530 wrote:
I've been playing around with this a little more. I wrote this
function to encapsulate a simple operation on arrays.
U array_fun(T, U)(T fp, U x)
if (isFunctionPointer!(T) && isArray!(U))
{
return x.map!(a => fp(a)).array;
}
On Wednesday, 8 July 2015 at 18:31:00 UTC, Steven Schveighoffer
wrote:
You can use a function lambda:
auto fp = (real a) => cos(a);
Note, I had to put (real a) even though I would have expected
"a => cos(a)" to work.
-Steve
I've been playing around with this a little more. I wrote this
f
On Sunday, 12 July 2015 at 08:38:01 UTC, Tofu Ninja wrote:
Is it even possible?
Yes, though you need to use an entirely different approach for
closures: make a struct.
Remember that delegates can come from local variable use or a
`this` object being used and work the same way to the outside
On Sunday, 12 July 2015 at 11:42:09 UTC, ketmar wrote:
nope. there is no way to overload context allocation function,
afaik. at least without patching druntime, and i still don't
know what one have to patch. ;-)
_d_allocmemory
On Sunday, 12 July 2015 at 11:42:09 UTC, ketmar wrote:
On Sun, 12 Jul 2015 09:03:24 +, Tofu Ninja wrote:
On Sunday, 12 July 2015 at 08:47:37 UTC, ketmar wrote:
On Sun, 12 Jul 2015 08:38:00 +, Tofu Ninja wrote:
Is it even possible?
what do you mean?
Sorry, thought the title was en
On Sunday, 12 July 2015 at 11:22:41 UTC, Baz wrote:
At least now your Question is clearer and understandable...but
sorry goodbye. I don't feel good vibes here. See ya ^^.
Sorry if I came off as rude, didn't mean to... >.>
On Sun, 12 Jul 2015 09:03:24 +, Tofu Ninja wrote:
> On Sunday, 12 July 2015 at 08:47:37 UTC, ketmar wrote:
>> On Sun, 12 Jul 2015 08:38:00 +, Tofu Ninja wrote:
>>
>>> Is it even possible?
>>
>> what do you mean?
>
> Sorry, thought the title was enough.
>
> The context for a delegate(assu
On Sunday, 12 July 2015 at 10:39:44 UTC, Tofu Ninja wrote:
On Sunday, 12 July 2015 at 10:19:02 UTC, Baz wrote:
[...]
That is not manually allocating a delegate context, and & in
that instance does not even allocate. For delegates to class
methods, the context is just the "this" pointer of th
On Sunday, 12 July 2015 at 10:19:02 UTC, Baz wrote:
You can copy a delegate in a GC-free chunk but so far i think
that the simple fact to get a delegate with "&" will allocate
from the GC.
By the way i'd be interested to see the runtime function that
creates a delegate.
i see nothing in drun
On Sunday, 12 July 2015 at 09:03:25 UTC, Tofu Ninja wrote:
On Sunday, 12 July 2015 at 08:47:37 UTC, ketmar wrote:
On Sun, 12 Jul 2015 08:38:00 +, Tofu Ninja wrote:
Is it even possible?
what do you mean?
Sorry, thought the title was enough.
The context for a delegate(assuming not a met
On Sunday, 12 July 2015 at 08:47:37 UTC, ketmar wrote:
On Sun, 12 Jul 2015 08:38:00 +, Tofu Ninja wrote:
Is it even possible?
what do you mean?
Sorry, thought the title was enough.
The context for a delegate(assuming not a method delegate) is
allocated by the GC. Is there any way to a
On Sun, 12 Jul 2015 08:38:00 +, Tofu Ninja wrote:
> Is it even possible?
what do you mean?
signature.asc
Description: PGP signature
Is it even possible?
25 matches
Mail list logo