Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef PERMUTED_RANGE_H
Toshihiro Shimizu 890ddd
#define PERMUTED_RANGE_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// boost includes
Toshihiro Shimizu 890ddd
#include <boost range.hpp=""></boost>
Toshihiro Shimizu 890ddd
#include <boost iterator="" permutation_iterator.hpp=""></boost>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*!
Toshihiro Shimizu 890ddd
  \file     permuted_range.h
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
  \brief    Contains a range creator for boost::permutation_iterator objects.
Toshihiro Shimizu 890ddd
*/
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
namespace tcg {
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
template <typename elemrng,="" indxrng="" typename=""></typename>
Toshihiro Shimizu 890ddd
struct _perm_rng_traits {
Shinya Kitaoka 120a6e
  typedef boost::permutation_iterator<
Shinya Kitaoka 120a6e
      typename boost::range_iterator<elemrng>::type,</elemrng>
Shinya Kitaoka 120a6e
      typename boost::range_iterator<indxrng>::type></indxrng>
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 elementsrng,="" indexesrng="" typename=""></typename>
Shinya Kitaoka 120a6e
typename _perm_rng_traits<elementsrng, const="" indexesrng="">::range permuted_range(</elementsrng,>
Shinya Kitaoka 120a6e
    ElementsRng &erng, const IndexesRng &irng) {
Shinya Kitaoka 120a6e
  typedef typename _perm_rng_traits<elementsrng, const="" indexesrng="">::range range;</elementsrng,>
Shinya Kitaoka 120a6e
  typedef typename _perm_rng_traits<elementsrng, const="" indexesrng="">::iterator</elementsrng,>
Shinya Kitaoka 120a6e
      iterator;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  return range(iterator(boost::begin(erng), boost::begin(irng)),
Shinya Kitaoka 120a6e
               iterator(boost::begin(erng), boost::end(irng)));
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
}  // namespace tcg
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
#endif  // PERMUTED_RANGE_H