Index: lemon/bits/item_reader.h
===================================================================
--- lemon/bits/item_reader.h	(revision 1744)
+++ lemon/bits/item_reader.h	(revision 1852)
@@ -181,4 +181,10 @@
   public:
 
+    /// \brief Constructor for InsertReader
+    ///
+    /// Constructor for InsertReader
+    PushBackReader(const ItemReader& _item_reader = ItemReader())
+      : item_reader(_item_reader) {}
+
     /// \brief Reads the values into the container from the given stream.
     ///
@@ -195,5 +201,4 @@
       }
       if (!is) throw DataFormatError("PushBackReader format error");
-      is.putback(c);
     }
 
@@ -223,4 +228,10 @@
 
   public:
+
+    /// \brief Constructor for InsertReader
+    ///
+    /// Constructor for InsertReader
+    InsertReader(const ItemReader& _item_reader = ItemReader())
+      : item_reader(_item_reader) {}
 
     /// \brief Reads the values into the container from the given stream.
@@ -238,5 +249,4 @@
       }
       if (!is) throw DataFormatError("PushBackReader format error");
-      is.putback(c);
     }
 
@@ -311,12 +321,66 @@
     ///
     /// Reads the line from the given stream.
-    void read(std::istream& is, Value& value) {
+    void read(std::istream& is, Value& value) const {
       if (skipSpaces) is >> std::ws;
       if (!getline(is, value)) {
-	throw DataFormatError("LineReader forma error");
+	throw DataFormatError("LineReader format error");
       }
     }
   private:
     bool skipSpaces;
+  };
+
+  /// \ingroup item_io
+  /// \brief Reader for std::pair.
+  ///
+  /// Reader for std::pair.
+  ///
+  /// \author Balazs Dezso
+  template <typename _Pair, 
+	    typename _FirstReader = 
+	    DefaultReader<typename _Pair::first_type>,
+	    typename _SecondReader = 
+	    DefaultReader<typename _Pair::second_type> >
+  class PairReader {
+  public:
+    typedef _Pair Value;
+
+    typedef _FirstReader FirstReader;
+    typedef _SecondReader SecondReader;
+
+  private:
+
+    FirstReader first_reader;
+    SecondReader second_reader;
+
+  public:
+    
+    /// \brief Constructor.
+    ///
+    /// Constructor for the PairReader.
+    PairReader(const FirstReader& _first_reader = FirstReader(), 
+	       const SecondReader& _second_reader = SecondReader()) 
+      : first_reader(_first_reader), second_reader(_second_reader) {}
+    
+    /// \brief Reads the pair from the given stream.
+    ///
+    /// Reads the pair from the given stream.
+    void read(std::istream& is, Value& value) const {
+      char c;
+      if (!(is >> c) || c != '(') {
+	throw DataFormatError("PairReader format error");
+      }
+      first_reader.read(is, value.first);
+      if (!(is >> c) || c != '=') {
+	throw DataFormatError("PairReader format error");
+      }
+      if (!(is >> c) || c != '>') {
+	throw DataFormatError("PairReader format error");
+      }
+      second_reader.read(is, value.second);
+      if (!(is >> c) || c != ')') {
+	throw DataFormatError("PairReader format error");
+      }
+    }
   };
 
@@ -390,8 +454,22 @@
     : public InsertReader<std::set<Item> > {};
 
+  template <typename Key, typename Value>
+  class DefaultReader<std::map<Key, Value> > 
+    : public InsertReader<std::map<Key, Value>,
+			  DefaultReader<std::pair<Key, Value> > > {};
+
   template <typename Item>
   class DefaultReader<std::multiset<Item> > 
     : public InsertReader<std::multiset<Item> > {};
 
+  template <typename Key, typename Value>
+  class DefaultReader<std::multimap<Key, Value> > 
+    : public InsertReader<std::multimap<Key, Value>,
+			  DefaultReader<std::pair<Key, Value> > > {};
+
+  template <typename First, typename Second>
+  class DefaultReader<std::pair<First, Second> > 
+    : public PairReader<std::pair<First, Second> > {};
+
   /// \ingroup item_io
   /// 
