Compile time opAssign/@property constraints

Basile.B b2.temp at gmx.com
Fri Jan 4 10:34:07 UTC 2019


On Friday, 4 January 2019 at 09:54:25 UTC, Jacob Shtokolov wrote:
> Hi,
>
> I'd like to implement some compile time constraints for a 
> struct (though not sure if that's possible).
>
> I already tried to place "static assert" or any kind of static 
> condition into a body of @property and opAssign(), but every 
> time it shows the error "variable cannot be read at compile 
> time".
>
> Is there any way to catch and validate assignments or struct 
> initialization at compile time?
>
> Thanks,
> Jacob

What you want is definitively possible but you must have made an 
error somewhere.
Show us some code.


More information about the Digitalmars-d-learn mailing list