Index: lemon/bits/graph_extender.h
===================================================================
--- lemon/bits/graph_extender.h	(revision 1991)
+++ lemon/bits/graph_extender.h	(revision 1993)
@@ -20,5 +20,5 @@
 #define LEMON_GRAPH_EXTENDER_H
 
-#include <lemon/invalid.h>
+#include <lemon/bits/invalid.h>
 #include <lemon/error.h>
 
Index: lemon/bits/invalid.h
===================================================================
--- lemon/bits/invalid.h	(revision 1993)
+++ lemon/bits/invalid.h	(revision 1993)
@@ -0,0 +1,54 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2006
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_BITS_INVALID_H
+#define LEMON_BITS_INVALID_H
+
+///\file
+///\brief Definition of INVALID.
+
+namespace lemon {
+
+  /// Dummy type to make it easier to make invalid iterators.
+  
+  /// See \ref INVALID, how to use it.
+  
+  struct Invalid {
+  public:
+    bool operator==(Invalid) { return true;  }
+    bool operator!=(Invalid) { return false; }
+    bool operator< (Invalid) { return false; }
+  };
+  
+  /// Invalid iterators.
+  
+  /// \ref Invalid is a global type that converts to each iterator
+  /// in such a way that the value of the target iterator will be invalid.
+
+  //const Invalid &INVALID = *(Invalid *)0;
+
+#ifdef LEMON_ONLY_TEMPLATES
+  const Invalid INVALID = Invalid();
+#else
+  extern const Invalid INVALID;
+#endif
+
+} //namespace lemon
+
+#endif
+  
Index: lemon/bits/map_extender.h
===================================================================
--- lemon/bits/map_extender.h	(revision 1956)
+++ lemon/bits/map_extender.h	(revision 1993)
@@ -22,5 +22,5 @@
 #include <iterator>
 
-#include <lemon/traits.h>
+#include <lemon/bits/traits.h>
 
 ///\file
Index: lemon/bits/static_map.h
===================================================================
--- lemon/bits/static_map.h	(revision 1979)
+++ lemon/bits/static_map.h	(revision 1993)
@@ -23,5 +23,5 @@
 #include <iostream>
 
-#include <lemon/utility.h>
+#include <lemon/bits/utility.h>
 #include <lemon/bits/map_extender.h>
 #include <lemon/bits/alteration_notifier.h>
