lemon/utility.h
changeset 1796 b6a58c8bea87
parent 1696 4e03a355d2ea
child 1875 98698b69a902
equal deleted inserted replaced
3:1851abf55dc0 4:f03e43a6be56
   137   struct lazy_disable_if_c<true, T> {};
   137   struct lazy_disable_if_c<true, T> {};
   138 
   138 
   139   template <class Cond, class T> 
   139   template <class Cond, class T> 
   140   struct lazy_disable_if : public lazy_disable_if_c<Cond::value, T> {};
   140   struct lazy_disable_if : public lazy_disable_if_c<Cond::value, T> {};
   141 
   141 
   142   // smart referencing
       
   143 
       
   144   template <typename _Type, typename Enable = void>
       
   145   struct SmartReference {
       
   146     typedef _Type& Type;
       
   147   };
       
   148   
       
   149   template <typename _Type>
       
   150   struct SmartReference<
       
   151     _Type, 
       
   152     typename enable_if<typename _Type::NeedCopy, void>::type
       
   153   > {
       
   154     typedef _Type Type;
       
   155   };
       
   156 
       
   157   template <typename _Type, typename Enable = void>
       
   158   struct SmartConstReference {
       
   159     typedef const _Type& Type;
       
   160   };
       
   161   
       
   162   template <typename _Type>
       
   163   struct SmartConstReference<
       
   164     _Type, 
       
   165     typename enable_if<typename _Type::NeedCopy, void>::type
       
   166   > {
       
   167     typedef const _Type Type;
       
   168   };
       
   169 
       
   170   template <typename _Type, typename Enable = void>
       
   171   struct SmartParameter {
       
   172     typedef _Type& Type;
       
   173   };
       
   174   
       
   175   template <typename _Type>
       
   176   struct SmartParameter<
       
   177     _Type, 
       
   178     typename enable_if<typename _Type::NeedCopy, void>::type
       
   179   > {
       
   180     typedef const _Type& Type;
       
   181   };
       
   182 
       
   183 } // namespace lemon
   142 } // namespace lemon
   184 
   143 
   185 #endif
   144 #endif