Changeset 1734


Ignore:
Timestamp:
Jan 16, 2009, 8:20:57 PM (12 years ago)
Author:
Peter
Message:

Added some docs. Also modified the comparison operators to return what
the corresponding double operator returns for data(). This was always
true before when the comparisons included NaN.

Location:
trunk/yat/utility
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/utility/DataWeight.cc

    r1534 r1734  
    22
    33/*
    4   Copyright (C) 2008 Peter Johansson
     4  Copyright (C) 2008, 2009 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    6161  bool operator!=(const DataWeight& lhs, const DataWeight& rhs)
    6262  {
    63     return ! (lhs == rhs);
     63    return lhs.data() != rhs.data();
    6464  }
    6565
     
    7373  bool operator>(const DataWeight& lhs, const DataWeight& rhs)
    7474  {
    75     return rhs < lhs;
     75    return lhs.data() > rhs.data();
    7676  }
    7777
     
    7979  bool operator<=(const DataWeight& lhs, const DataWeight& rhs)
    8080  {
    81     return !(lhs > rhs);
     81    return lhs.data() <= rhs.data();
    8282  }
    8383
     
    8585  bool operator>=(const DataWeight& lhs, const DataWeight& rhs)
    8686  {
    87     return !(lhs < rhs);
     87    return lhs.data() >= rhs.data();
    8888  }
    8989
  • trunk/yat/utility/DataWeight.h

    r1533 r1734  
    55
    66/*
    7   Copyright (C) 2008 Peter Johansson
     7  Copyright (C) 2008, 2009 Peter Johansson
    88
    99  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2929  /**
    3030     \brief Holds a pair of data and associated weight
     31
     32     The class has comparison operators (declared outside class) that
     33     are designed to ignore the weights, and behaves like the
     34     corresponding double operator behaves for data().
    3135
    3236     \since New in yat 0.5
     
    7377     \brief equality operator
    7478
    75      \return true if data are equal
     79     \return true if lhs.data() == rhs.data()
    7680   */
    77   bool operator==(const DataWeight&, const DataWeight&);
     81  bool operator==(const DataWeight& lhs, const DataWeight& rhs);
    7882
    7983  /**
    8084     \brief inequality operator
    8185
    82      \return true if data are inequal
     86     \return true if lhs.data() != rhs.data()
    8387   */
    8488  bool operator!=(const DataWeight&, const DataWeight&);
     
    101105     \brief comparison operator
    102106
    103      \return true if  rhs > lhs
     107     \return true if lhs.data() <= rhs.data()
    104108   */
    105109  bool operator<=(const DataWeight&, const DataWeight&);
     
    108112     \brief comparison operator
    109113
    110      \return true if  rhs < lhs
     114     \return true if lhs.data() >= rhs.data()
    111115   */
    112116  bool operator>=(const DataWeight&, const DataWeight&);
Note: See TracChangeset for help on using the changeset viewer.