How can I achieve something like the following? I want to create
a class B that has all the interfaces of the class passed as a
template parameter.
import std.trats;
interface I0 {}
interface I1 {}
class A : I0, I1 {}
class B!C : InterfacesTuple!C {}
void main() {
B!A a;
}
On Wednesday, 25 December 2013 at 07:45:37 UTC, Øivind wrote:
How can I achieve something like the following? I want to
create a class B that has all the interfaces of the class
passed as a template parameter.
import std.trats;
interface I0 {}
interface I1 {}
class A : I0, I1 {}
class B!C
On Wednesday, 25 December 2013 at 07:45:37 UTC, Øivind wrote:
class B!C : InterfacesTuple!C {}
You probably meant:
class B(C) : InterfacesTuple!C {}
On Wednesday, December 25, 2013, quot;Casper Færgemand\quot;
lt;shortt...@hotmail.comgt;quot;@puremagic.com wrote:
Never mind, found it. I searched for parameters and found it in
http://dlang.org/declaration.html#DeclaratorSuffix
Thanks. :3
I had a lot of problems with function declarations
On Wednesday, 25 December 2013 at 07:49:35 UTC, Jakob Ovrum wrote:
On Wednesday, 25 December 2013 at 07:45:37 UTC, Øivind wrote:
class B!C : InterfacesTuple!C {}
You probably meant:
class B(C) : InterfacesTuple!C {}
Yes, stupid typo. Thanks for the quick answer. Awesome that this
works :)
On Tuesday, 24 December 2013 at 16:11:15 UTC, Ali Çehreli wrote:
On 12/24/2013 04:13 AM, Lemonfiend wrote:
std.file.rmdirRecurse refuses to remove readonly files.
How would I go about deleting them anyway?
Call std.file.setAttributes() first, which has apparently been
added just three days
Hello,
I am studying the difference between x86 generated code of DMD
and C/C++ compilers on Windows (simply put: why exactly, and by
what margin, DMD-compiled D code is often slower than
GCC-compiled C/C++ equivalent).
Now, I have this simple D program:
-
immutable int MAX_N =
On Wednesday, 25 December 2013 at 12:03:08 UTC, Ivan Kazmenko
wrote:
Now, I am not exactly fluent in assembler, but the mov ECX,
EDX seems unnecessary. The ECX register is explicitly used
three times in the whole program, and it looks like this
instruction can at least be moved out of the
On Wednesday, 25 December 2013 at 12:43:05 UTC, Chris Cain wrote:
Did you try something like:
for(immutable i; 0..MAX_N)
a[i] = i;
too? One thing to note is that, technically, i is a _copy_ of
the iterated number. So things like
for(i; 0..5)
i++;
have no effect (it will loop 5 times
On Wednesday, 25 December 2013 at 08:34:27 UTC, Philippe Sigaud
wrote:
On Wednesday, December 25, 2013, quot;Casper
Færgemand\quot;
lt;shortt...@hotmail.comgt;quot;@puremagic.com wrote:
Never mind, found it. I searched for parameters and found it in
You could also do some neat stuff with opDispatch. Someone
actually
wrote an article about using it with roman numerals:
http://idorobots.org/2012/03/04/romans-rubies-and-the-d/
The idea is actually brilliant. :)
I think I may use it in the future when I need to deal with roman numbers.
--
On Tuesday, 24 December 2013 at 14:39:16 UTC, Timon Gehr wrote:
On 12/24/2013 12:36 PM, Dfr wrote:
Let's say i have array of kind:
auto a = [[1,FF], [2, 00FF00], ...];
Is there simple way to turn it into associative array of kind:
string[string] b = [1: FF, 2: 00FF00, ...];
void
Dfr:
This example looks cleanest, but not compile with error:
Error: no property 'assocArray' for type 'MapResult!(__lambda9,
immutable(char[][])[])'
It compiles for me.
Bye,
bearophile
Ivan Kazmenko:
I am studying the difference between x86 generated code of DMD
and C/C++ compilers on Windows (simply put: why exactly, and by
what margin, DMD-compiled D code is often slower than
GCC-compiled C/C++ equivalent).
Now, I have this simple D program:
-
immutable int MAX_N =
On 12/25/13 15:07, Dejan Lekic wrote:
You could also do some neat stuff with opDispatch. Someone
actually
wrote an article about using it with roman numerals:
http://idorobots.org/2012/03/04/romans-rubies-and-the-d/
The idea is actually brilliant. :)
I think I may use it in the future
On Wednesday, 25 December 2013 at 14:44:57 UTC, bearophile wrote:
Dfr:
This example looks cleanest, but not compile with error:
Error: no property 'assocArray' for type
'MapResult!(__lambda9, immutable(char[][])[])'
It compiles for me.
Bye,
bearophile
Sorry, just forgot to import
From http://dlang.org/declaration.html#Parameter
Parameter:
InOutopt BasicType Declarator
InOutopt BasicType Declarator ...
InOutopt BasicType Declarator = DefaultInitializerExpression
InOutopt Type
InOutopt Type ...
How do I add a declarator to a parameter like char *
On Saturday, 21 December 2013 at 19:20:44 UTC, Martin Nowak wrote:
Rebuild autoconf and automake files?
Try ./bootstrap.sh ./configure make.
That's what actually breaks it. I was messing around on another
box where Thrift compiled just fine and found my configure script
was not calling
Hello, following code:
import std.algorithm : joiner;
string joined = joiner([hello, world], );
Results in:
Error: cannot implicitly convert expression (joiner(...)) of type
Result to string
Any idea how to make this work ?
On Wed, Dec 25, 2013 at 06:21:17PM +, Dfr wrote:
Hello, following code:
import std.algorithm : joiner;
string joined = joiner([hello, world], );
Results in:
Error: cannot implicitly convert expression (joiner(...)) of type
Result to string
Any idea how to make this work ?
On Wednesday, 25 December 2013 at 18:41:47 UTC, H. S. Teoh wrote:
import std.array : array;
import std.algorithm : joiner;
string joined = joiner([hello, world], ).array;
T
Ha!
Error: cannot implicitly convert expression
(array(joiner([hello, world], ))) of type
On Wed, Dec 25, 2013 at 4:57 PM, Casper Færgemand\
shortt...@hotmail.com@puremagic.com wrote:
From http://dlang.org/declaration.html#Parameter
Parameter:
InOutopt BasicType Declarator
InOutopt BasicType Declarator ...
InOutopt BasicType Declarator = DefaultInitializerExpression
On 12/25/2013 04:57 PM, Casper Færgemand shortt...@hotmail.com wrote:
From http://dlang.org/declaration.html#Parameter
Parameter:
InOutopt BasicType Declarator
InOutopt BasicType Declarator ...
InOutopt BasicType Declarator = DefaultInitializerExpression
InOutopt Type
On Wednesday, 25 December 2013 at 21:23:23 UTC, Philippe Sigaud
wrote:
I'll consider that as a D grammar question, and not a
Pegged-specific
question, since Pegged just uses a copy of the D site grammar
:-)
Thank you regardless. I'll be sure to submit some issues once
we're a bit further down
Perhaps should have written and/or in the subject line since the two
are not mutually exclusive.
I was showing off D to friends the other day:
import std.stdio;
void main()
{
foreach (d; 你好)
writeln(d);
}
IIRC, this used to work fine, with the variable d getting deduced as
dchar and
On 12/2/12, 21:25, js.mdnq wrote:
I'm not just comparing them but using them as a unique ID for the
objects in an algorithm to prevent computing over the same object more
than once.
o.toHash() ??
(Which incidentally just casts the reference to a hash_t, exactly what
you want to do.)
Lionello Lunesu:
I could have sworn this used to work. Is my memory failing me,
or was this a deliberate change at some point? Perhaps a
regression?
It's not a regression, it's a locked-in design mistake. Write it
like this and try again:
foreach (dchar d; 你好)
Bye,
bearophile
On 12/26/13, 11:58, bearophile wrote:
Lionello Lunesu:
I could have sworn this used to work. Is my memory failing me, or was
this a deliberate change at some point? Perhaps a regression?
It's not a regression, it's a locked-in design mistake. Write it like
this and try again:
foreach (dchar
On Wednesday, 25 December 2013 at 14:51:11 UTC, bearophile wrote:
ldc2 optimizes the useless loop away:
__Dmain:
xorl%eax, %eax
ret
If I modify the code returning some value from the int main:
return a[7];
ldc2 gives the loop code:
LBB0_1:
movl%eax,
Hello, this example:
import std.array;
import std.algorithm;
import std.typecons;
auto a = [[test, 1]];
auto b = a.map!(x=tuple(x[1],x[0])).assocArray;
Gives me
Error: static variable a cannot be read at compile time
When add const:
const auto a = [[test, 1]];
const auto b =
I'm newbie for D.
I have tried build with custom library but the build is failed.
ubuntu@9ffb916910cd:~/dshttpd$ dub
Building configuration application, build type debug
Compiling...
Error: conflicting Ddoc and obj generation options
Error: DMD compile run failed with exit code 1
What's means
31 matches
Mail list logo