Re: CustomString and string constraints

2018-06-26 Thread SrMordred via Digitalmars-d-learn
On Tuesday, 26 June 2018 at 22:16:28 UTC, Jonathan M Davis wrote: If what you're asking is whether it's possible for a template constraint that uses something like isSomeString will ever match a user-defined type, then the answer is no. Thats exactly what I wanted xD. My idea was that if

Re: CustomString and string constraints

2018-06-26 Thread Jonathan M Davis via Digitalmars-d-learn
n Tuesday, June 26, 2018 17:14:08 SrMordred via Digitalmars-d-learn wrote: > Is possible to make a Custom Struct String work for D string > constraints? > > eg: > > struct MyString > { > char[] arr; > alias arr this; > } > > void getString( char[] str ){} > > MyString().split(";");

CustomString and string constraints

2018-06-26 Thread SrMordred via Digitalmars-d-learn
Is possible to make a Custom Struct String work for D string constraints? eg: struct MyString { char[] arr; alias arr this; } void getString( char[] str ){} MyString().split(";"); //oops, type mismatch getString( MyString() ); //fine, implicit conversion