The review of std.hash package

Jacob Carlborg doob at me.com
Thu Aug 9 07:21:23 PDT 2012


On 2012-08-09 15:02, Johannes Pfau wrote:

> What annoys me is that as long the function only supported arrays, it
> didn't need templates _at all_. So template bloat for arrays = 0. But
> adding range support means the version dealing with arrays now has to
> be a template as well(which is probably a bug, can't overload template
> and non template function) and will produce extra code for every array
> type. I just think adding range support shouldn't cause the array code
> to change in any way.

A workaround is to make the non-template function to a template, with no 
arguments. This should only cause one instantiation:

void foo (T) (T t) if (/* some constraint making it not match "int" */);
void foo () (int x);

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list