Boost logo

Boost :

From: Yuval Ronen (ronen_yuval_at_[hidden])
Date: 2005-12-31 12:12:38


Hi.
These are minor things I noticed with, and was bothered by, the
asio::ipv4::address class. This is by no means an asio review (although
we desperately need some networking library, that's for sure).

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.

Another thing is the plethora of assingment operators. Wouldn't a single
copy-assignment be enough?

And one last suggestion: A construtor taking 4 unsigned chars, allowing
this:
asio::ipv4::address my_address(192, 168, 0, 1);

Thanks for listening,
Yuval


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk