I have this class: http://dpaste.dzfl.pl/95990b4e
and would like that this call Vector2s vec = Vector2s(42, 23);
returns a new object and that this call vec(44, 26) set the x
and y coords from the existing object to 44 and 26.
Is that possible?
I try to check if the object is initialize with
std.range already publicly import std.array.
Oh, good to known.
Not to mention, if you're using ranges heavily, it's not all
that uncommon to
not actually need std.array.array very often. In general, if
you're constantly
converting ranges to arrays, then I'd argue that you're doing
On Saturday, June 30, 2012 11:06:06 Namespace wrote:
But a Range don't match any function that accept arrays. Or
should i prefer to use Ranges instead of arrays?
In general, functions should take ranges, not arrays. They're far more flexible
that way. Requiring an array is generally overly
I've tried different things and that here indeed compiles, but
does not work as it should/I want.
typeof(this) opCall(U, V)(U x, V y) if (__traits(compiles, {
this.x = 5; })) {
writeln(unstatic opCall);
this.Set(x, y);
return this;
}
static Vector2D!(T) opCall(U,
On 2012-06-30 10:56, Namespace wrote:
I have this class: http://dpaste.dzfl.pl/95990b4e
and would like that this call Vector2s vec = Vector2s(42, 23); returns
a new object and that this call vec(44, 26) set the x and y coords
from the existing object to 44 and 26.
Is that possible?
I try to
Namespace:
Or should i prefer to use Ranges instead of arrays?
There is no short answer to this question. Arrays and lazy ranges
have different qualities, so they are better for different
situations. Arrays use more memory, but in some situations they
are faster. Lazy ranges can be a
I know multidimensional arrays has been brought up many times,
although I was not able to find a clear answer to my question. My
knowledge of what's going on behind the curtains is somewhat
lacking, please correct me if my assumptions are incorrect.
Creating a dynamic multidimensional array
On Saturday, June 30, 2012 20:21:57 Vidar Wahlberg wrote:
I know multidimensional arrays has been brought up many times,
although I was not able to find a clear answer to my question. My
knowledge of what's going on behind the curtains is somewhat
lacking, please correct me if my assumptions
On Saturday, 30 June 2012 at 18:32:09 UTC, Jonathan M Davis wrote:
In D, static arrays are always fixed in size, and that size
must be known at
compile time, whereas dynamic arrays are never fixed in size
(unless they're
immutable), and the size doesn't need to be known at compile
time. There
On Saturday, June 30, 2012 21:01:02 Vidar Wahlberg wrote:
On Saturday, 30 June 2012 at 18:32:09 UTC, Jonathan M Davis wrote:
In D, static arrays are always fixed in size, and that size
must be known at
compile time, whereas dynamic arrays are never fixed in size
(unless they're
On Saturday, 30 June 2012 at 19:06:31 UTC, Jonathan M Davis wrote:
On Saturday, June 30, 2012 21:01:02 Vidar Wahlberg wrote:
This is a very good suggestion, I hadn't thought of this
possibility, this way I can get my beloved matrix[x][y];
instead of something like matrix.get(x, y);.
It might
On Saturday, June 30, 2012 21:27:15 Vidar Wahlberg wrote:
On Saturday, 30 June 2012 at 19:06:31 UTC, Jonathan M Davis wrote:
On Saturday, June 30, 2012 21:01:02 Vidar Wahlberg wrote:
This is a very good suggestion, I hadn't thought of this
possibility, this way I can get my beloved
30.06.2012 22:21, Vidar Wahlberg пишет:
I know multidimensional arrays has been brought up many times, although
I was not able to find a clear answer to my question. My knowledge of
what's going on behind the curtains is somewhat lacking, please correct
me if my assumptions are incorrect.
On Saturday, 30 June 2012 at 19:35:33 UTC, Denis Shelomovskij
wrote:
You could be interested in my answer on this thread:
http://forum.dlang.org/thread/mailman.1578.1339962782.24740.digitalmars-d-le...@puremagic.com
Thanks for the tip, that is interesting (I'm surprised I didn't
come across
On Saturday, 30 June 2012 at 20:06:58 UTC, Vidar Wahlberg wrote:
On Saturday, 30 June 2012 at 19:35:33 UTC, Denis Shelomovskij
wrote:
You could be interested in my answer on this thread:
http://forum.dlang.org/thread/mailman.1578.1339962782.24740.digitalmars-d-le...@puremagic.com
Thanks for
Hi guys,
I know... there's a lib for curl but I'm using an old CURL-binding for D...
I've the following problem: I'm sending my login data to
a web page and I want store the response of curl_easy_perform() in a string. So
I'm using the following few lines to do that:
string temp;
size_t
On Saturday, June 30, 2012 21:49:51 Nrgyzer wrote:
Hi guys,
I know... there's a lib for curl but I'm using an old CURL-binding for D...
I've the following problem: I'm sending my login data to a web page and I
want store the response of curl_easy_perform() in a string. So I'm using
the
On Sat, 30 Jun 2012 23:49:51 +0200, Nrgyzer nrgy...@gmail.com wrote:
Hi guys,
I know... there's a lib for curl but I'm using an old CURL-binding for
D... I've the following problem: I'm sending my login data to
a web page and I want store the response of curl_easy_perform() in a
string. So
Simple question. How to I get a function pointer to one of the foo
functions in this case :
void foo(int i);
void foo(long i);
Three related questions, about three possible Phobos little
enhancement requests.
This curious code compiles and sorts in reverse the arrays a and
b according to the a,b pairs:
import std.stdio, std.algorithm, std.range;
void main() {
auto a = [10, 20, 30];
auto b = [c, b, a];
import std.stdio;
alias void function(int) fooInt;
alias void function(long) fooLong;
int main(string[] args)
{
fooInt f1 = foo;
fooLong f2 = foo;
f1(1L);
f2(1L);
return 0;
}
void foo(int i)
{
writeln(foo(int i));
}
void foo(long i)
{
writeln(foo(long i));
}
21 matches
Mail list logo