How to "extend" built-in types

Jonathan M Davis jmdavisProg at gmx.com
Sat Oct 27 03:06:53 PDT 2012


On Saturday, October 27, 2012 11:58:57 simendsjo wrote:
> The thing is that I often doesn't really care about the type,
> only that it exposes certain properties.

Then create a template constraint (or eponymous template to use in a template 
constraint) which tests for those properties. That's exactly what templates 
like isForwardRange and hasLength do for range-based operations. You just need 
the same sort of thing for the set operations that you require.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list