On Fri, 18 Feb 2011 02:02:51 +, Sean Eskapp wrote:
If I have
class Bar(T)
{
}
void foo(Y)()
{
...
}
Is there a way to check inside foo() that Y is in some way an
instantiation of Bar? Is there a way to find WHICH instantiation it is?
void foo(Y)()
{
static if (is(Y Z
tsukikage wrote:
Please see source in attachment.
The output is
M2 M3 M5 M7 M13 M17 M19 M31 M61 M89 M107 M127 M521 M607 M1279 M2203
M2281 M3217 M4253 M4423
*** M9689***
M9941 M11213 M19937
*** M21701***
M23209
It missed 2 Mersenne Primes 9689 21701.
Is it my program bug or bigint broken?
== Quote from Lars T. Kyllingstad (public@kyllingen.NOSPAMnet)'s article
On Fri, 18 Feb 2011 02:02:51 +, Sean Eskapp wrote:
If I have
class Bar(T)
{
}
void foo(Y)()
{
...
}
Is there a way to check inside foo() that Y is in some way an
instantiation of Bar? Is
This is a RosettaCode simple task:
http://rosettacode.org/wiki/Sort_disjoint_sublist#D
Given a list of values and a set of integer indices into that value list, sort
the values at the given indices, but preserving the values at indices outside
the set of those to be sorted.
Example input:
On Fri, 18 Feb 2011 08:08:22 -0500, bearophile bearophileh...@lycos.com
wrote:
This is a RosettaCode simple task:
http://rosettacode.org/wiki/Sort_disjoint_sublist#D
Given a list of values and a set of integer indices into that value
list, sort the values at the given indices, but
I can't seem to use std.datetime at all. I get undefined reference on whether
I use a StopWatch, or if I just try to compile the unittest. All I have to do
is declare a StopWatch:
import std.stdio;
import std.datetime;
void main()
{
StopWatch sw;
}
This fails to compile:
[kai@worky ~]$ dmd
I was given this code, to check if Y is a specialization of Bar. How does it
work?
class Bar(T)
{
}
void foo(Y)()
{
static if (is(Y Z == Bar!Z))
{
// Here, Z is now an alias to whichever type Bar is
// instantiated with.
}
else
{
// Z is invalid here.
On 13/02/2011 21:34, Sean Eskapp wrote:
Is there a way to specify that a function is nonvirtual, but can still be
overriden in base classes? e.g.
Then you're not overriding at all. You're just declaring a function in the derived class
that happens to have the same name.
As such, it seems
On Fri, 18 Feb 2011 16:38:19 +, Kai Meyer wrote:
I can't seem to use std.datetime at all. I get undefined reference on
whether I use a StopWatch, or if I just try to compile the unittest. All
I have to do is declare a StopWatch:
import std.stdio;
import std.datetime;
void main()
{
On Fri, 18 Feb 2011 17:16:02 +, Sean Eskapp wrote:
I was given this code, to check if Y is a specialization of Bar. How
does it work?
class Bar(T)
{
}
void foo(Y)()
{
static if (is(Y Z == Bar!Z))
{
// Here, Z is now an alias to whichever type Bar is //
Great news! Worked like a champ. Is there documentation somewhere that I
missed? I
would love to be able to answer these questions on my own. I've been stumped on
this one for a week :(
On Friday, February 18, 2011 10:12:09 Kai Meyer wrote:
Great news! Worked like a champ. Is there documentation somewhere that I
missed? I would love to be able to answer these questions on my own. I've
been stumped on this one for a week :(
That should be in the dmd.conf in dmd.2.052.zip. If
Stewart Gordon:
Then you're not overriding at all. You're just declaring a function in the
derived class
that happens to have the same name.
I think Sean refers to the second usage of new in C#:
http://msdn.microsoft.com/en-us/library/51y09td4%28v=vs.71%29.aspx
Bye,
bearophile
On Fri, 18 Feb 2011 10:23:41 -0800, Jonathan M Davis wrote:
On Friday, February 18, 2011 10:12:09 Kai Meyer wrote:
Great news! Worked like a champ. Is there documentation somewhere that
I missed? I would love to be able to answer these questions on my own.
I've been stumped on this one for a
On Friday, February 18, 2011 11:43:22 Lars T. Kyllingstad wrote:
On Fri, 18 Feb 2011 10:23:41 -0800, Jonathan M Davis wrote:
On Friday, February 18, 2011 10:12:09 Kai Meyer wrote:
Great news! Worked like a champ. Is there documentation somewhere that
I missed? I would love to be able to
On 2011-02-17 22:19, HansR wrote:
I followed the directions on http://www.digitalmars.com/d/2.0/dmd-osx.html for
the hello.d example and I kept getting an error about __stack_chk_guard.
Seems odd. What version of the D compiler are you using and what version
of Mac OS X?
--
/Jacob Carlborg
== Quote from Jonathan M Davis (jmdavisp...@gmx.com)'s article
On Friday, February 18, 2011 10:12:09 Kai Meyer wrote:
Great news! Worked like a champ. Is there documentation somewhere that I
missed? I would love to be able to answer these questions on my own. I've
been stumped on this one
== Quote from Lars T. Kyllingstad (public@kyllingen.NOSPAMnet)'s article
On Fri, 18 Feb 2011 17:16:02 +, Sean Eskapp wrote:
I was given this code, to check if Y is a specialization of Bar. How
does it work?
class Bar(T)
{
}
void foo(Y)()
{
static if (is(Y Z == Bar!Z))
Is there a way to run a template at compile time, without using a member?
What I'm trying to do is verify that every element of a tuple is a class type,
and so far, I've been doing this:
template VerifyTuple(Type, Types...)
{
static assert(is(Type : Object), Type.stringof ~ is not a
On Fri, 18 Feb 2011 16:15:16 -0500, Sean Eskapp eatingstap...@gmail.com
wrote:
Is there a way to run a template at compile time, without using a
member?
What I'm trying to do is verify that every element of a tuple is a class
type,
and so far, I've been doing this:
template
Sean Eskapp:
What I'm trying to do is verify that every element of a tuple is a class type,
If you mean a TypeTuple, this is a solution:
import std.typetuple: allSatisfy, TypeTuple;
template IsClass(T) {
enum IsClass = is(T == class);
}
class Foo {}
class Bar {}
struct Spam {}
alias
On Friday, February 18, 2011 12:29:40 Kai Meyer wrote:
== Quote from Jonathan M Davis (jmdavisp...@gmx.com)'s article
On Friday, February 18, 2011 10:12:09 Kai Meyer wrote:
Great news! Worked like a champ. Is there documentation somewhere that
I missed? I would love to be able to answer
Can anyone explain to me why this throws:
class Foo() { }
void main()
{
static if (is(Foo == class))
{
}
else
{
static assert(0);
}
}
On Fri, 18 Feb 2011 20:37:38 +, Sean Eskapp wrote:
== Quote from Lars T. Kyllingstad (public@kyllingen.NOSPAMnet)'s article
On Fri, 18 Feb 2011 17:16:02 +, Sean Eskapp wrote:
I was given this code, to check if Y is a specialization of Bar. How
does it work?
class Bar(T)
{
}
bearophile bearophileh...@lycos.com wrote:
I don't know if there is a way to write IsClass() in a shorter way, like
a lambda template.
No such thing, sadly. I have suggested it before, and would love to see
such a feature.
--
Simen
Steven Schveighoffer:
I think opAssign is incorrect.
Silly me :-)
My suggestion would be to create a bidirectional proxy range that uses a
supplemental array to determine where the next/previous element is (i.e.
the index array). Should be pretty simple. Then just pass this to sort.
As noted in my earlier email on the other list, I too got this problem.
Fromn what I can tell 1.066 and 2.051 have dmd.conf files but there is
no such thing in the 1.067 and 2.052 distributions. So the out of the
box configuration does seem to be broken.
That should be in the dmd.conf in
On Sat, 2011-02-19 at 00:27 +, Russel Winder wrote:
As noted in my earlier email on the other list, I too got this problem.
Fromn what I can tell 1.066 and 2.051 have dmd.conf files but there is
no such thing in the 1.067 and 2.052 distributions. So the out of the
box configuration does
Thank you for your answers. Second try, it doesn't work yet, I'm looking for
the problem:
Third try, this seems to work:
import std.stdio, std.array, std.algorithm, std.range;
struct IndirectArray(Tdata, Tindexes) {
Tdata[] data;
Tindexes[] indexes;
bool empty() { return
On Friday, February 18, 2011 16:27:23 Russel Winder wrote:
As noted in my earlier email on the other list, I too got this problem.
Fromn what I can tell 1.066 and 2.051 have dmd.conf files but there is
no such thing in the 1.067 and 2.052 distributions. So the out of the
box configuration
On 13/02/2011 21:49, Nrgyzer wrote:
snip
It compiles and works as long as the returned char-array/string of f.readLine()
doesn't
contain non-UTF8 character(s). If it contains such chars, writeln() doesn't
write
anything to the console. Is there any chance to read such files?
Please post
On 11/02/2011 12:30, Dominic Jones wrote:
snip
Would that not be constructing an associated array? Whilst an associated array
would do the job, there is no value for the key:value pair, just a list of
keys.
In the C++ STL there are the set and map containers. I want something like
set.
Dominic
On 18/02/2011 21:22, Steven Schveighoffer wrote:
snip
template VerifyTuple(Types...)
{
static if(Types.length == 0)
enum bool VerifyTuple = true;
else
enum bool VerifyTuple == is(Type : Object) VerifyTuple!(Types[1..$]);
snip
You have two typos there. Corrected version:
enum bool
I'm using some one else's bindings to a C library.
The problem seems to be limited to D2 programs.
Error as follows:
An exception was thrown while finalizing an instance of class jec2.bmp.Bmp
I also get other errors at program exit.
Thanks for any help. :-)
Joel Christensen Wrote:
I'm using some one else's bindings to a C library.
The problem seems to be limited to D2 programs.
Error as follows:
An exception was thrown while finalizing an instance of class jec2.bmp.Bmp
I also get other errors at program exit.
Thanks for any help. :-)
35 matches
Mail list logo