How to pass list of strings as compile-time parameters?
H. S. Teoh
hsteoh at quickfur.ath.cx
Tue Apr 24 10:50:38 PDT 2012
On Tue, Apr 24, 2012 at 10:47:53AM -0700, H. S. Teoh wrote:
> On Tue, Apr 24, 2012 at 07:39:42PM +0200, Trass3r wrote:
> > > bool compareByMemb(string[] ignores, T)(T obj1, T obj2) {
> > > foreach (name; __traits(getAllMembers, T)) {
> > > ...
> > > }
> >
> > In this particular case you could try
> >
> > foo(T, U...)(T obj1, T obj2, U ignores)
>
> Sure, but U always string. Though I suppose I *could* use a signature
> constraint to enforce that...
[...]
Well actually, U is a type tuple... but I want to constrain it to be
always a tuple of strings. How would that work?
T
--
It is widely believed that reinventing the wheel is a waste of time; but I disagree: without wheel reinventers, we would be still be stuck with wooden horse-cart wheels.
More information about the Digitalmars-d-learn
mailing list