Index: lemon/bits/traits.h
===================================================================
--- lemon/bits/traits.h	(revision 1993)
+++ lemon/bits/traits.h	(revision 1993)
@@ -0,0 +1,300 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2006
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_BITS_TRAITS_H
+#define LEMON_BITS_TRAITS_H
+
+#include <lemon/bits/utility.h>
+
+///\file
+///\brief Traits for graphs and maps
+///
+
+namespace lemon {
+  template <typename _Graph, typename _Item>
+  class ItemSetTraits {};
+  
+
+  template <typename Graph, typename Enable = void>
+  struct NodeNotifierIndicator {
+    typedef InvalidType Type;
+  };
+  template <typename Graph>
+  struct NodeNotifierIndicator<
+    Graph, 
+    typename enable_if<typename Graph::NodeNotifier::Notifier, void>::type
+  > { 
+    typedef typename Graph::NodeNotifier Type;
+  };
+
+  template <typename _Graph>
+  class ItemSetTraits<_Graph, typename _Graph::Node> {
+  public:
+    
+    typedef _Graph Graph;
+
+    typedef typename Graph::Node Item;
+    typedef typename Graph::NodeIt ItemIt;
+
+    typedef typename NodeNotifierIndicator<Graph>::Type ItemNotifier;
+
+    template <typename _Value>
+    class Map : public Graph::template NodeMap<_Value> {
+    public:
+      typedef typename Graph::template NodeMap<_Value> Parent; 
+      typedef typename Parent::Value Value;
+
+      Map(const Graph& _graph) : Parent(_graph) {}
+      Map(const Graph& _graph, const Value& _value) 
+	: Parent(_graph, _value) {}
+
+     };
+
+  };
+
+  template <typename Graph, typename Enable = void>
+  struct EdgeNotifierIndicator {
+    typedef InvalidType Type;
+  };
+  template <typename Graph>
+  struct EdgeNotifierIndicator<
+    Graph, 
+    typename enable_if<typename Graph::EdgeNotifier::Notifier, void>::type
+  > { 
+    typedef typename Graph::EdgeNotifier Type;
+  };
+
+  template <typename _Graph>
+  class ItemSetTraits<_Graph, typename _Graph::Edge> {
+  public:
+    
+    typedef _Graph Graph;
+
+    typedef typename Graph::Edge Item;
+    typedef typename Graph::EdgeIt ItemIt;
+
+    typedef typename EdgeNotifierIndicator<Graph>::Type ItemNotifier;
+
+    template <typename _Value>
+    class Map : public Graph::template EdgeMap<_Value> {
+    public:
+      typedef typename Graph::template EdgeMap<_Value> Parent; 
+      typedef typename Parent::Value Value;
+
+      Map(const Graph& _graph) : Parent(_graph) {}
+      Map(const Graph& _graph, const Value& _value) 
+	: Parent(_graph, _value) {}
+    };
+
+  };
+
+  template <typename Graph, typename Enable = void>
+  struct UEdgeNotifierIndicator {
+    typedef InvalidType Type;
+  };
+  template <typename Graph>
+  struct UEdgeNotifierIndicator<
+    Graph, 
+    typename enable_if<typename Graph::UEdgeNotifier::Notifier, void>::type
+  > { 
+    typedef typename Graph::UEdgeNotifier Type;
+  };
+
+  template <typename _Graph>
+  class ItemSetTraits<_Graph, typename _Graph::UEdge> {
+  public:
+    
+    typedef _Graph Graph;
+
+    typedef typename Graph::UEdge Item;
+    typedef typename Graph::UEdgeIt ItemIt;
+
+    typedef typename UEdgeNotifierIndicator<Graph>::Type ItemNotifier;
+
+    template <typename _Value>
+    class Map : public Graph::template UEdgeMap<_Value> {
+    public:
+      typedef typename Graph::template UEdgeMap<_Value> Parent; 
+      typedef typename Parent::Value Value;
+
+      Map(const Graph& _graph) : Parent(_graph) {}
+      Map(const Graph& _graph, const Value& _value) 
+	: Parent(_graph, _value) {}
+    };
+
+  };
+
+  template <typename Graph, typename Enable = void>
+  struct ANodeNotifierIndicator {
+    typedef InvalidType Type;
+  };
+  template <typename Graph>
+  struct ANodeNotifierIndicator<
+    Graph, 
+    typename enable_if<typename Graph::ANodeNotifier::Notifier, void>::type
+  > { 
+    typedef typename Graph::ANodeNotifier Type;
+  };
+
+  template <typename _Graph>
+  class ItemSetTraits<_Graph, typename _Graph::ANode> {
+  public:
+    
+    typedef _Graph Graph;
+
+    typedef typename Graph::ANode Item;
+    typedef typename Graph::ANodeIt ItemIt;
+
+    typedef typename ANodeNotifierIndicator<Graph>::Type ItemNotifier;
+
+    template <typename _Value>
+    class Map : public Graph::template ANodeMap<_Value> {
+    public:
+      typedef typename Graph::template ANodeMap<_Value> Parent; 
+      typedef typename Parent::Value Value;
+
+      Map(const Graph& _graph) : Parent(_graph) {}
+      Map(const Graph& _graph, const Value& _value) 
+	: Parent(_graph, _value) {}
+    };
+
+  };
+
+  template <typename Graph, typename Enable = void>
+  struct BNodeNotifierIndicator {
+    typedef InvalidType Type;
+  };
+  template <typename Graph>
+  struct BNodeNotifierIndicator<
+    Graph, 
+    typename enable_if<typename Graph::BNodeNotifier::Notifier, void>::type
+  > { 
+    typedef typename Graph::BNodeNotifier Type;
+  };
+
+  template <typename _Graph>
+  class ItemSetTraits<_Graph, typename _Graph::BNode> {
+  public:
+    
+    typedef _Graph Graph;
+
+    typedef typename Graph::BNode Item;
+    typedef typename Graph::BNodeIt ItemIt;
+
+    typedef typename BNodeNotifierIndicator<Graph>::Type ItemNotifier;
+
+    template <typename _Value>
+    class Map : public Graph::template BNodeMap<_Value> {
+    public:
+      typedef typename Graph::template BNodeMap<_Value> Parent; 
+      typedef typename Parent::Value Value;
+
+      Map(const Graph& _graph) : Parent(_graph) {}
+      Map(const Graph& _graph, const Value& _value) 
+	: Parent(_graph, _value) {}
+    };
+
+  };
+
+
+  template <typename Map, typename Enable = void>
+  struct MapTraits {
+    typedef False ReferenceMapTag;
+
+    typedef typename Map::Key Key;
+    typedef typename Map::Value Value;
+
+    typedef const Value ConstReturnValue;
+    typedef const Value ReturnValue;
+  };
+
+  template <typename Map>
+  struct MapTraits<
+    Map, typename enable_if<typename Map::ReferenceMapTag, void>::type > 
+  {
+    typedef True ReferenceMapTag;
+    
+    typedef typename Map::Key Key;
+    typedef typename Map::Value Value;
+
+    typedef typename Map::ConstReference ConstReturnValue;
+    typedef typename Map::Reference ReturnValue;
+
+    typedef typename Map::ConstReference ConstReference; 
+    typedef typename Map::Reference Reference;
+ };
+
+  // Indicators for the tags
+
+  template <typename Graph, typename Enable = void>
+  struct NodeNumTagIndicator {
+    static const bool value = false;
+  };
+
+  template <typename Graph>
+  struct NodeNumTagIndicator<
+    Graph, 
+    typename enable_if<typename Graph::NodeNumTag, void>::type
+  > {
+    static const bool value = true;
+  };
+
+  template <typename Graph, typename Enable = void>
+  struct EdgeNumTagIndicator {
+    static const bool value = false;
+  };
+
+  template <typename Graph>
+  struct EdgeNumTagIndicator<
+    Graph, 
+    typename enable_if<typename Graph::EdgeNumTag, void>::type
+  > {
+    static const bool value = true;
+  };
+
+  template <typename Graph, typename Enable = void>
+  struct FindEdgeTagIndicator {
+    static const bool value = false;
+  };
+
+  template <typename Graph>
+  struct FindEdgeTagIndicator<
+    Graph, 
+    typename enable_if<typename Graph::FindEdgeTag, void>::type
+  > {
+    static const bool value = true;
+  };
+
+  template <typename Graph, typename Enable = void>
+  struct UndirectedTagIndicator {
+    static const bool value = false;
+  };
+
+  template <typename Graph>
+  struct UndirectedTagIndicator<
+    Graph, 
+    typename enable_if<typename Graph::UndirectedTag, void>::type
+  > {
+    static const bool value = true;
+  };
+
+
+
+}
+
+#endif // LEMON_MAPS_H
Index: lemon/bits/utility.h
===================================================================
--- lemon/bits/utility.h	(revision 1993)
+++ lemon/bits/utility.h	(revision 1993)
@@ -0,0 +1,137 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2006
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+// This file contains a modified version of the enable_if library from BOOST.
+// See the appropriate copyright notice below.
+
+// Boost enable_if library
+
+// Copyright 2003 © The Trustees of Indiana University.
+
+// Use, modification, and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+//    Authors: Jaakko Järvi (jajarvi at osl.iu.edu)
+//             Jeremiah Willcock (jewillco at osl.iu.edu)
+//             Andrew Lumsdaine (lums at osl.iu.edu)
+
+
+#ifndef LEMON_BITS_UTILITY_H
+#define LEMON_BITS_UTILITY_H
+
+///\file
+///\brief Miscellaneous basic utilities
+///
+///\todo Please rethink the organisation of the basic files like this.
+///E.g. this file might be merged with invalid.h.
+
+
+namespace lemon
+{
+
+  /// Basic type for defining "tags". A "YES" condition for \c enable_if.
+
+  /// Basic type for defining "tags". A "YES" condition for \c enable_if.
+  ///
+  ///\sa False
+  ///
+  /// \todo This should go to a separate "basic_types.h" (or something)
+  /// file.
+  struct True {
+    ///\e
+    static const bool value = true;
+  };
+
+  /// Basic type for defining "tags". A "NO" condition for \c enable_if.
+
+  /// Basic type for defining "tags". A "NO" condition for \c enable_if.
+  ///
+  ///\sa True
+  struct False {
+    ///\e
+    static const bool value = false;
+  };
+
+
+  class InvalidType {
+  private:
+    InvalidType();
+  };
+  
+
+  template <typename T>
+  struct Wrap {
+    const T &value;
+    Wrap(const T &t) : value(t) {}
+  };
+
+  /**************** dummy class to avoid ambiguity ****************/
+
+  template<int T> struct dummy { dummy(int) {} };
+
+  /**************** enable_if from BOOST ****************/
+ 
+  template <bool B, class T = void>
+  struct enable_if_c {
+    typedef T type;
+  };
+
+  template <class T>
+  struct enable_if_c<false, T> {};
+
+  template <class Cond, class T = void> 
+  struct enable_if : public enable_if_c<Cond::value, T> {};
+
+  template <bool B, class T>
+  struct lazy_enable_if_c {
+    typedef typename T::type type;
+  };
+
+  template <class T>
+  struct lazy_enable_if_c<false, T> {};
+
+  template <class Cond, class T> 
+  struct lazy_enable_if : public lazy_enable_if_c<Cond::value, T> {};
+
+
+  template <bool B, class T = void>
+  struct disable_if_c {
+    typedef T type;
+  };
+
+  template <class T>
+  struct disable_if_c<true, T> {};
+
+  template <class Cond, class T = void> 
+  struct disable_if : public disable_if_c<Cond::value, T> {};
+
+  template <bool B, class T>
+  struct lazy_disable_if_c {
+    typedef typename T::type type;
+  };
+
+  template <class T>
+  struct lazy_disable_if_c<true, T> {};
+
+  template <class Cond, class T> 
+  struct lazy_disable_if : public lazy_disable_if_c<Cond::value, T> {};
+
+} // namespace lemon
+
+#endif
Index: lemon/bits/vector_map.h
===================================================================
--- lemon/bits/vector_map.h	(revision 1956)
+++ lemon/bits/vector_map.h	(revision 1993)
@@ -23,5 +23,5 @@
 #include <algorithm>
 
-#include <lemon/utility.h>
+#include <lemon/bits/utility.h>
 #include <lemon/bits/map_extender.h>
 #include <lemon/bits/alteration_notifier.h>
