Hi, can something like this (I borrowed the C pre-processor idea) be
done with variadic mixins?
#define log(variadic-arg) sys-log(%s:%s + variadic-arg[0], __FILE__,
__LINE__, variadic-arg[1..$]);
I read that mixins can only be used for declarations, and this here is
a function call. So
Windows, 32-Bit, DLL:
export extern(C) struct1 struct1(){
struct1 x;
return(x);
}
export extern(C) auto struct2(){
struct1 x;
return(x);
}
struct1 is visible in the DLL, struct2 is not visible in the DLL.
--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster
On 2015-03-14 20:45:21 +, Marc Schütz said:
As long as the pointer remains on the stack or in a register, the GC
will keep the allocation alive.
Hi Marc, ok, got it. Thanks.
But if your C code stores the pointer on the C heap or in a global,
the GC won't know anything about it and can
Hi, wondering why this happens:
import std.format;
void ods(T...)(auto ref T args){
format(args).ptr;
return;
}
ods(%s @ %s, mystring, mystring.ptr);
Error: undefined identifier format
If I add: import std.string; everything compiles and works.
Since the docs of std.format contains all
On 2015-03-14 22:55:57 +, Jonathan M Davis via Digitalmars-d-learn said:
In case you didn't know, if you're not running the program in visual studio,
you should see the output in in DebugView:
https://technet.microsoft.com/en-us/library/bb896647.aspx
Hi, yes I know, nevertheless thanks
On 2015-03-15 19:16:52 +, anonymous said:
Answerting myself:
static if (__traits(compiles, version_minor 67))
import std.string; // format() for versions 2.0.67
else
import std.format; // format() for versions = 2.0.67
That doesn't do what you want.
You need to `import std.compiler;`
On 2015-03-15 17:36:24 +, Robert M. Münch said:
Is there a way to use version(...) to have code sections depending on
compiler version? Something like:
version(dmd = 2.067) or version(dmd 2.067)?
Answerting myself:
static if (__traits(compiles, version_minor 67))
import std.string;
On 2015-03-15 16:22:03 +, Marc Schütz said:
For whatever reasons, format() used to be defined in std.string. Indeed
it's unintuitive to have it there, and it also pulls in lots of other
unrelated things like Unicode tables when you import std.string. That's
why it was moved into
On 2015-03-19 13:22:44 +, Benjamin Thaut said:
Generally don't expect to many things to work with DLLs at the moment.
Hi, well, I think what's available is good enough to get most things done.
Generally speaking only exporting global functions works. Don't try to
export classes /
On 2015-03-18 21:50:39 +, Adam D. Ruppe said:
It will not work because a function with an auto return value is
actually a template, and unused templates won't be put into a dll.
Ok, that makes it clear. Thanks.
--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster
On 2015-03-18 15:27:03 +, Daniel Kozák via Digitalmars-d-learn said:
You probably does not need mixins:
void log(string file = __FILE__, size_t line = __LINE__, T...)
(T variadic_arg) {
some_fun(variadic_arg[0], file, line, variadic_arg[1 .. $]);
}
Hi, ha, forgot about default
On 2015-03-15 15:57:43 +, Marc Schütz said:
Ok. I need to dig into how the interpreter handles the returned pointer
and how the stack is handled.
C usually uses manual memory management, therefore I would expect that
the interpreter actually documents whom the pointer belongs to, and who
Hi, I want to use the Windows OutputDebugString() which is not defined
anywhere.
How do I declare such missing Windows API functions myself? And with
which libaries do I then need to link? Does DMD contain all necessary
Windows link libs or am I supposed to get them myself?
So, it's not
On 2015-03-13 21:19:07 +, Adam D. Ruppe said:
In the file you want to use it, you can just write
extern(Windows) void OutputDebugStringA(in char*);
and it should work... or whatever the signature is, check msdn, and
remember the ones that take strings tend to need A or W for the ascii
Hi, I have a question about how the GC handles this case:
export extern(C) char* foo(){
char[] x = This is a dynamic D string..dup;
return(cast(char*)x);
}
Since x is pointer to array data length if it goes out of scope,
it's destroyed and the last reference to the array data is gone.
Hi, I just found quite old posts about Valgrind and D. Can someone give
me a short update, what the state of support for D is and if there is
anythings special to take into account. Thanks a lot.
--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster
Hi, is there anything for D that supports generating tags files like
ctags does for C etc. ?
--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster
On 2015-04-20 13:29:57 +, John Colvin said:
On Monday, 20 April 2015 at 13:28:57 UTC, John Colvin wrote:
On Monday, 20 April 2015 at 13:16:23 UTC, Robert M. Münch wrote:
Hi, I just found quite old posts about Valgrind and D. Can someone give
me a short update, what the state of support
On 2015-04-28 17:52:57 +, Adam D. Ruppe said:
This can also be automated with a bit of code in a lot of cases:
import std.traits;
ParameterTypeTuple!foo params;
foreach(index, ref param; params) {
params[index] = args[index];
}
foo(params);
Move that into a helper function and you
How can I make use of the -vgc compiler switch in my DUB project?
--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster
Hi, I have now played a around couple of hours (reading everything I
could find) to get something to work, but I think I'm missing some
basic concepts/understanding. Maybe someone can enlighten me how these
things work. I thought that some code from David Nadlinger is what I'm
searching for
On 2015-05-04 03:52:21 +, Rikki Cattermole said:
Have you looked at my book? https://leanpub.com/ctfe
No, thanks for the hint. You will have one more reader ;-)
--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster
On 2015-05-03 23:28:00 +, anonymous said:
Here T would have to be a type. But you want to accept a string. So:
template startsNotWith(string s,char c){
enum startsNotWith = s.length == 0 || s[0] != c;
}
Hi, ok, just to better understand this (I have a C++ background (even
On 2015-05-03 23:28:00 +, anonymous said:
You need to turn T into a parameter, so that StaticFilter can set it.
(And it's really a string again, so I'm renaming to s.)
template startsNotWithp(string s)
{
enum startsNotWithp = startsNotWith!(s, 'p');
}
/* Shorthand syntax: enum
I find this a bit strange:
// get all rules that start with p...
enum BolRules = StaticFilter!(beginsWithP, __traits(allMembers,BolSource));
static assert(is(BolRules == enum));
Compiling using dmd...
source/app.d(114): Error: static assert (is(BolRules == enum)) is false
I'm trying to
On 2015-05-04 17:21:34 +, ketmar said:
that's due to `enum` keyword abusing. enum type is something like this:
enum MyEnum { A, B }
and
enum val = false;
is a compile-time boolean constant, which will be inlined on using. i.e.
compiler will inline such enum constants, and that
On 2015-05-04 03:52:21 +, Rikki Cattermole said:
Have you looked at my book? https://leanpub.com/ctfe
I bought it. Will it be updated?
It's very generic with respect the concept and I'm missing code
examples for all the user-cases. Especially the generator part is IMO
very interesting.
On 2015-05-01 00:52:57 +, Laeeth Isharc said:
Does dflags work ?
http://code.dlang.org/package-format
Hi, yes. Overlooked this one as d(ebug)flags. Thanks.
--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster
Hi, I have the following problem: I have the parameters for a
function in an array. Now I want to call a function with a specific
arity and use the parameters from the array to call it.
Like this pseudo-code:
args = [10, 20];
def foo(a, b): return a + b;
print(foo(*args));
Is something
On 2015-05-04 22:22:51 +, ketmar said:
as i said, `typeid` is runtime feature, so you can't print it with pragma.
and tuples aren't exist in runtime, it's compile-time only.
i think you are even more confused now. ;-) sorry.
No, that makes it much more clearer for me. The compiler
On 2015-05-04 18:22:17 +, Ali Çehreli said:
There are many different kinds of tuples in D, only two of which I can handle:
1) Tuple from std.typecons, which are ordinarily created at run time
2) TypeTuple from std.typetuple, which are compile-time entities
The documentation is not clear
On 2015-05-15 17:26:50 +, Ali Çehreli said:
On 05/15/2015 09:45 AM, Robert M. Münch wrote:
Is there a way I can build an ENUM from within the FOREACH? What I want
to achive is, that I would like to use:
final switch (myEnum) ...
Sorry, I don't understand your question. :(
Do you
On 2015-06-16 18:36:09 +, Rob T said:
FYI:
https://issues.dlang.org/show_bug.cgi?id=11686
https://issues.dlang.org/show_bug.cgi?id=11687
Thanks. We are currently experimenting to see how want to use the
threads and what code to refactor. If we are going to bite the bullet I
keep this
On 2015-06-10 18:55:26 +, Adam D. Ruppe said:
I'm still tempted to grab a used Mac so I can port my display stuff to
Cocoa and test it, but Macs are outrageously expensive and I hate them,
so want to spend as little as possible.
Well, I would go at least for a 64-bit system. Otherwise
On 2015-06-14 15:54:30 +, Etienne Cimon said:
Yes, however nothing really guarantees multi-threading = multi-core.
The kernel reserves the right and will most likely do everything
possible to keep your process core-local to use caching efficiently.
Hi, sure. It's more about raising the
On 2015-08-23 17:01:07 +, Vladimir Panteleev said:
Can't reproduce this on Windows, Linux or OS X 10.10.3.
Ok, good. So it should be fixable on my side.
Can you include more of the build log (specifically, the entire failing
command line)? It should have a -J. in it.
CC=g++
Hi, just trying to build the latest DMD with Digger 2.3 and get this:
uffer.d root/port.d root/response.d root/rmem.d root/rootobject.d
root/speller.d root/stringtable.d newdelete.o glue.a backend.a
globals.d(293): Error: file verstr.h cannot be found or not in a path
specified with -J
make:
On 2015-08-23 16:23:57 +, John Colvin said:
almost certainly a consequence of the recent switchover to the dmd
frontend being written in D. Have you tried building the latest Digger
git HEAD first? If that doesn't work I suggest reporting it here for
Vladimir (CyberShadow) to look at:
On 2015-08-23 20:13:38 +, Vladimir Panteleev said:
Not really sure what's going on there... If I could reproduce it, I'd
try building DMD manually - if it still occurred, build DMD 2.067.1
from source and add debugging printfs to see why it's not finding
verstr.h.
I'm not building
On 2015-08-24 11:01:47 +, John Colvin said:
Is this from a clean clone of Digger, either with --recursive or having
done git submodule update --init ? What version of DMD are you using to
build it?
Hi, no it was not. Doing a git submodule update --init fixed this
problem. After this,
Hi, do you think it's possible to implemented something like Lua Tables
(a hashed heterogeneous associative array) in D?
I know that Lua is dynamic and interpreted, hence it's a lot simpler to
do than with a compiled language but I'm wondering if we could express
such a generic data-structure
On 2015-07-16 07:20:15 +, Fusxfaranto said:
An associative array of Variant[string] ought to do the job well enough.
http://dlang.org/phobos/std_variant.html
Thanks a lot. Somehow didn't see that...
--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster
On 2015-08-25 13:42:38 +, Vladimir Panteleev said:
And, any idea how I can print getcwd() during compile time? I tried but
it's not working by using the function directly... this is really
strange.
getcwd() doesn't work during compile time because it's a system call.
I really don't
On 2015-08-24 14:27:52 +, Vladimir Panteleev said:
Well, yes, your problem is that DMD 2.067 isn't finding a file while
compiling DMD HEAD. So you would need to debug DMD 2.067 to find why it
refuses to compile DMD HEAD.
Any way that I can switch to 2.068 for building HEAD? Not that I
Hi, I'm not sure how to best implement the following:
1. I have 4 different tasks to do.
2. All can run in parallel
3. Every task will return some result that I need
Now how to best do it? When using receive() it fires on the first hit
and the function continues. It's like a receive(OR), one
After getting Digger to work again on OSX now going for the Windows version:
digger: Preparing DigitalMars C++
digger: DMC=Y:\Digger\dl\dm\bin
digger: Preparing DMD
digger: hostDC=
digger: Running: "make" -f win32.mak ^"MODEL=32^" HOST_DC= dmd
digger:
On 2015-09-04 17:32:48 +, Justin Whear said:
How would receive know?
Well, it could be pretty simple. At the moment:
receive(
int ...,
long ...,
myStruct ...
)
Will wait for one out of the three. So it's an OR.
reveive_all(
int ...,
long ...,
On 2015-09-05 15:44:02 +, thedeemon said:
I think the Task and taskPool from std.parallelism are a good fit.
Something like:
auto task1 = task!fun1(params1);
auto task2 = task!fun2(params2);
auto task3 = task!fun3(params3);
auto task4 = task!fun4(params4);
taskPool.put(task1);
On 2015-08-23 17:01:07 +, Vladimir Panteleev said:
Can't reproduce this on Windows, Linux or OS X 10.10.3.
Can you include more of the build log (specifically, the entire failing
command line)? It should have a -J. in it.
I still try to get digger running on my OSX again. I fiddled
Some more tests with a simple example:
import std.stdio;
void main() {
writeln("hello world!" ~ import("signature.h"));
}
mac-pro:d-language robby$ dmd -v -J. hello.d
binarydmd
version v2.068.0
config/usr/local/bin/dmd.conf
parse hello
importall hello
importobject
Hi, I just wanted to naively copy an object and used:
a = myobj.dup;
and get the following error messages:
source/app.d(191): Error: template object.dup cannot deduce function
from argument types !()(BlockV), candidates are:
/Library/D/dmd/src/druntime/import/object.d(1872):
On 2016-01-07 20:14:15 +, Daniel Kozak via Digitalmars-d-learn said:
I remember e few days I have same issue but with libasync. I have to
remove .dub from my home directory (I do not know where is it in
windows) and after making new project I was able to make it works
Just to be sure I
On 2016-01-07 15:35:24 +, Robert M. Münch said:
When I build for Windows, it seems that the "libevent" driver is used.
I can see that there is a "Win32EventDriver" which setups a GUI message
loop as well. How can I use this driver instead of the "libevent" one?
Ok, after fiddling around
Hi, I have two questions regarding the following, IMO very cool, vibe feature:
"Contrary to most other frameworks supporting asynchronous I/O, vibe.d
fully integrates with the UI event loop, so that it can be used to
power applications with a graphical user interface."
1. Am I right, that
On 2016-01-12 04:15:36 +, Mike Parker said:
You can avoid all of these headaches by using dynamic bindings like
those at DerelictOrg [4] if they are available for the libraries you
use. Then the compile-time dependency on the C library goes away and
all you need is the DLL at runtime.
I
On 2016-01-11 01:47:54 +, Jason Jeffory said:
and how does one link in compiled static libraries into a dub project?
I tried adding stuff like
"lflags" : ["+C:\\MyLibs\\"],
with the .lib file in it, but that doesn't work. (I'd expect to have to
supply the file name somewhere, at least)
On 2016-01-11 06:53:51 +, Benjamin Thaut said:
You should not need to link manually against msvcrt, dmd does this for you.
Ok, that was what I expected.
You can view the linker commands that are stored inside a object file
via microsoft dumpbin tool "dumpbin /DIRECTIVES your.obj".
I made to compile a bunch of libs on Win64 and got my D project
compiled as well. Only problem left are some strange unresolved
externals.
Linking...
dmd
-of.dub\build\application-debug-windows-x86_64-dmd_2069-F0A1450B9B033D5CD11F3F60481557B0\webchat.exe
I was expecting that DUB / DMD & NMAKE take $LIB into account. I try to
compile some stuff on x64.
This is LIB:
D:\develop\d-language\webchat> $Env:lib
C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\LIB\amd64;C:\Program Files (x86)\Microsoft Visual Studio
On 2016-01-15 00:36:57 +, Mike Parker said:
Did you install DMD manually? In that case, you will usually need to
edit sc.ini to point to the proper VC and Win SDK directories. The DMD
installer should detect your installation and configure it for you.
I use Digger, hence this might be
On 2016-01-16 20:28:02 +, Dibyendu Majumdar said:
I have installed DMD by unzipping the DMD archive (The installer does
not work correctly on Windows 10). DUB installed as normal.
Check your paths in sc.ini Looks like the D link libraries are not found.
--
Robert M. Münch
On 2016-01-14 17:40:44 +, Robert M. Münch said:
I was expecting that DUB / DMD & NMAKE take $LIB into account. I try to
compile some stuff on x64.
This is LIB:
D:\develop\d-language\webchat> $Env:lib
C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\LIB\amd64;C:\Program Files
On 2016-02-06 14:33:57 +, Marc Schütz said:
I don't see why this wouldn't work, if you've in fact covered all combinations.
It works, the problem was that castSwitch returns something and I
didn't "catch" it.
It's similar to how castSwitch is implemented, though the double casts
are
On 2016-02-05 15:23:53 +, Marc Schütz said:
Does the following help?
...
I thought about it too, but I need it to work with more then one
parameter, so I tried this which doesn't work:
Value nativePlus(Value a, Value b){
// @@ not working, runtime exception
castSwitch!(
(IntV a)
From the docs:
class A { }
class B : A { }
class C : B { }
void foo(A);
void foo(B);
void test()
{
C c;
foo(c); // calls foo(B)
}
I need the other way around. So, at runtime I get an A and depending on
it's dynamic type, I would like to get the correct foo() called.
class A { }
On 2016-02-05 11:10:36 +, Nicholas Wilson said:
sounds like foo should just be a method in the class rather than a free
function
In my particular case I want to keep some stuff outside of claases.
--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster
Just compiled the latest release with digger. Everything works without
any problems, but the resulting binary shows the following version:
mac-pro:Digger robby$ ./result/bin/dmd --version
DMD64 D Compiler v2.069-devel-682687b
Copyright (c) 1999-2015 by Digital Mars written by Walter Bright
I
I have a very strange effect, I'm not sure what it is about:
Value: {}
WordV: Value {
Value* get() {}
}
BaseOperator: Value : {
}
Now comes the code using this:
auto op = cast(BaseOperator)(Word.get());
if (op !is null) {...
If get() returns "Value*" it segfaults, if I change it
I have:
class OperatorV(T) : Value {
T impl;
this(T impl) {
this.impl = impl;
}
...
and use it like this: makeOperator((IntV a, IntV b) => new IntV(a.num +
b.num));
Now I want to do: opWord.get() returns a Value
OperatorV *op = cast(OperatorV*)(opWord.get());
and get: Error: class
On 2016-02-03 14:35:16 +, Steven Schveighoffer said:
On 2/3/16 8:17 AM, Robert M. Münch wrote:
On 2016-02-02 18:59:35 +, Steven Schveighoffer said:
If this is valid D, I'm not sure what it means :)
There was one type, the rest I stripped totally away as IMO it's not
relevant for
On 2016-02-03 13:29:15 +, anonymous said:
Still missing "class". I know I'm being pedantic, but if you're being
sloppy here, how do I know that you're not being sloppy where it
matters?
You are right, sorry. I was to focused on the problem part...
If anything, you should be casting
On 2016-02-02 18:59:35 +, Steven Schveighoffer said:
If this is valid D, I'm not sure what it means :)
There was one type, the rest I stripped totally away as IMO it's not
relevant for the actual problem.
--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster
On 2018-05-18 14:42:17 +, Adam D. Ruppe said:
On Friday, 18 May 2018 at 14:06:11 UTC, Robert M. Münch wrote:
So, having a wrong return-type here, resulted in the const char *text
parameter always being NULL. Not sure I understand the relation but
looks strange to me... at least not very
I use the D RX lib [1] and can create a filtered stream using the auto keyword:
struct a {
SubjectObject!myType myStream;
??? mySubStream;
}
void myfunc(){
a myA = new a();
auto mySubStream = a.myStream.filter!(a => a == myMessage);
...
}
The problem
On 2018-05-20 14:49:59 +, Jonathan M Davis said:
In cases like this, typeof is your friend. e.g. something like
typeof(myStream.filter!(a => a == myMessage)) mySubStream;
Hi Jonathan, great! This got me a step further. So I can declare my
member now. But I get an implict cast error when
On 2018-05-20 17:40:39 +, Robert M. Münch said:
Hi Jonathan, great! This got me a step further. So I can declare my
member now. But I get an implict cast error when I try:
class a {
... myStream;
}
class b {
typeof(a.myStream.filter!(x => x == myMessage)) mySubStream;
}
I have an extern(C) function in a DLL with this signature:
result* myfunc(double x, double y, const char *text, stuff *myStuff,
bool flag);
I call it like this:
result = myfunc(0, 0, std.string.toStringz("1"), stuff, true);
The problem is, that on the DLL side *text is always NULL. I
On 2018-05-16 15:09:41 +, rikki cattermole said:
On 17/05/2018 3:07 AM, Robert M. Münch wrote:
I have an extern(C) function in a DLL with this signature:
result* myfunc(double x, double y, const char *text, stuff *myStuff,
bool flag);
I call it like this:
result = myfunc(0, 0,
If I use scope(failure) with code that should be run if an exception is
thrown, how can I set a breakpoint for this code in the debugger?
--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster
On 2018-05-21 17:24:12 +, Steven Schveighoffer said:
I'm not 100% sure but I expect:
scope(failure)
someCode();
putting a breakpoint on someCode should work.
When calling a function an then setting the breakpoint there, like in
someCode() yes, that should work.
I used code like
A project I can compile via the command line and dub, gives an error in
VisualD. I created the VisualD configuration through dub:
fatal error C1905: Front-End und Back-End sind nicht kompatibel
(müssen den gleichenProzessor verwenden).
This translates to: "Front-End and Back-End are not
On 2018-05-22 18:34:34 +, Ali ehreli said:
An idiom known in C++ circles is a Lippincott function:
https://cppsecrets.blogspot.ca/2013/12/using-lippincott-function-for.html
Just wanted to mention that it can be a part of a clean solution.
Thanks, and I assume that D has the same
On 2018-05-22 18:33:06 +, Jacob Carlborg said:
You can always create a function that takes a delegate or lambda and
handles the exception in the function. Here are three versions of the
same thing, depending on how you want the call site to look like.
Hi, great! Thanks for the
On 2018-05-16 17:46:59 +, Steven Schveighoffer said:
Well, for C see above on the D side:
extern(C) {
result myfunc(double x, double y, const char *text, stuff
*myStuff, bool measureOnly);
}
Shouldn't the result be a pointer?
Indeed. And you know what? That was
I see that I'm writing
try {
... different code ...
} catch (myException e) {
... same handling code ...
}
over and over again.
Of course I can put the exception handling code into a function to not
duplicate it. However, I still need to write this construct over and
over again. Is
On 2018-05-21 18:13:16 +, Ali ehreli said:
Templatized range types work well when they are used as template
arguments themselves.
When you need to keep a single type like 'b' (i.e. b is not a
template), and when you need to set a variable like mySubStream to a
dynamic object, the
On 2018-05-21 20:17:04 +, Jonathan M Davis said:
On Monday, May 21, 2018 16:05:00 Steven Schveighoffer via Digitalmars-d-
learn wrote:
Well one thing that seems clear from this example -- we now have
__traits(isSame) to tell if lambdas are the same, but it looks like the
compiler doesn't
On 2018-05-21 18:55:36 +, Steven Schveighoffer said:
So the issue here is that the lambda function inside myFunc is
DIFFERENT than the one inside b. They are both the same function, but
with essentially different names.
Aha... that explains it pretty good.
When you use the alias, both
I have a simple tree C data-structure that looks like this:
node {
node parent:
vector[node] children;
}
I would like to create two foreach algorthims, one follwing the breadth
first search pattern and one the depth first search pattern.
Is this possible? I read about
On 2018-06-14 11:46:04 +, Dennis said:
On Thursday, 14 June 2018 at 11:31:50 UTC, Robert M. Münch wrote:
Is this possible? I read about Inputranges, took a look at the RBTree
code etc. but don't relly know/understand where to start.
You can also use opApply to iterate over a tree using
This one look nasty...
I get an access violation crash after some time. The crash is
reproducible in that it always happens after some time while executing
the same code sequence (meaning the same function call chain).
The debugger kicks in with a call stack, but it looks strange to me:
On 2018-06-30 22:53:47 +, Jerry said:
Btw this is pretty much std.algorithm.each
import std.algorithm;
void main() {
auto cs = [ new C(), new C() ];
cs.each!(o => o.A());
}
https://dlang.org/phobos/std_algorithm_iteration.html#.each
The looping needs to be done in the handler
I hope this is understandable... I have:
class C {
void A();
void B();
void C();
}
I'm iterating over a set of objects of class C like:
foreach(obj; my_selected_objs){
...
}
The iteration and code before/afterwards always looks the same, I need
this iteration
On 2018-06-29 18:05:00 +, Ali ehreli said:
On 06/29/2018 09:44 AM, Robert M. Münch wrote:
So, how can I write a generic handler that does the iteration, where I
can specify which member function to call?
Passing a lambda or a string mixin:
Hi, that was somehow in my mind but didn't
How does it work if one of the members takes an argument that is
deduced inside the handler function?
On 2018-06-29 18:05:00 +, Ali ehreli said:
Passing a lambda or a string mixin:
import std.stdio;
class C {
void A() {
writeln(__FUNCTION__);
}
void B() {
I'm creating a bunch of objects and need to use these object pointers
with C code. Hence I need to protect them from being GC with GC.addRoot.
Can this call be made out of a constructor? So that I can protect the
objects as earyl as possible?
Could I then unprotect the memory inside the
On 2018-07-01 09:05:56 +, Robert M. Münch said:
This one look nasty...
And it was... the problem was, that I kept D allocated pointers in C
code without informing the GC that the memory can't be collected nor
moved. Bridging from D to C and back, is pretty tricky to not miss any
class A {
this(){...}
this(int a) {...}
this int a, int b){...}
}
class B {
this(){... init some stuff for B ...}
this(int a){super(a); this();}
}
Error: multiple constructor calls
I think it's because of "If a constructor's code contains a delegate
With the latest releasae I still have the same problem. I really don't
have any idea what the cause could be or how to fix it... Anyone?
Viele Grüsse. Robert M. Münch
On 2018-05-21 17:46:45 +, Robert M. Münch said:
A project I can compile via the command line and dub, gives an error in
On 2018-06-24 13:08:53 +, Rainer Schuetze said:
a new release of Visual D has just been uploaded. Major changes are
* improved Visual C++ project integration: better dependencies,
automatic libraries, name demangling
* new project wizard
* mago debugger: show vtable, dynamic type of
1 - 100 of 310 matches
Mail list logo