Ticket #1517: nonzippable.cpp
| File nonzippable.cpp, 500 bytes (added by , 15 years ago) |
|---|
| Line | |
|---|---|
| 1 | |
| 2 | #include <list> |
| 3 | #include <string> |
| 4 | #include <boost/tuple/tuple.hpp> |
| 5 | #include <boost/iterator/zip_iterator.hpp> |
| 6 | #include <boost/iterator/transform_iterator.hpp> |
| 7 | |
| 8 | int to_value(int const &v) |
| 9 | { |
| 10 | return v; |
| 11 | } |
| 12 | |
| 13 | int main() |
| 14 | { |
| 15 | std::list<int> rng1; |
| 16 | std::string rng2; |
| 17 | |
| 18 | boost::make_zip_iterator( |
| 19 | boost::make_tuple( |
| 20 | boost::make_transform_iterator(rng1.begin(), &to_value), // BidirectionalInput |
| 21 | rng2.begin() // RandomAccess |
| 22 | ) |
| 23 | ); |
| 24 | } |
