Blame toonz/sources/include/tcg/boost/zipped_range.h
|
Shinya Kitaoka |
810553 |
#pragma once
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef ZIPPED_RANGE_H
|
|
Toshihiro Shimizu |
890ddd |
#define ZIPPED_RANGE_H
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// boost includes
|
|
Toshihiro Shimizu |
890ddd |
#include <boost range.hpp=""></boost>
|
|
Toshihiro Shimizu |
890ddd |
#include <boost iterator="" zip_iterator.hpp=""></boost>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*!
|
|
Toshihiro Shimizu |
890ddd |
\file zipped_range.h
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
\brief Contains a range creator for boost::zip_iterator objects.
|
|
Toshihiro Shimizu |
890ddd |
\remark Zipped ranges are currently constrained to a 2-tuple.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
namespace tcg {
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
template <typename rng1,="" rng2="" typename=""></typename>
|
|
Toshihiro Shimizu |
890ddd |
struct _zip_rng_traits {
|
|
Shinya Kitaoka |
120a6e |
typedef boost::zip_iterator<
|
|
Shinya Kitaoka |
120a6e |
boost::tuple<typename boost::range_iterator<rng1="">::type,</typename>
|
|
Shinya Kitaoka |
120a6e |
typename boost::range_iterator<rng2>::type>></rng2>
|
|
Shinya Kitaoka |
120a6e |
iterator;
|
|
Shinya Kitaoka |
120a6e |
typedef std::pair<iterator, iterator=""> range;</iterator,>
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//**********************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// Permuted Range creator
|
|
Toshihiro Shimizu |
890ddd |
//**********************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
template <typename rng1,="" rng2="" typename=""></typename>
|
|
Shinya Kitaoka |
120a6e |
typename _zip_rng_traits<rng1, rng2="">::range zipped_range(Rng1 &rng1,</rng1,>
|
|
Shinya Kitaoka |
120a6e |
Rng2 &rng2) {
|
|
Shinya Kitaoka |
120a6e |
typedef typename _zip_rng_traits<rng1, rng2="">::range range;</rng1,>
|
|
Shinya Kitaoka |
120a6e |
typedef typename _zip_rng_traits<rng1, rng2="">::iterator iterator;</rng1,>
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
return range(
|
|
Shinya Kitaoka |
120a6e |
iterator(boost::make_tuple(boost::begin(rng1), boost::begin(rng2))),
|
|
Shinya Kitaoka |
120a6e |
iterator(boost::make_tuple(boost::end(rng1), boost::end(rng2))));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
} // namespace tcg
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
#endif // ZIPPED_RANGE_H
|