>
>
> Ok, I'll try again. when I was doing it I would get circular referencing
> but maybe I did something wrong...
>
Another possibility is to use `.A`: the (.) prefix means the symbol is
looked in the external scope, not inside the template. So the 2-params A is
found.
template A(T)
{
alias .
On 12/13/2012 07:30 PM, Ali Çehreli wrote:
Parallelism, concurrency, and multi-threading in general are fascinating
topics. I can't claim that I have extensive experience on these topics
but I have written the following two chapters after studying the
std.parallelism and std.concurrency modules:
Parallelism, concurrency, and multi-threading in general are fascinating
topics. I can't claim that I have extensive experience on these topics
but I have written the following two chapters after studying the
std.parallelism and std.concurrency modules:
http://ddili.org/ders/d.en/parallelism
Philippe Sigaud:
template TemplateArity(Type)
{
enum T = Type.stringof;
mixin("alias " ~ T ~ " U;");
static if (is(Type _ == U!Args, Args...))
enum TemplateArity = Args.length;
else
enum TemplateArity = -1;
}
void main()
{
alias Test!(int, double, string) T;
On Thursday, 13 December 2012 at 22:10:40 UTC, Philippe Sigaud
wrote:
On Thu, Dec 13, 2012 at 11:56 AM, js.mdnq
wrote:
I need to get the number of type parameters of a class at
compile time:
class a(T1, T2, ...)
{
static if (a.TypeInfo.NumParameters == 1)
else
On 2012-12-14, 00:19, H. S. Teoh wrote:
I'd like to overload the '*' operator to work with string arguments. Is
it possible? I tried the following, but apparently operator overloading
doesn't work at the package level?
string opBinary(string op)(string repeatMe, int thisManyTimes)
On Thursday, 13 December 2012 at 22:16:00 UTC, Philippe Sigaud
wrote:
yeah, I tried that and got errors, I guess it works now. I
still can't use
the same class name as the alias though because I get a
recursion error.
It's not a huge deal but would be nicer to not have to mangle
the class
names
H. S. Teoh:
but apparently operator overloading doesn't work at the package
level?
In D the overloaded operators need to be defined inside
structs/classes.
Bye,
bearophile
I'd like to overload the '*' operator to work with string arguments. Is
it possible? I tried the following, but apparently operator overloading
doesn't work at the package level?
string opBinary(string op)(string repeatMe, int thisManyTimes)
if (op=="*")
{
Yann:
could someone tell me what the problem(s) with the following
are?
//why does this not compile:
out(g) { assert(g.n == end - start); }
@property uint n();
n() needs to be const:
@property uint n() const;
why does this produce a segmentation fault when executed:
I don't
On Thu, Dec 13, 2012 at 11:56 AM, js.mdnq wrote:
> I need to get the number of type parameters of a class at compile time:
>
>
> class a(T1, T2, ...)
> {
>static if (a.TypeInfo.NumParameters == 1)
>
>else
>
>
> }
>
> Is this possible?
>
Yes, it's possible:
// Insid
I'm trying to parallelize some code which is essentially a network of
cells with an index. I can make the cells immutable, if I route all
access to them via the index, AND if I can update the index. The index
would not need to have items deleted, but updates would cause it to
point to differe
On Friday, December 14, 2012 00:27:39 Dmitry Olshansky wrote:
> 12/13/2012 7:22 AM, Jonathan M Davis пишет:
> > On Wednesday, December 12, 2012 17:34:53 Ali Çehreli wrote:
> >> (There must be an easier way of doing that. :))
> >
> > If you have a string that's really ASCII and you're _sure_ that i
Mu:
Then how can I approach this to work for both cases:
1) output is empty?
2) output is the size of input? (MmFile's)
You have to tell those cases apart with a run time test, so your
output range should support empty, or even length. If you want to
overwrite the already allocated space, t
12/13/2012 7:22 AM, Jonathan M Davis пишет:
On Wednesday, December 12, 2012 17:34:53 Ali Çehreli wrote:
(There must be an easier way of doing that. :))
If you have a string that's really ASCII and you're _sure_ that it's only
ASCII, then I'd suggest simply casting it to immutable(ubyte)[] and
On 12/12/2012 07:22 PM, Jonathan M Davis wrote:
> On Wednesday, December 12, 2012 17:34:53 Ali Çehreli wrote:
>> (There must be an easier way of doing that. :))
>
> If you have a string that's really ASCII and you're _sure_ that it's only
> ASCII, then I'd suggest simply casting it to immutable(ub
foreach (i, ref o; output)
But isn't output empty?
Indeed it is, when output is a new array.
Then how can I approach this to work for both cases:
1) output is empty?
2) output is the size of input? (MmFile's)
Mu:
foreach (i, ref o; output)
But isn't output empty?
Bye,
bearophile
The code below works as is with memory mapped files' casted
opSlice's.
However, I can't figure out how to test it with simple arrays.
Its unittest fails.
Question:
How to implement the function correctly?
Otherwise what is the correct way to test it?
Thank you.
Code:
Range2 c
Hi,
could someone tell me what the problem(s) with the following are?
Also, how do I make "$" work with the slice operator?
Thanks a lot.
interface Graph
{
bool opIndex(uint u, uint v)
in { assert(u < n && v < n); }
Graph opSlice(uint start, uint end)
in { assert(start < n && end <=
On 2012-12-09 11:42, js.mdnq wrote:
How can I create mixes of stringified code and code itself?
http://dlang.org/mixin.html
explains how to create structs using strings. But what if I do not want
to have to encode the whole struct as a string but only parts of it?
mixin template GenStruct(str
On Thursday, 13 December 2012 at 06:26:15 UTC, dennis luehring
wrote:
Am 13.12.2012 04:32, schrieb js.mdnq:
I think the issue I have with all this is that when you put
code
inside a string you lose a lot of compile time features AFAICT.
your right - but...try to come up with an similar ("easy
On Thursday, 13 December 2012 at 10:03:34 UTC, anonymous wrote:
On Thursday, 13 December 2012 at 09:29:46 UTC, js.mdnq wrote:
class _A(T, _NestLevel) { }
alias _A!(T, true) A!(T) // <- does not work but essentially
what I want
template A(T) {
alias _A!(T, true) A;
}
(or even better)
clas
I need to get the number of type parameters of a class at compile
time:
class a(T1, T2, ...)
{
static if (a.TypeInfo.NumParameters == 1)
else
}
Is this possible?
On Thursday, 13 December 2012 at 10:03:34 UTC, anonymous wrote:
On Thursday, 13 December 2012 at 09:29:46 UTC, js.mdnq wrote:
class _A(T, _NestLevel) { }
alias _A!(T, true) A!(T) // <- does not work but essentially
what I want
template A(T) {
alias _A!(T, true) A;
}
(or even better)
clas
On Thursday, 13 December 2012 at 09:29:46 UTC, js.mdnq wrote:
class _A(T, _NestLevel) { }
alias _A!(T, true) A!(T) // <- does not work but essentially
what I want
template A(T) {
alias _A!(T, true) A;
}
(or even better)
class A(T, _NestLevel) { }
alias A!(T, true) A!(T)
class A(T, bool
26 matches
Mail list logo