asio icon indicating copy to clipboard operation
asio copied to clipboard

ip::network_v4 does not have error_code constructor for subnet masks

Open edtanous opened this issue 2 years ago • 0 comments

https://github.com/chriskohlhoff/asio/blob/147f7225a96d45a2807a64e443177f621844e51c/asio/include/asio/ip/network_v4.hpp#L54

The above is a constructor that allows constructing a network_v4 object from an address and a subnet mask. The constructor has some non-trivial parsing code to ensure that the subnet mask is correct, which throws in the case where the subnet mask has non-contiguous bytes. Presumably it would be nice to have an equivalent that did not throw, and returned an error_code instead much like some of the make_network_v4 overloads.

I suspect this should be put both as a constructor on network_v4 , as well as with the corresponding make_network_v4 overload? Or would it only go in the constructor?

edtanous avatar Aug 15 '22 19:08 edtanous