template isMyInstanceOf(alias Templ, alias Inst)
{
alias Args = ???; //I don't have idea how to get it
enum bool isMyInstanceOf = __traits(isSame, Templ!(Args),
Inst);
}
Do you have any idea how to solve this? May be standad library
could be improved with such type of test for templat
Suddenly posted. I don't know why it's happened))
template isMyInstanceOf(alias Templ, alias Inst)
{
alias Args = ???; //I don't have idea how to get it
enum bool isMyInstanceOf = __traits(isSame, Templ!(Args),
Inst);
}
Do you have any idea how to solve this? May be standad library
c
I have another question about testing if given symbol is instance
of the given template and geting it's template arguments. I'm
talking about raw template symbols, but not struct or class
templates. For case with struct or class template
std.traits.isInstanceOf is working well. But using *raw*
On Saturday, 5 July 2014 at 22:08:52 UTC, bearophile wrote:
Brenton:
How would you recommend I do something like this with D?
In D compile-time constants are introduced using the "enum"
keyword.
You can also use the "-version=..." compiler switch to compile
your D code according to some v
On Saturday, 5 July 2014 at 22:28:48 UTC, Adam D. Ruppe wrote:
In general, remember any class reference in D is already
equivalent to a pointer in C or C++ and can be casted straight
to void* without needing to take its address.
Thanks Adam,
you're a life saver ;). It works like a charme.
On Saturday, 5 July 2014 at 22:18:56 UTC, Marco Cosentino wrote:
auto client = *(cast(ClientImplementation*) data);
Try just
auto client = cast(ClientImplementation) data;
and
this.setProcessCallback(callback, cast(void *) &this);
setProcessCallback(callback, cast(void*) this);
Hi,
I'm quite new to D and I'm not able to find out what I'm doing
wrong.
Consider the following code:
class ClientImplementation {
private ProcessDelegate processDelegate;
void setProcessDelegate(ProcessDelegate deleg) {
this.processDelegate = deleg;
extern(C) ProcessCallback
Brenton:
How would you recommend I do something like this with D?
In D compile-time constants are introduced using the "enum"
keyword.
You can also use the "-version=..." compiler switch to compile
your D code according to some version, that can be a number or
identifier.
In D there isn
Is there a way to define a compile time constant/enum with dmd?
For example, inserting the svn revision number into my code? In
C...
#include
#ifndef SOMETHING
#define SOMETHING "bar"
#endif
int main() {
printf("hello world: " SOMETHING " \n");
return 0;
}
gcc main.c &&
On Tuesday, 24 June 2014 at 12:56:28 UTC, Jason King wrote:
I don't know enough about implib to explain it.
But another method that I believe should work is to use linker
definition files.
It'll allow optlink to work.
Just add it to dmd, actually I believe it needs to be passed
to Optlink (so
On Saturday, 5 July 2014 at 19:31:24 UTC, Marc Schütz wrote:
This is an instance of these bugs:
https://issues.dlang.org/show_bug.cgi?id=5710
https://issues.dlang.org/show_bug.cgi?id=11946
But seeing that `map` works with a single lambda/local
function, it should be possible to make it work wi
On Saturday, 5 July 2014 at 20:23:03 UTC, Joakim wrote:
This seems like inconsistent behavior: should I file a bug?
This is because the operating systems do it differently; I think
D is doing the right thing by being a pretty thin wrapper around
that functionality.
If anything, I'd just say
On Saturday, 5 July 2014 at 16:35:31 UTC, Andre Tampubolon wrote:
I've been reading the newsgroup for a while, and it seems that
one of the reason folks like D is because it supports module.
My question is: what does module mean?
A quick google pointed my this page:
http://dlang.org/module.htm
I ran into this when trying to fix the Phobos unit tests and have
reduced it down to this test file:
import std.stdio, std.file;
void main() {
auto f = File("test.txt", "w");
//f.close();
std.file.remove("test.txt");
}
This compiles and runs fine on linux and the autotester shows
ah, sorry, I misunderstood. It looks like you need to change
the lin
auto sc = new SomeClass ();
to
auto sc = new SomeClass!BaseClass ();
The compiler complains because SomeClass is a template when you
call SomeClass() without !() template parameters. It only
becomes a type once instantiate
On Saturday, 5 July 2014 at 17:08:01 UTC, Olivier Pisano wrote:
No, import is different from include. It does not stupidly copy
and paste its content but tells the compiler to take the module
into account for name resolution. The result may seem similar,
but is much more efficient.
In fact, try
This is an instance of these bugs:
https://issues.dlang.org/show_bug.cgi?id=5710
https://issues.dlang.org/show_bug.cgi?id=11946
But seeing that `map` works with a single lambda/local function,
it should be possible to make it work with several ones too.
For the time being, a simple workaround
On Saturday, 5 July 2014 at 17:17:03 UTC, quakkels wrote:
try SomeClass (T): BaseClass
Not sure which line you want me to change. I don't want
SomeClass to inherit from BaseClass. Rather, I want T to be
restricted to classes that inherit from BaseClass.
When I change `class SomeClass(T : Ba
try SomeClass (T): BaseClass
Not sure which line you want me to change. I don't want SomeClass
to inherit from BaseClass. Rather, I want T to be restricted to
classes that inherit from BaseClass.
When I change `class SomeClass(T : BaseClass)` to `class
SomeClass(T) : BaseClass` I still get
On Saturday, 5 July 2014 at 16:47:32 UTC, quakkels wrote:
I'm going through Adam Wilson's talk 'C# to D' and I've gotten
hung up by one of his examples regarding generic programming in
D. Specifically, I'm trying to implement the code example found
here: http://youtu.be/6_xdfSVRrKo?t=16m44s.
No, import is different from include. It does not stupidly copy
and paste its content but tells the compiler to take the module
into account for name resolution. The result may seem similar,
but is much more efficient.
A D module is also a unit of encapsulation (a private declaration
in a module
When I run the dmd compiler, I get this error:
>dmd templateExp.d
teamplteExp.d(12): Error: class teamplteExp.SomeClass(T :
BaseClass) is used as a type
This is actually:
templateExp.d(12): Error: class templateExp.SomeClass(T :
BaseClass) is used as a type
I'm going through Adam Wilson's talk 'C# to D' and I've gotten
hung up by one of his examples regarding generic programming in
D. Specifically, I'm trying to implement the code example found
here: http://youtu.be/6_xdfSVRrKo?t=16m44s.
I created a templateExp.d file that looks like this:
I've been reading the newsgroup for a while, and it seems that one of
the reason folks like D is because it supports module.
My question is: what does module mean?
A quick google pointed my this page: http://dlang.org/module.html.
Still cannot understand it, though :)
How does it differ from th
void main(){
import std.algorithm, std.stdio;
auto arr = [1,2,3];
arr.map!("a + a", "a * a").writeln; //compiles
arr.map!(a => a + a, a => a * a).writeln; //does not
}
If I define two functions outside main, it works:
void main(){
import std.algorithm, std.
A colleague of mine had asked me if I could produce some kind of
object/module dependency type of graph for a D project I've got.
I'm not sure what these are called but I've seen them before for
inheritance hierarchies in C++ projects. (I don't tend to use
inheritance so I suspect something exa
The reason it worked one time and not the other was because the
other time was an exception, not an assertion. How do I break on
exceptions?
(ps. is there a guide anywhere to using GDB with D?)
Hello Community,
I thought there's a separate forum for VisualD. It did exist when
VisualD was on DSource, so why not add it here as well? Or am I
to blind to see?
Anyway, this thread is an addition to my previous one in this
forum:
http://forum.dlang.org/thread/wkkuvzkzeupyfdpwe...@forum.d
Hello community,
here is a post with multiple questions regarding compile times,
or rather the optimization of the compile and link process. I
work with VisualD and am interested in optimizing my projects
with this utility, hence there will be a similar topic linking
here, where I explain my
On 07/05/2014 12:13 AM, "Nordlöw" wrote:
On Ubuntu 14.04 my git master build script for phobos now fails as below.
Why? Help please.
/usr/bin/ld points to /usr/bin/ld.bfd on my system
Terminal echo and error message follows:
../dmd/src/dmd -I/home/per/opt/x86_64-unknown-linux-gnu/dmd/include/
On Saturday, 5 July 2014 at 09:54:21 UTC, Nordlöw wrote:
On Saturday, 5 July 2014 at 02:13:39 UTC, Kapps wrote:
Possibly something related to:
https://github.com/D-Programming-Language/dmd/pull/3715
Have you tried updating to git master today?
Yes, unfortunately with the same problem (with l
On Saturday, 5 July 2014 at 02:13:39 UTC, Kapps wrote:
Possibly something related to:
https://github.com/D-Programming-Language/dmd/pull/3715
Have you tried updating to git master today?
Yes, unfortunately with the same problem (with ld.bfd).
With ld.gold I get a huge amount of errors:
../d
32 matches
Mail list logo