COIN-OR::LEMON - Graph Library

Changeset 1257:7101e2c3a881 in lemon-0.x


Ignore:
Timestamp:
03/25/05 09:21:43 (15 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1684
Message:
  • several missing 'const' added
  • value of xy is undefined by default
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/xy.h

    r1202 r1257  
    3939  /// @{
    4040
    41   /// A two dimensional vector (plainvector) implementation
    42 
    43   /// A two dimensional vector (plainvector) implementation
     41  /// A simple two dimensional vector (plainvector) implementation
     42
     43  /// A simple two dimensional vector (plainvector) implementation
    4444  ///with the usual vector
    4545  /// operators.
     
    5555      T x,y;     
    5656     
    57       ///Default constructor: both coordinates become 0
    58       xy() : x(0), y(0) {}
     57      ///Default constructor
     58      xy() {}
    5959
    6060      ///Constructing the instance from coordinates
     
    6666
    6767      ///Gives back the square of the norm of the vector
    68       T normSquare(){
     68      T normSquare() const {
    6969        return x*x+y*y;
    7070      };
    7171 
    7272      ///Increments the left hand side by u
    73       xy<T>& operator +=(const xy<T>& u){
     73      xy<T>& operator +=(const xy<T>& u) {
    7474        x += u.x;
    7575        y += u.y;
     
    7878 
    7979      ///Decrements the left hand side by u
    80       xy<T>& operator -=(const xy<T>& u){
     80      xy<T>& operator -=(const xy<T>& u) {
    8181        x -= u.x;
    8282        y -= u.y;
     
    8585
    8686      ///Multiplying the left hand side with a scalar
    87       xy<T>& operator *=(const T &u){
     87      xy<T>& operator *=(const T &u) {
    8888        x *= u;
    8989        y *= u;
     
    9292
    9393      ///Dividing the left hand side by a scalar
    94       xy<T>& operator /=(const T &u){
     94      xy<T>& operator /=(const T &u) {
    9595        x /= u;
    9696        y /= u;
     
    9999 
    100100      ///Returns the scalar product of two vectors
    101       T operator *(const xy<T>& u){
     101      T operator *(const xy<T>& u) const {
    102102        return x*u.x+y*u.y;
    103103      };
     
    135135
    136136      ///Testing equality
    137       bool operator==(const xy<T> &u){
     137      bool operator==(const xy<T> &u) const {
    138138        return (x==u.x) && (y==u.y);
    139139      };
    140140
    141141      ///Testing inequality
    142       bool operator!=(xy u){
     142      bool operator!=(xy u) const {
    143143        return  (x!=u.x) || (y!=u.y);
    144144      };
Note: See TracChangeset for help on using the changeset viewer.