| 420 | } |
| 421 | |
| 422 | void test_connect_iter() |
| 423 | { |
| 424 | connection_sink sink; |
| 425 | boost::asio::io_context io_context; |
| 426 | boost::asio::ip::tcp::socket socket(io_context); |
| 427 | std::vector<boost::asio::ip::tcp::endpoint> endpoints; |
| 428 | const std::vector<boost::asio::ip::tcp::endpoint>& cendpoints = endpoints; |
| 429 | std::vector<boost::asio::ip::tcp::endpoint>::const_iterator result; |
| 430 | |
| 431 | try |
| 432 | { |
| 433 | result = boost::asio::connect(socket, cendpoints.begin(), cendpoints.end()); |
| 434 | BOOST_ASIO_CHECK(false); |
| 435 | } |
| 436 | catch (boost::system::system_error& e) |
| 437 | { |
| 438 | BOOST_ASIO_CHECK(e.code() == boost::asio::error::not_found); |
| 439 | } |
| 440 | |
| 441 | endpoints.push_back(sink.target_endpoint()); |
| 442 | |
| 443 | result = boost::asio::connect(socket, cendpoints.begin(), cendpoints.end()); |
| 444 | BOOST_ASIO_CHECK(result == cendpoints.begin()); |
| 445 | |
| 446 | endpoints.push_back(sink.target_endpoint()); |
| 447 | |
| 448 | result = boost::asio::connect(socket, cendpoints.begin(), cendpoints.end()); |
| 449 | BOOST_ASIO_CHECK(result == cendpoints.begin()); |
| 450 | |
| 451 | endpoints.insert(endpoints.begin(), boost::asio::ip::tcp::endpoint()); |
| 452 | |
| 453 | result = boost::asio::connect(socket, cendpoints.begin(), cendpoints.end()); |
| 454 | BOOST_ASIO_CHECK(result == cendpoints.begin() + 1); |
| 455 | } |
| 456 | |
| 457 | void test_connect_iter_ec() |
| 458 | { |