asio-tr2 icon indicating copy to clipboard operation
asio-tr2 copied to clipboard

Consider template for basic_address_range

Open chriskohlhoff opened this issue 10 years ago • 3 comments

But this is a weaker requirement than for basic_address_iterator given the size() member behaviour for IPv6. Some people would like a size() that returns numeric_limits<size_t>::max().

chriskohlhoff avatar Feb 27 '15 10:02 chriskohlhoff

size() could be deleted in the v6 specialisation

chriskohlhoff avatar Feb 27 '15 10:02 chriskohlhoff

Applied in 270ba9613d82b44098af6cbd42d998dc7b5222f4.

The size() member is conditionally present.

chriskohlhoff avatar Apr 11 '15 02:04 chriskohlhoff

Pre-Lenexa Summary

[internet.address.range]

This change simplifies use of the range types in IP-version-independent generic code. The basic_address_range primary template is not defined. Only specialisations for address_v4 and address_v6 are provided.

There is an open question as to whether the size() member should be conditionally defined (and not provided for the address_v6 specialisation), or always defined (and given a maximum value). The issue is that to support all address_v6 ranges a 128-bit integer is required. However, it may be that common use cases involve small networks, in which case a valid size calculation may be useful.

The change was included in revision 5, with a conditionally present size() member. An implementation can be found on the master branch of Asio's GitHub repository.

chriskohlhoff avatar May 04 '15 09:05 chriskohlhoff