lemon/dim2.h
changeset 2268 ad15bdd334bf
parent 2214 a886e48e0d91
child 2391 14a343be7a5a
equal deleted inserted replaced
2:4ae84514a51e 3:00c844b2b91e
    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
    76       ///The dimension of the vector.
       
    77 
       
    78       ///This class give back always 2.
       
    79       ///
    77       int size() const { return 2; }
    80       int size() const { return 2; }
    78 
    81 
    79       ///Subscripting operator
    82       ///Subscripting operator
       
    83 
       
    84       ///\c p[0] is \c p.x and \c p[1] is \c p.y
       
    85       ///
    80       T& operator[](int idx) { return idx == 0 ? x : y; }
    86       T& operator[](int idx) { return idx == 0 ? x : y; }
    81 
    87 
    82       ///Const subscripting operator
    88       ///Const subscripting operator
       
    89 
       
    90       ///\c p[0] is \c p.x and \c p[1] is \c p.y
       
    91       ///
    83       const T& operator[](int idx) const { return idx == 0 ? x : y; }
    92       const T& operator[](int idx) const { return idx == 0 ? x : y; }
    84 
    93 
    85       ///Conversion constructor
    94       ///Conversion constructor
    86       template<class TT> Point(const Point<TT> &p) : x(p.x), y(p.y) {}
    95       template<class TT> Point(const Point<TT> &p) : x(p.x), y(p.y) {}
    87 
    96