Boost logo

Boost Users :

Subject: Re: [Boost-users] [graph] [beginner] How to use the "tie(...) feature" with standard c++ containers?
From: Christoph (c_p_at_[hidden])
Date: 2011-10-09 18:06:23


i just found http://www.boost.org/doc/libs/1_47_0/doc/html/foreach.html

from the docs:

For example, we can use BOOST_FOREACH with:

- STL containers
- arrays
- Null-terminated strings (char and wchar_t)
- std::pair of iterators

This way i can use one simple Expression for lists

std::list<int> list_int( /*...*/ );
BOOST_FOREACH( int i, list_int )
{
    // do something with i
}

or for vertices in graphs:

BOOST_FOREACH(my_graph_traits::vertex_descriptor vi, vertices (g))
{
        std::cout << vi << std::endl;
}

even though the original question is still there...


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net