/* Copyright (c) 1997-2010
   Ewgenij Gawrilow, Michael Joswig (Technische Universitaet Darmstadt, Germany)
   http://www.polymake.de

   This program is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by the
   Free Software Foundation; either version 2, or (at your option) any
   later version: http://www.gnu.org/licenses/gpl.txt.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
--------------------------------------------------------------------------------
   $Project: polymake $$Id: hash_iterators.h 9991 2010-12-12 23:36:28Z gawrilow $
*/

#ifndef POLYMAKE_INTERNAL_HASH_ITERATORS_H
#define POLYMAKE_INTERNAL_HASH_ITERATORS_H

#include "polymake/internal/comparators.h"

#if __GNUC__==4 && __GNUC_MINOR__>=2
#  define PM_TR1_HashtableIterator      std::tr1::__detail::_Hashtable_iterator
#  define PM_TR1_HashtableConstIterator std::tr1::__detail::_Hashtable_const_iterator
#endif

namespace pm {

#if __GNUC__==4 && __GNUC_MINOR__>=2
   template <typename Value, bool __constant_iterators, bool __cache>
   struct iterator_cross_const_helper< PM_TR1_HashtableIterator<Value,__constant_iterators,__cache>, true> {
      typedef PM_TR1_HashtableIterator<Value,__constant_iterators,__cache> iterator;
      typedef PM_TR1_HashtableConstIterator<Value,__constant_iterators,__cache> const_iterator;
   };

   template <typename Value, bool __constant_iterators, bool __cache>
   struct iterator_cross_const_helper< PM_TR1_HashtableConstIterator<Value,__constant_iterators,__cache>, true> {
      typedef PM_TR1_HashtableIterator<Value,__constant_iterators,__cache> iterator;
      typedef PM_TR1_HashtableConstIterator<Value,__constant_iterators,__cache> const_iterator;
   };
#endif

   template <typename Key, typename Params>
   struct hash_table_cmp_adapter {
      typedef typename extract_type_param<Params, Comparator, operations::cmp>::type key_comparator;
      typedef operations::cmp2eq<key_comparator, Key> type;
   };

} // end namespace pm

#if __GNUC__==4 && __GNUC_MINOR__>=2
#  undef PM_TR1_HashtableIterator
#  undef PM_TR1_HashtableConstIterator
#endif

#endif // POLYMAKE_INTERNAL_HASH_ITERATORS_H

// Local Variables:
// mode:C++
// c-basic-offset:3
// indent-tabs-mode:nil
// End:
