src/hugo/maps.h
changeset 893 89d5c283a485
parent 805 59b8cb2cb2f8
child 906 17f31d280385
equal deleted inserted replaced
2:d6f77c02ff73 3:e32596ad4f25
    74 
    74 
    75     template<typename T1>
    75     template<typename T1>
    76     ConstMap(const ConstMap<K,T1> &, const T &_v) : v(_v) {}
    76     ConstMap(const ConstMap<K,T1> &, const T &_v) : v(_v) {}
    77   };
    77   };
    78 
    78 
    79 
    79   //to document later
       
    80   template<typename T, T v>
       
    81   struct Const { };
       
    82   //to document later
       
    83   template<typename K, typename V, V v>
       
    84   class ConstMap<K, Const<V, v> > : public MapBase<K, V>
       
    85   {
       
    86   public:
       
    87     ConstMap() { }
       
    88     V operator[](const K&) const { return v; }
       
    89     void set(const K&, const V&) { }
       
    90   };
       
    91   //to document later
       
    92   typedef Const<bool, true> True;
       
    93   typedef Const<bool, false> False;
    80 
    94 
    81   /// \c std::map wrapper
    95   /// \c std::map wrapper
    82 
    96 
    83   /// This is essentially a wrapper for \c std::map. With addition that
    97   /// This is essentially a wrapper for \c std::map. With addition that
    84   /// you can specify a default value different from \c ValueType() .
    98   /// you can specify a default value different from \c ValueType() .