Some advice on a couple of points.

I have been working on a module that works on either dchar / dstrings or wchar / wstrings with just two changes of alias definitions and a recompile.

What I really want to do though is provide one single templated function with the kind of characters / strings as a parameter. I want to have something like
T Transform( T )( T str)
called as
auto result = Transform!(dstring)( dstring str );

I only want to have one type as a parameter and derive other types from that: xstrings from xchars and I’ll need types of xchar arrays that are mutable and immutable.

I’m quite confused as to how to proceed. This is quite a large module ~ 2k loc, and I don’t really want to go through and change every private function into a templated one. Should I just make the whole thing into a giant template containing many functions?
  • Giant template - changing typ... Cecil Ward via Digitalmars-d-learn

Reply via email to