lemon/dim2.h
changeset 2212 0ad3835449f8
parent 2207 75a29ac69c19
child 2214 a886e48e0d91
equal deleted inserted replaced
0:53d7cf520ace 1:bd56f7c8d731
    71       Point() {}
    71       Point() {}
    72 
    72 
    73       ///Construct an instance from coordinates
    73       ///Construct an instance from coordinates
    74       Point(T a, T b) : x(a), y(b) { }
    74       Point(T a, T b) : x(a), y(b) { }
    75 
    75 
       
    76       ///Size of vector
       
    77       int size() const { return 2; }
       
    78 
       
    79       ///Subscripting operator
       
    80       T& operator[](int idx) { return idx == 0 ? x : y; }
       
    81 
       
    82       ///Const subscripting operator
       
    83       const T& operator[](int idx) const { return idx == 0 ? x : y; }
    76 
    84 
    77       ///Conversion constructor
    85       ///Conversion constructor
    78       template<class TT> Point(const Point<TT> &p) : x(p.x), y(p.y) {}
    86       template<class TT> Point(const Point<TT> &p) : x(p.x), y(p.y) {}
    79 
    87 
    80       ///Give back the square of the norm of the vector
    88       ///Give back the square of the norm of the vector
   161   ///Return an Point 
   169   ///Return an Point 
   162 
   170 
   163   ///Return an Point
   171   ///Return an Point
   164   ///\relates Point
   172   ///\relates Point
   165   template <typename T>
   173   template <typename T>
   166   inline Point<T> make_Point(const T& x, const T& y) {
   174   inline Point<T> makePoint(const T& x, const T& y) {
   167     return Point<T>(x, y);
   175     return Point<T>(x, y);
   168   }
   176   }
   169 
   177 
   170   ///Return a vector multiplied by a scalar
   178   ///Return a vector multiplied by a scalar
   171 
   179