char[][] to std::vector<std::string> - DIP or dmd-issue?
Dennis Ritchie via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Jun 13 10:02:03 PDT 2015
On Saturday, 13 June 2015 at 16:20:46 UTC, anonymous wrote:
>> Do you like to write?
>> char[][] strArray = ["foo".dup, "bar".dup, "baz".dup];
>
> Ok. That's all you're on about? Basically you'd like this:
> char[] s = "foo";
> and this:
> char[][] a = [["foo"]];
> etc.
Yes. That's right, and not otherwise :)
> Yeah, that would be neat. But typing out ".dup" isn't that bad,
> and converting a `string[]` to a `char[][]` is simple:
> import std.conv: to;
> auto a = ["foo"].to!(char[][]);
Yes, but it is not suitable for multidimensional array of strings.
>> I suggest that such an option:
>> str[] strArray = ["foo", "bar", "baz"];
>
> I don't see how adding a new builtin type `str` would solve
> anything.
And why in C++ is running `std::vector<std::string>` ?
Really in D can not do something like that?
Maybe a new type will not solve anything, but there should be
other ways to do in D analogue strings of C++.
On Saturday, 13 June 2015 at 16:22:44 UTC, anonymous wrote:
> I don't understand what you're trying to say with that quote.
I would not say `simpler`, and `basic`. I just forgot the right
word, because my English is not good enough.
More information about the Digitalmars-d-learn
mailing list