Writing a long series of "static if ... else" statements can be
tedious and I'm prone to leaving out the crucial "static" after
"else", so I was wondered if it was possible to write a template
that would resemble the switch statement, but for types.
Closest I came up to was this:
void match
On Saturday, 25 June 2016 at 03:29:02 UTC, rikki cattermole wrote:
On 25/06/2016 5:57 AM, Dlangofile wrote:
Hi all,
I'm building a Docker Alpine linux image with wine, for being
able to
forge Windows executable from my laptop, without having to
dual boot.
With my disappointment, I'm not abl
On Saturday, 25 June 2016 at 08:46:05 UTC, John wrote:
Writing a long series of "static if ... else" statements can be
tedious and I'm prone to leaving out the crucial "static" after
"else", so I was wondered if it was possible to write a
template that would resemble the switch statement, but f
On Saturday, 25 June 2016 at 08:46:05 UTC, John wrote:
Anyone able to improve on it?
q&d hack:
template tyma(T, Cases...) {
import std.traits;
template GetFunc(size_t idx) {
static if (idx >= Cases.length) {
static assert(0, "no delegate for match");
} else static if (isCalla
also, there is a subtle bug in matcher. sorry. ;-)
On Saturday, 25 June 2016 at 09:07:19 UTC, Lodovico Giaretta
wrote:
Instead of passing functions to match!, pass pairs of
arguments, like this:
match!(T,
int, writeln("Matched int"),
is(T : SomeObject), writeln("Derives from SomeObject");
);
Now, in the implementation
On 25/06/2016 9:03 PM, Dlangofile wrote:
On Saturday, 25 June 2016 at 03:29:02 UTC, rikki cattermole wrote:
On 25/06/2016 5:57 AM, Dlangofile wrote:
Hi all,
I'm building a Docker Alpine linux image with wine, for being able to
forge Windows executable from my laptop, without having to dual boo
On Saturday, 25 June 2016 at 09:39:21 UTC, rikki cattermole wrote:
On 25/06/2016 9:03 PM, Dlangofile wrote:
On Saturday, 25 June 2016 at 03:29:02 UTC, rikki cattermole
wrote:
On 25/06/2016 5:57 AM, Dlangofile wrote:
Hi all,
I'm building a Docker Alpine linux image with wine, for
being able t
On Saturday, 25 June 2016 at 09:12:12 UTC, Lodovico Giaretta
wrote:
On Saturday, 25 June 2016 at 09:07:19 UTC, Lodovico Giaretta
wrote:
Instead of passing functions to match!, pass pairs of
arguments, like this:
match!(T,
int, writeln("Matched int"),
is(T : SomeObject), w
On 25/06/2016 10:25 PM, Dlangofile wrote:
On Saturday, 25 June 2016 at 09:39:21 UTC, rikki cattermole wrote:
On 25/06/2016 9:03 PM, Dlangofile wrote:
On Saturday, 25 June 2016 at 03:29:02 UTC, rikki cattermole wrote:
On 25/06/2016 5:57 AM, Dlangofile wrote:
Hi all,
I'm building a Docker Alpi
On 06/24/2016 10:03 PM, TheDGuy wrote:
On Friday, 24 June 2016 at 16:44:59 UTC, Gerald wrote:
Other then the obvious multi-threaded, using glib.Timeout to trigger
the reversion of the color change could be an option.
http://api.gtkd.org/src/glib/Timeout.html
Thanks! I tried this so far:
p
On Saturday, 25 June 2016 at 10:39:09 UTC, John wrote:
Thanks for the help, both. This appeared to work, until I
realised the lambda isn't static:
void match(T, cases...)() {
static if (cases.length == 1) cases[0]();
else static if (cases.length > 2) {
static if (is(typeof(cases
On Saturday, 25 June 2016 at 12:30:22 UTC, Lodovico Giaretta
wrote:
If you want this to work, you need your lambdas to take the
casted value as a parameter:
void test(T)(T value) {
int i;
string s;
match!(value,
int, (val) => i = val,
string, (val) => s = val
On Saturday, 25 June 2016 at 11:45:40 UTC, Mike Wey wrote:
You should change the css class in the timeout_delay function.
It's called by the GTK main loop every time the amount of
seconds passed to the constructor has passed. And return true
if you want to continue to flash the button, and f
Hi everyone,
I have some issue with win32 function SetWindowsHookEx. For this
specific funtion there is no possibility to pass extra data
(pointer to a class instance to be called) to the callback
function.
The general solution seems to use thunks. I found s.th. for c++:
http://www.codeproje
On Saturday, 25 June 2016 at 13:44:48 UTC, Andre Pany wrote:
Does D/Phobos has any support for thunks?
It isn't included in the stdlib, but you can use the same C++
they describe in the link in D.
On Saturday, 25 June 2016 at 13:44:48 UTC, Andre Pany wrote:
Hi everyone,
I have some issue with win32 function SetWindowsHookEx. For
this specific funtion there is no possibility to pass extra
data (pointer to a class instance to be called) to the callback
function.
The general solution se
On Saturday, 25 June 2016 at 14:06:51 UTC, John wrote:
On Saturday, 25 June 2016 at 13:44:48 UTC, Andre Pany wrote:
[...]
This will only work on X86:
version(X86)
struct FunctionPtr(TDelegate) if (is(TDelegate == delegate)) {
[...]
Thanks a lot John, that's fantastic.
Kind regards
André
On Saturday, 25 June 2016 at 12:35:39 UTC, Lodovico Giaretta
wrote:
On Saturday, 25 June 2016 at 12:30:22 UTC, Lodovico Giaretta
wrote:
If you want this to work, you need your lambdas to take the
casted value as a parameter:
Thanks.
On Saturday, 25 June 2016 at 13:01:09 UTC, TheDGuy wrote:
Thanks for your answer.
I have to pass the Button object to my timeout function to
change the CSS class. But how do i do that within the Timeout
constructor?
I mean:
I have to pass my function and delay time to the constructor, but
i
On Saturday, 25 June 2016 at 15:26:00 UTC, TheDGuy wrote: }
But i get the error:
Error: none of the overloads of '__ctor' are callable using
argument types (bool delegate(void* userData), int, bool),
candidates are:
This is the correct error message:
Error: none of the overloads of '__ctor'
On Saturday, 25 June 2016 at 13:44:48 UTC, Andre Pany wrote:
Does D/Phobos has any support for thunks?
Made this a while ago:
http://stackoverflow.com/a/8656294/21501
On Saturday, 25 June 2016 at 16:05:30 UTC, Vladimir Panteleev
wrote:
On Saturday, 25 June 2016 at 13:44:48 UTC, Andre Pany wrote:
Does D/Phobos has any support for thunks?
Made this a while ago:
http://stackoverflow.com/a/8656294/21501
Thanks, I had a look. Unfortunately it doesn't compile
On Saturday, 25 June 2016 at 17:26:03 UTC, Andre Pany wrote:
On Saturday, 25 June 2016 at 16:05:30 UTC, Vladimir Panteleev
wrote:
On Saturday, 25 June 2016 at 13:44:48 UTC, Andre Pany wrote:
Does D/Phobos has any support for thunks?
Made this a while ago:
http://stackoverflow.com/a/8656294/2
On 06/25/2016 05:26 PM, TheDGuy wrote:
On Saturday, 25 June 2016 at 13:01:09 UTC, TheDGuy wrote:
Thanks for your answer.
I have to pass the Button object to my timeout function to change the
CSS class. But how do i do that within the Timeout constructor?
I mean:
I have to pass my function and
On Saturday, 25 June 2016 at 20:39:53 UTC, Mike Wey wrote:
The constructor accepts an delegate, witch can access it's
context so it has access to some of the data.
The functions from GTK are also available like Timeout.add from
the linked tutorial:
http://api.gtkd.org/src/glib/Timeout.html#
On Saturday, 25 June 2016 at 21:57:35 UTC, TheDGuy wrote:
But i want to flash (e.g. change the CSS class) the buttons one
by one and not all at the sime time? How am i going to do that?
Okay, i tried it with a new private int-variable which contains
the current index of the for-loop, like this
27 matches
Mail list logo