Giant template - changing types everywhere
    Steven Schveighoffer 
    schveiguy at gmail.com
       
    Fri Jul 14 01:34:54 UTC 2023
    
    
  
On 7/13/23 8:08 PM, Cecil Ward wrote:
> 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 );
```d
T[] Transform(T)(T[] str)
```
Note that you don't have to specify the type when calling:
```d
Transform(someDstring); // infers dchar
```
> 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?
If you have more questions, please ask. Some examples of how making a 
template would be painful would be helpful.
-Steve
    
    
More information about the Digitalmars-d-learn
mailing list