Index: lemon/bits/item_writer.h
===================================================================
--- lemon/bits/item_writer.h	(revision 1535)
+++ lemon/bits/item_writer.h	(revision 1852)
@@ -54,5 +54,5 @@
     ///
     /// Writes a quoted string to the given stream.
-    void write(std::ostream& os, const std::string& value) {
+    void write(std::ostream& os, const std::string& value) const {
       os << "\"";
       if (escaped) {
@@ -137,5 +137,5 @@
     ///
     /// Writes a quoted char array to the given stream.
-    void write(std::ostream& os, const char* value) {
+    void write(std::ostream& os, const char* value) const {
       QuotedStringWriter(escaped).write(os, std::string(value));
     }
@@ -169,4 +169,7 @@
 
   public:
+
+    IterableWriter(const ItemWriter& _item_writer = ItemWriter())
+      : item_writer(_item_writer) {}
 
     /// \brief Writes the values of the container to the given stream.
@@ -186,4 +189,51 @@
 
   /// \ingroup item_io
+  ///
+  /// \brief Writer for standard pairs.
+  ///
+  /// Writer for standard pairs. The representation of a pair is
+  /// \code ( first_value => second_value ) \endcode.
+  /// \author Balazs Dezso
+  template <typename _Pair, 
+	    typename _FirstWriter = 
+	    DefaultWriter<typename _Pair::first_type>,
+	    typename _SecondWriter = 
+	    DefaultWriter<typename _Pair::second_type> >
+  class PairWriter {
+  public:
+
+    typedef _Pair Value;
+
+    typedef _FirstWriter FirstWriter;
+    typedef _SecondWriter SecondWriter;
+
+  private:
+
+    FirstWriter first_writer;
+    SecondWriter second_writer;
+
+  public:
+    
+    /// \brief Constructor.
+    ///
+    /// Constructor for the PairWriter.
+    PairWriter(const FirstWriter& _first_writer = FirstWriter(), 
+	       const SecondWriter& _second_writer = SecondWriter()) 
+      : first_writer(_first_writer), second_writer(_second_writer) {}
+    
+    /// \brief Writes the pair from the given stream.
+    ///
+    /// Writes the pair from the given stream.
+    void write(std::ostream& os, const Value& value) const {
+      os << "( ";
+      first_writer.write(os, value.first);
+      os << " => ";
+      second_writer.write(os, value.second);
+      os << " )";
+    }
+
+  };
+
+  /// \ingroup item_io
   /// 
   /// \brief The default item writer template class.
@@ -218,4 +268,12 @@
     : public QuotedCharArrayWriter {};
 
+  template <>
+  class DefaultWriter<char*> 
+    : public QuotedCharArrayWriter {};
+
+  template <>
+  class DefaultWriter<const char*> 
+    : public QuotedCharArrayWriter {};
+
   template <typename Item>
   class DefaultWriter<std::vector<Item> > 
@@ -234,7 +292,19 @@
     : public IterableWriter<std::set<Item> > {};
 
+  template <typename Key, typename Value>
+  class DefaultWriter<std::map<Key, Value> > 
+    : public IterableWriter<std::map<Key, Value> > {};
+
   template <typename Item>
   class DefaultWriter<std::multiset<Item> > 
     : public IterableWriter<std::multiset<Item> > {};
+
+  template <typename Key, typename Value>
+  class DefaultWriter<std::multimap<Key, Value> > 
+    : public IterableWriter<std::multimap<Key, Value> > {};
+
+  template <typename First, typename Second>
+  class DefaultWriter<std::pair<First, Second> > 
+    : public PairWriter<std::pair<First, Second> > {};
 
   /// \ingroup item_io
Index: lemon/lemon_writer.h
===================================================================
--- lemon/lemon_writer.h	(revision 1845)
+++ lemon/lemon_writer.h	(revision 1852)
@@ -173,5 +173,5 @@
       virtual ~MapWriterBase() {}
 
-      virtual void write(std::ostream& os, const Item& item) = 0;
+      virtual void write(std::ostream& os, const Item& item) const = 0;
     };
 
@@ -193,5 +193,5 @@
       virtual ~MapWriter() {}
 
-      virtual void write(std::ostream& os, const Item& item) {
+      virtual void write(std::ostream& os, const Item& item) const {
 	Value value = map[item];
 	writer.write(os, value);
