[Issue 4174] Template interface functions not allowed,	making operator overloads difficult
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Mon May 10 14:41:26 PDT 2010
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=4174
Steven Schveighoffer <schveiguy at yahoo.com> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Template interface          |Template interface
                   |functions not allowed       |functions not allowed,
                   |                            |making operator overloads
                   |                            |difficult
--- Comment #1 from Steven Schveighoffer <schveiguy at yahoo.com> 2010-05-10 14:41:26 PDT ---
Sorry, enter key added the issue when I was typing the summary.
Operator overloads require template functions, yet this doesn't work:
interface I
{
   I addAssign(I other);
   I opOpAssign(string op)(I other) if (op == "+=")
   {
      return this.addAssign(other);
   }
}
void foo(I i)
{
   i += i;
}
error message:
testinterface.d(4): Error: function
testinterface.I.opOpAssign!("+=").opOpAssign template member functions are not
allowed in interface I
testinterface.d(12): Error: template instance testinterface.I.opOpAssign!("+=")
error instantiating
How shall I implement operators for interfaces?
-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
    
    
More information about the Digitalmars-d-bugs
mailing list