Re: Is there an opposite of .toString()?

2017-10-15 Thread Faux Amis via Digitalmars-d-learn
On 2017-10-14 05:47, Jonathan M Davis wrote: On Saturday, October 14, 2017 00:18:35 myst via Digitalmars-d-learn wrote: I'm sorry if this has been answered already, it seems like a very basic question. There is .toString() method convention for printing, but I can not find anything alike for

Re: Is there an opposite of .toString()?

2017-10-14 Thread myst via Digitalmars-d-learn
On Saturday, 14 October 2017 at 03:47:29 UTC, Jonathan M Davis wrote: The function to use for conversions in general is std.conv.to. And really, there isn't much of a reason to ever call toString. Functions like writeln, format, and to may use it internally, but it's more or less an

Re: Is there an opposite of .toString()?

2017-10-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, October 14, 2017 00:18:35 myst via Digitalmars-d-learn wrote: > I'm sorry if this has been answered already, it seems like a very > basic question. > > There is .toString() method convention for printing, but I can > not find anything alike for reading. Is there something like >

Re: Is there an opposite of .toString()?

2017-10-13 Thread myst via Digitalmars-d-learn
On Saturday, 14 October 2017 at 02:16:12 UTC, Fra Mecca wrote: On Saturday, 14 October 2017 at 00:18:35 UTC, myst wrote: ... some snippet of a c++ code that does what you mean #include #include struct S { std::string s; int p; int n; }; std::istream& operator>>(std::istream&

Re: Is there an opposite of .toString()?

2017-10-13 Thread Fra Mecca via Digitalmars-d-learn
On Saturday, 14 October 2017 at 00:18:35 UTC, myst wrote: I'm sorry if this has been answered already, it seems like a very basic question. There is .toString() method convention for printing, but I can not find anything alike for reading. Is there something like operator>>() in C++? What's