Path as an object in std.path
Steven Schveighoffer
schveiguy at yahoo.com
Thu Jun 6 10:48:52 PDT 2013
On Thu, 06 Jun 2013 13:40:37 -0400, Lars T. Kyllingstad
<public at kyllingen.net> wrote:
> On Thursday, 6 June 2013 at 17:28:56 UTC, Steven Schveighoffer wrote:
>> Great! I'd highly suggest pathEqual which takes two ranges of dchar
>> and does the composition and OS-specific comparison for you.
>
> They don't have to be dchar if all the building blocks are templates (as
> the existing ones are):
>
> bool pathEqual(CaseSensitive cs = CaseSensitive.osDefault, C1, C2)
> (const(C1)[] p1, const(C2)[] p2)
> if (isSomeChar!C1 && isSomeChar!C2)
Actually, all string variants are dchar ranges :) And your solution is
less general, dchar ranges don't have to be arrays.
However, I don't think in practice there are any real non-array dchar
ranges...
One thing your version does do is explicitly say the parameters are const,
which you couldn't do with a non-array dchar range.
-Steve
More information about the Digitalmars-d
mailing list