On Friday, 1 November 2019 at 10:39:42 UTC, Jacob Carlborg wrote:
FYI, string is a built-in type.
string is immutable(char)[], as we all know. Syntactic sugar, not exactly a built in type but treating it like one is often valuable.
To follow on from this, I'll share my experience with doing exactly what SealabJaster is illustrating several times previously:
You also want to catch const(char)[] and just plain char[] for JSON serialisation purposes. So a template constraint that catches all those is what you want instead of just is( T == string ).
Dealing with wstring and dstring can be handled for bonus points... but eh, you only need to really worry about that if you are writing a library (or heavily use Phobos...).
