Is it possible to override and overload class Object?

Salih Dincer salihdb at hotmail.com
Tue Sep 19 17:37:52 UTC 2023


On Tuesday, 19 September 2023 at 16:47:14 UTC, sighoya wrote:
> Hmm, is not updateing the url anymore, here is what I mean by 
> code

Your suggestion brought this solution to my mind.  It looks 
really delicious, thank you:

```d
void opOpAssign(string op: "+", R)(R rhs)
{
     import std.traits;

     static if(isNumeric!R)
       foreach(i; 0..length) ptr[i] += rhs;
     else
       foreach(i; 0..length) ptr[i] ~= rhs;
}
```
Both structures are not even 60 lines total.  I like this last 
edit:
https://run.dlang.io/is/Ciusqs

SDB at 79


More information about the Digitalmars-d mailing list