COIN-OR::LEMON - Graph Library

Changeset 1418:afaa773d0ad0 in lemon-0.x


Ignore:
Timestamp:
05/14/05 19:32:11 (19 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1888
Message:

Handling smarter the references
It's used by the lemon IO and proposed by the adaptors.

Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/utility.h

    r1359 r1418  
    108108  struct lazy_disable_if : public lazy_disable_if_c<Cond::value, T> {};
    109109
     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
    110151} // namespace lemon
    111152
Note: See TracChangeset for help on using the changeset viewer.