lemon/bits/default_map.h
changeset 2244 a28b4e0aa787
parent 2164 160ca7667159
child 2333 8070a099ffb6
equal deleted inserted replaced
20:4ac2a75444dd 21:cf2f6842d88e
    20 #define LEMON_BITS_DEFAULT_MAP_H
    20 #define LEMON_BITS_DEFAULT_MAP_H
    21 
    21 
    22 
    22 
    23 #include <lemon/bits/array_map.h>
    23 #include <lemon/bits/array_map.h>
    24 #include <lemon/bits/vector_map.h>
    24 #include <lemon/bits/vector_map.h>
       
    25 #include <lemon/bits/debug_map.h>
    25 
    26 
    26 ///\ingroup graphbits
    27 ///\ingroup graphbits
    27 ///\file
    28 ///\file
    28 ///\brief Graph maps that construct and destruct their elements dynamically.
    29 ///\brief Graph maps that construct and destruct their elements dynamically.
    29 
    30 
    34 
    35 
    35   template <typename _Graph, typename _Item, typename _Value>
    36   template <typename _Graph, typename _Item, typename _Value>
    36   struct DefaultMapSelector {
    37   struct DefaultMapSelector {
    37     typedef ArrayMap<_Graph, _Item, _Value> Map;
    38     typedef ArrayMap<_Graph, _Item, _Value> Map;
    38   };
    39   };
    39 
       
    40 #else
       
    41 
       
    42   template <typename _Graph, typename _Item, typename _Value>
       
    43   struct DefaultMapSelector {
       
    44     typedef VectorMap<_Graph, _Item, _Value> Map;
       
    45   };
       
    46 
       
    47 #endif
       
    48 
    40 
    49   // bool
    41   // bool
    50   template <typename _Graph, typename _Item>
    42   template <typename _Graph, typename _Item>
    51   struct DefaultMapSelector<_Graph, _Item, bool> {
    43   struct DefaultMapSelector<_Graph, _Item, bool> {
    52     typedef VectorMap<_Graph, _Item, bool> Map;
    44     typedef VectorMap<_Graph, _Item, bool> Map;
   146   template <typename _Graph, typename _Item, typename _Ptr>
   138   template <typename _Graph, typename _Item, typename _Ptr>
   147   struct DefaultMapSelector<_Graph, _Item, _Ptr*> {
   139   struct DefaultMapSelector<_Graph, _Item, _Ptr*> {
   148     typedef VectorMap<_Graph, _Item, _Ptr*> Map;
   140     typedef VectorMap<_Graph, _Item, _Ptr*> Map;
   149   };
   141   };
   150 
   142 
       
   143 #else 
       
   144 
       
   145   template <typename _Graph, typename _Item, typename _Value>
       
   146   struct DefaultMapSelector {
       
   147     typedef DebugMap<_Graph, _Item, _Value> Map;
       
   148   };
       
   149 
       
   150 #endif  
       
   151 
   151   /// \e
   152   /// \e
   152   template <typename _Graph, typename _Item, typename _Value>
   153   template <typename _Graph, typename _Item, typename _Value>
   153   class DefaultMap 
   154   class DefaultMap 
   154     : public DefaultMapSelector<_Graph, _Item, _Value>::Map {
   155     : public DefaultMapSelector<_Graph, _Item, _Value>::Map {
   155   public:
   156   public: