On Tuesday, 7 May 2019 at 13:46:55 UTC, Devin wrote:
[snip]
I'm wrapping around OpenGL, which uses a int and uint for
numerous types, so I decided to make a mixin template for making
a sort of strict alias type. Importantly, they aren't assignable
to each other, unlike Typedef.
Here's the
On Monday, 6 May 2019 at 14:41:31 UTC, Adam D. Ruppe wrote:
struct ID {
private uint handle_;
@property uint handle() { return handle_; }
alias handle this; // now aliased to a property getter
// so it won't allow modification through that/
}
This seems like a good solution! I was
Recently, I poorly refactored some code, which introduced an
obvious bug. But to my astonishment, the broken code compiled
without any warnings or notifications. A minimum example is
shown below:
alias ID = uint;
struct Data
{
ID id;
this(ID id)
{
this