Changeset 303 for trunk/lib/utility.h


Ignore:
Timestamp:
May 11, 2007, 10:13:00 PM (14 years ago)
Author:
Peter Johansson
Message:

Sorting authors in copyright statement in same order as stated in config file. fixes #172

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/utility.h

    r297 r303  
    222222              (!(y.second<x.second) && (x.first<y.first)));
    223223    }
     224  };
     225
     226  template <class T1,class T2, class T3>
     227  struct PairSecondCompare
     228  {
     229
     230    ///
     231    /// @brief Constructor
     232    ///
     233    explicit PairSecondCompare(const T3& comp)
     234      : compare_(comp) {}
     235
     236    ///
     237    /// @return true if x.second<y.second or (x.second==y.second and
     238    /// x.first<y.first)
     239    ///
     240    inline bool operator()(const std::pair<T1,T2>& x,
     241                           const std::pair<T1,T2>& y) const
     242    { return compare_(x.second,y.second); }
     243
     244  private:
     245    T3 compare_;
     246
    224247  };
    225248
Note: See TracChangeset for help on using the changeset viewer.