src/lemon/utility.h
changeset 1418 afaa773d0ad0
parent 1359 1581f961cfaa
equal deleted inserted replaced
4:b405061aca29 5:2b14fef6b398
   105   struct lazy_disable_if_c<true, T> {};
   105   struct lazy_disable_if_c<true, T> {};
   106 
   106 
   107   template <class Cond, class T> 
   107   template <class Cond, class T> 
   108   struct lazy_disable_if : public lazy_disable_if_c<Cond::value, T> {};
   108   struct lazy_disable_if : public lazy_disable_if_c<Cond::value, T> {};
   109 
   109 
       
   110   // smart referencing
       
   111 
       
   112   template <typename _Type, typename Enable = void>
       
   113   struct SmartReference {
       
   114     typedef _Type& Type;
       
   115   };
       
   116   
       
   117   template <typename _Type>
       
   118   struct SmartReference<
       
   119     _Type, 
       
   120     typename enable_if<typename _Type::NeedCopy, void>::type
       
   121   > {
       
   122     typedef _Type Type;
       
   123   };
       
   124 
       
   125   template <typename _Type, typename Enable = void>
       
   126   struct SmartConstReference {
       
   127     typedef const _Type& Type;
       
   128   };
       
   129   
       
   130   template <typename _Type>
       
   131   struct SmartConstReference<
       
   132     _Type, 
       
   133     typename enable_if<typename _Type::NeedCopy, void>::type
       
   134   > {
       
   135     typedef const _Type Type;
       
   136   };
       
   137 
       
   138   template <typename _Type, typename Enable = void>
       
   139   struct SmartParameter {
       
   140     typedef _Type& Type;
       
   141   };
       
   142   
       
   143   template <typename _Type>
       
   144   struct SmartParameter<
       
   145     _Type, 
       
   146     typename enable_if<typename _Type::NeedCopy, void>::type
       
   147   > {
       
   148     typedef const _Type& Type;
       
   149   };
       
   150 
   110 } // namespace lemon
   151 } // namespace lemon
   111 
   152 
   112 #endif
   153 #endif