// Copyright David Abrahams 2008. Distributed under the Boost
// Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#include <utility>
#include <iostream>

int g[] = { 0, 1, 2, 3, 4 };
typedef int* vertex_iterator;

std::pair<vertex_iterator,vertex_iterator> vertices(int(&g)[5])
{
    return std::make_pair(&g[0], &g[0]+5);
}

template <class T, class U>
inline T operator%(T& start, std::pair<T,U> const& r)
{
    start = r.first;
    return r.second;
}

int main()
{
    for (vertex_iterator pv,ve = pv%vertices(g); pv != ve; ++pv)
    {
        std::cout << *pv << std::endl;
    }
}

