www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9192] New: Allow opEquals for .tupleof expressions

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9192

           Summary: Allow opEquals for .tupleof expressions
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com



07:02:39 PST ---
struct S
{
    this(S rhs)
    {
        this.tupleof = rhs.tupleof;
    }

    bool opEquals(const ref S rhs) const
    {
        return this.tupleof == rhs.tupleof;
    }

    int x;
}

void main()
{
    S s1, s2;
    assert(s1 == s2);
}

test.d(12): Error: incompatible types for ((tuple(this.x)) == (tuple(rhs.x))):
'(const(int))' and '(const(int))'

Since we're allowed to assign to a .tupleof, why not allow comparisons? For one
use-case this would make it easy to implement a workaround until Issue 3789 is
fixed.

Although only the == and != should probably be implemented, < and > don't make
much sense.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 21 2012
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9192


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE



*** This issue has been marked as a duplicate of issue 9873 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 04 2013