/* Copyright (c) 1997-2006
   Ewgenij Gawrilow, Michael Joswig (Technische Universitaet Berlin, Germany)
   http://www.math.tu-berlin.de/polymake,  mailto:polymake@math.tu-berlin.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.
*/

#ifndef _POLYMAKE_STD_MAP
#define _POLYMAKE_STD_MAP "$Project: polymake $$Id: map 7315 2006-04-02 21:37:53Z gawrilow $"

#include_next <map>

#if defined(__INTEL_COMPILER) && !defined(__GNUC__)
# ifndef _POLYMAKE_ITERATORS_H
#  include <iterators.h>
# endif
#else
# ifndef _POLYMAKE_TYPE_MANIP_H
#  include <type_manip.h>
# endif
#endif

namespace pm {

template <typename K, typename V, typename KeyCompare, typename Alloc>
struct spec_object_traits< std::map<K,V,KeyCompare,Alloc> >
   : spec_object_traits<is_container> {
   static const IO_separator_kind IO_separator=IO_sep_inherit;
};

#if _POLYMAKE_ICC_ONLY
namespace std_nested_iterators {
   enum { map=5 };

   namespace _impl {
      template <typename Value>
      struct split_pair {
	 typedef bool first_type;
	 typedef bool second_type;
      };

      template <typename T1, typename T2>
      struct split_pair< std::pair<T1,T2> > {
	 typedef typename deref<T1>::type first_type;
	 typedef T2 second_type;
      };

      template <typename Iterator, typename Value>
      typename size_discriminant< derived_from<typename std::map<typename split_pair<Value>::first_type, typename split_pair<Value>::second_type,
								 std::less<typename split_pair<Value>::first_type> >::iterator, Iterator>::value
				  ? map : unmatched >::type
      analyzer_f(Iterator*, Value*, typename std::map<typename split_pair<Value>::first_type, typename split_pair<Value>::second_type,
		                                      std::less<typename split_pair<Value>::first_type> >::const_iterator*, bait*);
   }

   template <typename Iterator, typename Value>
   struct extractor<Iterator, Value, map> {
      typedef typename deref<typename Value::first_type>::type K;
      typedef typename Value::second_type V;
      typedef typename std::map<K, V, std::less<V> >::iterator iterator;
      typedef typename std::map<K, V, std::less<V> >::const_iterator const_iterator;
   };
}
#endif // _POLYMAKE_ICC_ONLY

} // end namespace pm

#endif // _POLYMAKE_STD_MAP

// Local Variables:
// mode:C++
// End:
