Hi Martin,
I'm implementing a generic Vector!(uint d, T) struct (wrapping a T[d] array).
For readability:
alias Vector!(4u,float) float4;
alias Vector!(4u,int) int4;
I'd like to be able to cast a float4 variable explicitly to an int4
(component-wise casting):
auto f4 = float4(1,2,3,4);
Hello,
How would you wrap an AA to allow memorising insertion order, and be able to
use it
for iteration?
* Indeed, one could store keys in a // (ordered) array. But this means
iteration requires a series of lookups by key.
* A slightly better method would be to store hash values, which anyway
Hi Philippe,
thank you very much! I added your isVector!T template as well as the two
aliases.
opCast!NewType is implemented like this:
V opCast(V)() if (isVector!V)
// parameters {d2,T2} of V are checked when instantiating V: d2 = 1
isNumeric!T2
{
V r;
foreach (i; 0 .. (d V.dim ? d
On Mon, Feb 14, 2011 at 13:09, Martin Kinkelin no...@spam.com wrote:
Hi Philippe,
thank you very much!
You're welcome.
I added your isVector!T template as well as the two aliases.
opCast!NewType is implemented like this:
V opCast(V)() if (isVector!V)
// parameters {d2,T2} of V are
On Fri, 11 Feb 2011 17:26:29 -0500, Andrej Mitrovic
andrej.mitrov...@gmail.com wrote:
On 2/11/11, bearophile bearophileh...@lycos.com wrote:
Steven Schveighoffer:
Any code can access any members defined in the current module,
regardless
of access attributes
I am not sure if Walter
On Sat, 12 Feb 2011 12:02:14 -0500, Jonathan M Davis jmdavisp...@gmx.com
wrote:
On Saturday 12 February 2011 08:45:03 d coder wrote:
If you know roughly what to do and want to take a stab at producing a
viable patch to fix the problem, then feel free. If it's solid, it may
get in. I don't
On Sun, 13 Feb 2011 09:33:40 -0500, d coder dlang.co...@gmail.com wrote:
Greetings
I am getting this error when I am instantiating a struct array with a
single element inside another class and only if there is the
destructor for the struct is explicitly defined. Is it a known error?
Here is a
On 02/14/2011 03:12 PM, Steven Schveighoffer wrote:
On Sat, 12 Feb 2011 17:48:56 -0500, Jonathan M Davis jmdavisp...@gmx.com
wrote:
There would be some value to having an attribute which indicated that a function
never returns under any circumstances (likely since it always throws), but that
On Sun, 13 Feb 2011 16:34:04 -0500, Sean Eskapp eatingstap...@gmail.com
wrote:
Is there a way to specify that a function is nonvirtual, but can still be
overriden in base classes? e.g.
class A
{
void foo()
{
writeln(A);
}
}
class B : A
{
void foo()
{
12.02.2011 18:44, d coder пишет:
Also tango (for D 1.0) implements it.
Link:
http://www.dsource.org/projects/tango/docs/current/tango.core.WeakRef.html
Might be worth a look if you are going to implement it for D 2.0.
I looked at the D1 implementation. It depends on GC methods
On Sun, 13 Feb 2011 09:29:14 -0500, Lutger Blijdestijn
lutger.blijdest...@gmail.com wrote:
Dominic Jones wrote:
Hello,
I have a list of strings and I want to determine whether or not a
particular string in the is in that list. Assuming I should store the
list
of strings in a binary tree
On Fri, 11 Feb 2011 17:08:26 -0500, Tomek Sowiński j...@ask.me wrote:
Steven Schveighoffer napisał:
It would be much easier if he provided the specific case(s) which
broke
his teeth. Then we'll all know where's the problem. If it's soluble,
it'll open the door to tail type modifiers in
14.02.2011 18:06, Charles McAnany пишет:
Hi, all. So I'm new to this whole contract thing. (I'm coming from C and Java.)
I got the impression that using foo(out arg) means that arg is given its
default value, but other than that it's just like ref. So, here's the basic
code I have thus far.
01
On 2/14/11, Steven Schveighoffer schvei...@yahoo.com wrote:
What's wrong with:
class Foo {
private int _x, _y;
this(int x, int y) {
_x = x;
_y = y;
}
int sumXY() {
return _x + _y;
}
}
Nothing! But the OP asked why it's possible to
On Mon, 14 Feb 2011 10:52:41 -0500, Andrej Mitrovic
andrej.mitrov...@gmail.com wrote:
On 2/14/11, Steven Schveighoffer schvei...@yahoo.com wrote:
What's wrong with:
class Foo {
private int _x, _y;
this(int x, int y) {
_x = x;
_y = y;
}
int sumXY() {
On Monday 14 February 2011 06:12:56 Steven Schveighoffer wrote:
On Sat, 12 Feb 2011 17:48:56 -0500, Jonathan M Davis jmdavisp...@gmx.com
wrote:
There would be some value to having an attribute which indicated that a
function
never returns under any circumstances (likely since it always
On 2/14/11, Steven Schveighoffer schvei...@yahoo.com wrote:
In C++ a friend function is able to access all private
data. The most common use of friend functions is for output stream
processors (since the operator is on the stream and not the object being
outputted).
Oh right, these ?
Ugly
On Mon, 14 Feb 2011 11:19:24 -0500, Jonathan M Davis jmdavisp...@gmx.com
wrote:
On Monday 14 February 2011 06:12:56 Steven Schveighoffer wrote:
On Sat, 12 Feb 2011 17:48:56 -0500, Jonathan M Davis
jmdavisp...@gmx.com
wrote:
There would be some value to having an attribute which indicated
On 02/14/2011 05:13 PM, Steven Schveighoffer wrote:
The theory for the private access in a module goes that likely the same author
wrote all the code in that module, so he should understand what the code is
supposed to do and have free access to anything. It seems to work pretty well
in
On 02/14/2011 05:39 PM, Steven Schveighoffer wrote:
On Mon, 14 Feb 2011 11:19:24 -0500, Jonathan M Davis jmdavisp...@gmx.com
wrote:
On Monday 14 February 2011 06:12:56 Steven Schveighoffer wrote:
On Sat, 12 Feb 2011 17:48:56 -0500, Jonathan M Davis jmdavisp...@gmx.com
wrote:
There would be
On 02/14/2011 03:34 PM, Stanislav Blinov wrote:
12.02.2011 18:44, d coder пишет:
Also tango (for D 1.0) implements it.
Link:
http://www.dsource.org/projects/tango/docs/current/tango.core.WeakRef.html
Might be worth a look if you are going to implement it for D 2.0.
I looked at the D1
Did you try without the cast? Since we know that _data components can
be cast to r._data elements, the compiler should take care of that for
you.
Nope, I didn't try that because, for instance, floats shouldn't be
implicitly castable to ints.
You can also use cast(float2) f3 to get rid of the
On Mon, Feb 14, 2011 at 22:09, Martin Kinkelin no...@spam.com wrote:
So from the outside, components are accessed either via indexing or
via x,y,z and w (analog to HLSL/GLSL). I also added some downcasting
shortcuts via properties, e.g.:
auto f4 = float4(1,2,3,4);
auto r = f4.xyz + 2.0; //
On 02/14/2011 03:27 PM, Steven Schveighoffer wrote:
On Mon, 14 Feb 2011 06:31:25 -0500, spir denis.s...@gmail.com wrote:
Hello,
How would you wrap an AA to allow memorising insertion order, and be able to
use it
for iteration?
* Indeed, one could store keys in a // (ordered) array. But this
On Mon, 14 Feb 2011 16:39:24 -0500, spir denis.s...@gmail.com wrote:
On 02/14/2011 03:27 PM, Steven Schveighoffer wrote:
On Mon, 14 Feb 2011 06:31:25 -0500, spir denis.s...@gmail.com wrote:
Hello,
How would you wrap an AA to allow memorising insertion order, and be
able to
use it
for
%u wfunct...@hotmail.com wrote in message
news:ij3la9$t53$1...@digitalmars.com...
The problem is that it _is_ ambiguous what rule to apply. To me, just
because
static arrays and associative arrays happen to have similar _looks_
doesn't make
parsing them context-free -- they're defined
Anyone know what DMD/OPTLINK's default stack size on windows is? Or how to
find out?
Also, I don't suppose there's a way to give a linker flag to DMD that it'll
simply ignore on non-Windows platforms, is there?
---
Not sent from an iPhone.
%u wfunct...@hotmail.com wrote in message
news:ij3la9$t53$1...@digitalmars.com...
Again, just because the AST's _happen_ to _look_ the same for static and
associative arrays, does that mean that this makes D context-free?
Grammar is *just* about how it *looks*, not what it means.
The
Hi all,
Just curious as to the difference in the built-in variable length
array vs. the std.container.Array and fixed length arrays when it
comes to using them in functions that take Ranges.
For instance the following does not compile:
import std.algorithm;
import std.stdio;
import std.range;
import std.stdio, std.algorithm, std.range;
void main()
{
writeln( find([5, 1, 2, 3, 4, 5, 1], 5) );
writeln( find(retro([5, 1, 2, 3, 4, 5, 1]), 5) );
}
Output:
[5, 1, 2, 3, 4, 5, 1]
[5, 4, 3, 2, 1, 5]
The docs for find are:
returns : haystack advanced such that
On Monday 14 February 2011 18:18:39 jam wrote:
Hi all,
Just curious as to the difference in the built-in variable length
array vs. the std.container.Array and fixed length arrays when it
comes to using them in functions that take Ranges.
For instance the following does not compile:
On Monday 14 February 2011 19:35:21 Andrej Mitrovic wrote:
import std.stdio, std.algorithm, std.range;
void main()
{
writeln( find([5, 1, 2, 3, 4, 5, 1], 5) );
writeln( find(retro([5, 1, 2, 3, 4, 5, 1]), 5) );
}
Output:
[5, 1, 2, 3, 4, 5, 1]
[5, 4, 3, 2, 1, 5]
The docs for
On 2/15/11, Jonathan M Davis jmdavisp...@gmx.com wrote:
retro revereses the whole range. What you want is something like
findFromBack.
I don't think that we have any functions like findFromBack though. It's
probably
worth an enhancement request.
std.string had a find and rfind, both of
On Monday 14 February 2011 20:40:02 Andrej Mitrovic wrote:
On 2/15/11, Jonathan M Davis jmdavisp...@gmx.com wrote:
retro revereses the whole range. What you want is something like
findFromBack.
I don't think that we have any functions like findFromBack though. It's
probably
worth an
On 2/15/11, Jonathan M Davis jmdavisp...@gmx.com wrote:
Of _course_ you get a reversed range back. You _reversed the range_. That's
what
retro _does_. If you use it with find, of _course_ you're going to get a
reversed
range back. Complaining about that is like complaining that your range is
On Monday 14 February 2011 21:14:18 Andrej Mitrovic wrote:
On 2/15/11, Jonathan M Davis jmdavisp...@gmx.com wrote:
Of _course_ you get a reversed range back. You _reversed the range_.
That's what
retro _does_. If you use it with find, of _course_ you're going to get a
reversed
range
36 matches
Mail list logo