virtio: convert vring::post() to accept an iterator to a range

Instead of an iterator to a vector of buffers, accept an iterator
to a container of buffers, increasing flexibility for callers.
This commit is contained in:
Avi Kivity
2014-10-14 18:02:52 +03:00
parent d63489d6b8
commit de4de65d46

View File

@@ -271,7 +271,10 @@ void vring::run() {
template <typename Iterator>
void vring::post(Iterator begin, Iterator end) {
std::for_each(begin, end, [&] (buffer_chain& bc) {
// Note: buffer_chain here is any container of buffer, not
// necessarily vector<buffer>.
using buffer_chain = decltype(*begin);
std::for_each(begin, end, [this] (buffer_chain bc) {
bool has_prev = false;
unsigned prev_desc_idx = 0;
for (auto i = bc.rbegin(); i != bc.rend(); ++i) {