chriskohlhoff / asio-tr2

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

Investigate use of ranges for endpoints and connect / async_connect #98

Open chriskohlhoff opened 9 years ago

chriskohlhoff commented 9 years ago

Idea: Change resolve() and async_resolve() to return a resolve_results type, based on regex's match_results.

chriskohlhoff commented 9 years ago

Will also mean a clean up of basic_resolver_iterator wording wrt past-the-end iterators.

chriskohlhoff commented 9 years ago

Applied in 16bb905a247318bb9a2af75bc98189c2d14bdf41.

chriskohlhoff commented 9 years ago

Change applied to connect and async_connect in 0905a68dbe1a56ab2b77b6586e911413152530f6.

chriskohlhoff commented 9 years ago

Pre-Lenexa Summary

[internet.resolver], [socket.algo.connect], [socket.algo.async.connect]

Jens objected very strongly to the previous single-iterator overloads of connect and async_connect, and also did not like having a resource-owning iterator. I still felt it was important to preserve simple one-liners like:

connect(my_socket, my_resolver.resolve("host", "service"));

The proposed solution is to change the resolve functions to return a range type, based on regex's match_results. The single-iterator overloads of connect and async_connect have been removed and replaced with overloads that take an EndpointSequence. This preserves the above one-liner use case. The two-iterator overloads have also been retained.

The change was included in revision 5. An implementation can be found on the master branch of Asio's GitHub repository.