# HG changeset patch # User alpar # Date 1090431482 0 # Node ID 193d881b23ad55ca9e423ad82cbe159b438565bd # Parent cb9efd4cc9db520c42dfa2131a450e7ae4eb1a6c MapBase added diff -r cb9efd4cc9db -r 193d881b23ad src/hugo/maps.h --- a/src/hugo/maps.h Wed Jul 21 13:03:11 2004 +0000 +++ b/src/hugo/maps.h Wed Jul 21 17:38:02 2004 +0000 @@ -12,17 +12,27 @@ namespace hugo { + /// Base class of maps. + + template + class MapBase + { + public: + /// + typedef K KeyType; + /// + typedef T ValueType; + }; + /// Null map. (aka DoNothingMap) /// If you have to provide a map only for its type definitions, /// or if you have to provide a writable map, but will not use the /// data written to it... template - class NullMap + class NullMap : public MapBase { public: - typedef K KeyType; - typedef T ValueType; T operator[](const K&) const { return T(); } void set(const K&, const T&) {} @@ -37,12 +47,10 @@ /// This is a readable map which assignes a specified value to each key. /// In other aspects it is equivalent to the \ref NullMap template - class ConstMap + class ConstMap : public MapBase { T v; public: - typedef K KeyType; - typedef T ValueType; ConstMap() {} ConstMap(const T &_v) : v(_v) {}