|  | 
|      | 
|  | 
| Function combineBoost , Chapter 1. Range 2.0 , Utilities
 
 Synopsisnamespace boost { namespace range { template<typename IterTuple> class combined_range : public iterator_range<zip_iterator<IterTuple> > { public: combined_range(IterTuple first, IterTuple last); }; template<typename... Ranges> auto combine(Ranges&&... rngs) -> combined_range<decltype(boost::make_tuple(boost::begin(rngs)...))> } // namespace range } // namespace boost 
 Example#include <boost/range/combine.hpp> #include <boost/foreach.hpp> #include <iostream> #include <vector> #include <list> int main(int, const char*[]) { std::vector<int> v; std::list<char> l; for (int i = 0; i < 5; ++i) { v.push_back(i); l.push_back(static_cast<char>(i) + 'a'); } int ti; char tc; BOOST_FOREACH(boost::tie(ti, tc), boost::combine(v, l)) { std::cout << '(' << ti << ',' << tv << ')' << '\n'; } return 0; } Это приводит к выходу: (0,a) (1,b) (2,c) (3,d) (4,e) Статья Function combine раздела Chapter 1. Range 2.0 Utilities может быть полезна для разработчиков на c++ и boost. 
 | ||||||||||||
|  ©KANSoftWare (разработка программного обеспечения, создание программ, создание интерактивных сайтов), 2007 | ||||||||||||