On Tuesday, August 07, 2012 15:40:18 Tobias Pankrath wrote:
> Hey,
>
> let's say I have a simple struct and I want to give it an
> opEquals like this.
>
> struct Point
> {
> int x, y;
> bool opEquals(R)(R rhs) { return x == rhs.x && y == rhs.y; }
> }
>
>
> With this I can't call opEquals on con
On Tuesday, 7 August 2012 at 16:46:04 UTC, Ali Çehreli wrote:
On 08/07/2012 06:40 AM, Tobias Pankrath wrote:
> bool opEquals(R)(R rhs) { return x == rhs.x && y == rhs.y; }
> bool opEquals(R)(R rhs) const { return x == rhs.x && y ==
rhs.y; }
I strongly recommend that only the const version shoul
On 08/07/2012 06:40 AM, Tobias Pankrath wrote:
> bool opEquals(R)(R rhs) { return x == rhs.x && y == rhs.y; }
> bool opEquals(R)(R rhs) const { return x == rhs.x && y == rhs.y; }
I strongly recommend that only the const version should be defined. That
would work on both mutable and immutable ob
Really? It compiles: http://dpaste.dzfl.pl/e0470f9a
Hey,
let's say I have a simple struct and I want to give it an
opEquals like this.
struct Point
{
int x, y;
bool opEquals(R)(R rhs) { return x == rhs.x && y == rhs.y; }
}
With this I can't call opEquals on const instances of Point,
because dmd says
bug.d(13): Error: function bug.P
On Fri, 23 Sep 2011 23:44:41 +0300, Jonathan M Davis
wrote:
It uses the const version if the struct or class is const. And in
neither case
in your program is it const. It's mutable in both, so the mutable
overload is
the one that gets called in both places. Why would the const version get
On Fri, 23 Sep 2011 23:44:52 +0300, Steven Schveighoffer
wrote:
steves@steve-laptop:~/testd$ cat testconst.cpp
#include
using namespace std;
struct S {
S& fun() {
cout << "fun" << endl;
return *this;
}
S fun() const {
cout << "fun const" << endl;
On Fri, 23 Sep 2011 16:35:59 -0400, so wrote:
On Fri, 23 Sep 2011 23:27:02 +0300, Jonathan M Davis
wrote:
On Friday, September 23, 2011 23:19:15 so wrote:
Hello everyone.
I asked this a few times with no response.
Could anyone explain me what is the rational behind this?
Why it won't dis
On Fri, 23 Sep 2011 16:27:23 -0400, Steven Schveighoffer
wrote:
On Fri, 23 Sep 2011 16:19:15 -0400, so wrote:
Hello everyone.
I asked this a few times with no response.
Could anyone explain me what is the rational behind this?
Why it won't distinguish mutable overload from immutable as in
On Friday, September 23, 2011 23:35:59 so wrote:
> On Fri, 23 Sep 2011 23:27:02 +0300, Jonathan M Davis
>
> wrote:
> > On Friday, September 23, 2011 23:19:15 so wrote:
> >> Hello everyone.
> >>
> >> I asked this a few times with no response.
> >> Could anyone explain me what is the rational behi
On Fri, 23 Sep 2011 23:27:02 +0300, Jonathan M Davis
wrote:
On Friday, September 23, 2011 23:19:15 so wrote:
Hello everyone.
I asked this a few times with no response.
Could anyone explain me what is the rational behind this?
Why it won't distinguish mutable overload from immutable as in C+
On Fri, 23 Sep 2011 16:19:15 -0400, so wrote:
Hello everyone.
I asked this a few times with no response.
Could anyone explain me what is the rational behind this?
Why it won't distinguish mutable overload from immutable as in C++?
example? I'm afraid I don't really understand the question.
On Friday, September 23, 2011 23:19:15 so wrote:
> Hello everyone.
>
> I asked this a few times with no response.
> Could anyone explain me what is the rational behind this?
> Why it won't distinguish mutable overload from immutable as in C++?
That compiles fine with the lastest dmd from git. Is
Hello everyone.
I asked this a few times with no response.
Could anyone explain me what is the rational behind this?
Why it won't distinguish mutable overload from immutable as in C++?
test2.d
Description: Binary data
14 matches
Mail list logo