Conditional compilation on availability?

Fredrik Olsson peylow at gmail.com
Sat Jul 8 15:37:58 PDT 2006


Might be an easy one, or a missing feature :).

But how do I do a conditional compilation on the availability of a 
function, variable, type or whatever?

For example:

class foo(T) {
  T[] bar;
   static if ("predicate for toString(T) exists") {
     char[] allBarsConcatinatedAsString() {
       char[] r = ""
       foreach (v; bar) {
	r ~= toString(v);
       }
     }
   }
}

What would I type instead of "predicate for toString(T) exists"?

// Fredrik



More information about the Digitalmars-d-learn mailing list