How to pass list of strings as compile-time parameters?

H. S. Teoh hsteoh at quickfur.ath.cx
Tue Apr 24 10:37:26 PDT 2012


I'm trying to write a template function for doing member-wise
comparisons between two objects, with an optional list of members to
ignore. But I can't seem to figure out the syntax for passing a list of
strings (or an AA of strings) to the function?

I tried this:

	bool compareByMemb(string[] ignores, T)(T obj1, T obj2) {
		foreach (name; __traits(getAllMembers, T)) {
			...
		}
	}

but the compiler complains:

	Error: arithmetic/string type expected for value-parameter, not string[]

What gives?


T

-- 
Recently, our IT department hired a bug-fix engineer. He used to work for Volkswagen.


More information about the Digitalmars-d-learn mailing list