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

Investigate use of ranges for endpoints and connect / async_connect

Open chriskohlhoff opened this issue 10 years ago • 5 comments

chriskohlhoff avatar Feb 26 '15 10:02 chriskohlhoff

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

chriskohlhoff avatar Feb 26 '15 17:02 chriskohlhoff

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

chriskohlhoff avatar Feb 27 '15 13:02 chriskohlhoff

Applied in 16bb905a247318bb9a2af75bc98189c2d14bdf41.

chriskohlhoff avatar Apr 12 '15 00:04 chriskohlhoff

Change applied to connect and async_connect in 0905a68dbe1a56ab2b77b6586e911413152530f6.

chriskohlhoff avatar Apr 12 '15 01:04 chriskohlhoff

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.

chriskohlhoff avatar May 04 '15 10:05 chriskohlhoff