chriskohlhoff / asio-tr2

C++ TR2 proposal based on Asio
17 stars 5 forks source link

Consider template for basic_address_range #154

Open chriskohlhoff opened 9 years ago

chriskohlhoff commented 9 years ago

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::max().

chriskohlhoff commented 9 years ago

size() could be deleted in the v6 specialisation

chriskohlhoff commented 9 years ago

Applied in 270ba9613d82b44098af6cbd42d998dc7b5222f4.

The size() member is conditionally present.

chriskohlhoff commented 9 years ago

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.