Feature request: Path append operators for strings

Simen Kjaeraas simen.kjaras at gmail.com
Tue Jul 2 12:52:14 PDT 2013


On 2013-07-02, 21:46, TommiT wrote:

> How would you feel about adding the '/' binary operator and the '/='  
> assignment operator for strings, wstrings and dstrings? The operators  
> would behave the same way as they do with boost::filesystem::path  
> objects:
>
> http://www.boost.org/doc/libs/1_54_0/libs/filesystem/doc/reference.html#path-appends
>
> In short (and omitting some details) code such as:
>
> string s = "C:\\Users" / "John";
>
> ...would be the same as:
>
> string s = "C:\\Users" ~ std.path.dirSeparator ~ "John";

This would be much better done with a library type:

auto s = Path("C:\\Users") / "John";

-- 
Simen


More information about the Digitalmars-d mailing list