Giant template - changing types everywhere

Cecil Ward cecil at cecilward.com
Fri Jul 14 05:09:58 UTC 2023


On Friday, 14 July 2023 at 05:05:27 UTC, Cecil Ward wrote:
> On Friday, 14 July 2023 at 05:03:31 UTC, Cecil Ward wrote:
>> On Friday, 14 July 2023 at 01:34:54 UTC, Steven Schveighoffer 
>> wrote:
>>> [...]
>>
>> The way I can see it going is a giant template encompassing 
>> pretty much the whole file. Does that mean that the caller who 
>> calls my one public function does so by passing the type dchar 
>> or wchar ? And then we generate the strings from that. It 
>> might be rather more natural for the caller to pass one of the 
>> string types into the template. That’s where I get rather more 
>> confused, say caller calls
>>
>> Transform(dstring)(dstring str)
>>
>> or can they just do Transform( "str"d ) and it would work out 
>> that the type is immutable dchar[] ?
>
> Perhaps I should just make up a small example file with two 
> functions in it to see if I can get the syntax right?

If I wrap the whole thing with a template declaration of the 
xchar type, then can I get away with no changes to the individual 
function definitions?


More information about the Digitalmars-d-learn mailing list