
Hi Yuval, --- Yuval Ronen <ronen_yuval@yahoo.com> wrote:
What I dislike is the string-accepting contructor and the to_string() method. My personal taste is that textual conversions (and the ip::address class is a very good candidate for this) should be made through the standard ostream/istream operators. This has the usual advantages of using an idiom. It also provides standard means to detect parsing error using the ios_base::fail bit. The ip::address currently has the only option of throwing in the string-accepting contructor, however, this is not intuitive, IMHO (and not documented). String conversions can be easily performed using boost::lexical_cast.
I think the current string conversion functions are convenient and natural, and I see them not being coupled to iostreams as a feature :) However I take your point about non-throwing parsing, so I will add both input and output iostream operations for the address class (and the endpoint classes too).
Another thing is the plethora of assingment operators. Wouldn't a single copy-assignment be enough?
For the current implementation, probably yes. But I don't want the interface to assume that the implementation will always be so cheap as to not worry about extra temporaries.
And one last suggestion: A construtor taking 4 unsigned chars, allowing this: asio::ipv4::address my_address(192, 168, 0, 1);
No problem, I can add that. Cheers, Chris