Hi Andrei, == Quote from Andrei Alexandrescu ([email protected])'s article > On 06/19/2010 08:47 AM, Ben Hanson wrote: > > Hi there, > > > > Can anyone tell me how to get the maximum char value from a string > > type? I have a template struct which can take string or wstring and > > need to determine the character type from the string type. > > > > Thanks, > > > > Ben > Something like: > import std.stdio; > struct Widget(S) { > enum uint MAX_CHAR = typeof(S.init[0]).max; > } > void main() { > writeln(Widget!string.MAX_CHAR); > writeln(Widget!wstring.MAX_CHAR); > writeln(Widget!dstring.MAX_CHAR); > } > writes > 255 > 65535 > 1114111 > Andrei
Great, this is even easier. Thanks, Ben
