Wrap + add methods?

Paul Backus snarwin at gmail.com
Mon Jun 28 15:53:25 UTC 2021


On Monday, 28 June 2021 at 15:17:34 UTC, Steven Schveighoffer 
wrote:
> I have a situation where I want to wrap a certain type to add a 
> few methods to that type.
>
> UFCS is not an option, because the library that will use this 
> type will not import the UFCS methods.
>
> `std.typecons.Proxy` doesn't seem to wrap static methods, and 
> besides, I want to return wrappers if the function being 
> wrapped returns the same type (this is critical for stuff like 
> `auto result = a + b`, I want the result to be the same wrapped 
> type).
>
> Are there any libraries that might do this (including Phobos)?

https://code.dlang.org/packages/addle

Doesn't do everything you're looking for, but you might find some 
useful tricks in the source.


More information about the Digitalmars-d-learn mailing list