От: | flаt | ||
Дата: | 24.09.14 13:07 | ||
Оценка: |
A default constructed iterator represents the end of the list.
template<class Iterator>
using iterators_pair = std::pair<Iterator, Iterator>;
namespace std {
template<class Iterator>
Iterator begin(const std::pair<Iterator, Iterator>& range) { return range.first; }
template<class Iterator>
Iterator end(const std::pair<Iterator, Iterator>& range) { return range.second; }
}
template<class Iterator>
std::pair<Iterator, Iterator> as_range(Iterator first) { return std::make_pair(first, Iterator()); }
int main()
{
using boost::asio::ip::tcp::resolver;
resolver dns(...);
for( auto& result: as_range(dns.resolve(...)) ) {
// use result
}
}