Why typedef's shouldn't have been removed :(

Michel Fortin michel.fortin at michelf.com
Sun May 6 04:41:05 PDT 2012


On 2012-05-05 18:20:44 +0000, "Mehrdad" <wfunction at hotmail.com> said:

> How do you fix it for size_t and uint, etc.?

I'm not sure what problem you're seeing. You can do the same with any type.

	struct PineappleSize { size_t size; }

If you need operators to work, define them. If you need the new type to 
be a specialization, just use alias this. Something simple:

	struct PineappleSize
	{
		size_t size;

		alias size this;

		PineappleSize opBinary(string op)(PineappleSize other)
		{
			mixin("return size "~op~" other.size");
		}
	}


-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/



More information about the Digitalmars-d mailing list