Gamgee
You miserable little maggot. I'll stove your head in!
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
zip.h
Go to the documentation of this file.
1 #ifndef gamgee__zip__guard
2 #define gamgee__zip__guard
3 
4 #include <boost/format.hpp>
5 #include <boost/iterator/zip_iterator.hpp>
6 #include <boost/range.hpp>
7 
8 namespace gamgee {
9 namespace utils {
10 
25 template <typename... T>
26 auto zip(const T&... containers) -> boost::iterator_range<boost::zip_iterator<decltype(boost::make_tuple(containers.begin()...))>>
27 {
28  auto zip_begin = boost::make_zip_iterator(boost::make_tuple(std::begin(containers)...));
29  auto zip_end = boost::make_zip_iterator(boost::make_tuple(std::end(containers)...));
30  return boost::make_iterator_range(zip_begin, zip_end);
31 }
32 
33 } // namespace utils
34 } // namespace gamgee
35 
36 #endif /* gamgee__zip__guard */
auto zip(const T &...containers) -> boost::iterator_range< boost::zip_iterator< decltype(boost::make_tuple(containers.begin()...))>>
utility method to zip iterators together with simpler syntax than boost
Definition: zip.h:26
Definition: exceptions.h:9