lemon/dim2.h
changeset 2217 4a10a45d55f6
parent 2214 a886e48e0d91
child 2391 14a343be7a5a
     1.1 --- a/lemon/dim2.h	Thu Sep 14 19:11:24 2006 +0000
     1.2 +++ b/lemon/dim2.h	Thu Sep 14 19:58:29 2006 +0000
     1.3 @@ -73,13 +73,22 @@
     1.4        ///Construct an instance from coordinates
     1.5        Point(T a, T b) : x(a), y(b) { }
     1.6  
     1.7 -      ///Size of vector
     1.8 +      ///The dimension of the vector.
     1.9 +
    1.10 +      ///This class give back always 2.
    1.11 +      ///
    1.12        int size() const { return 2; }
    1.13  
    1.14        ///Subscripting operator
    1.15 +
    1.16 +      ///\c p[0] is \c p.x and \c p[1] is \c p.y
    1.17 +      ///
    1.18        T& operator[](int idx) { return idx == 0 ? x : y; }
    1.19  
    1.20        ///Const subscripting operator
    1.21 +
    1.22 +      ///\c p[0] is \c p.x and \c p[1] is \c p.y
    1.23 +      ///
    1.24        const T& operator[](int idx) const { return idx == 0 ? x : y; }
    1.25  
    1.26        ///Conversion constructor