Boost logo

Boost Users :

From: cerenoc (julm_at_[hidden])
Date: 2003-06-09 23:17:02


Hello,
I just wanted to clarify if the following behavior is correct. As
far as I understood, in matrix and vector range function, the 1st
argument defines the starting point and the second defines the length
of the range. The following code I ran on gcc 2.96 shows that the
behavior is different when starting at 0 and starting somewhere
else. Is this a bug, or am I misunderstanding something?

Thank you,
Julian

    // define some vector r(3)
    std::cout << r << "\n\n";
    boost::numeric::ublas::vector<double> rr = r(range(0, 0));
    std::cout << rr << "\n\n";
    rr = r(range(0, 1));
    std::cout << rr << "\n\n";
    rr = r(range(0, 2));
    std::cout << rr << "\n\n";
    rr = r(range(0, 3));
    std::cout << rr << "\n\n";
    //rr = r(range(1, 0)); // THIS RESULTS IN ASSERTION ERROR
    //std::cout << rr << "\n\n";
    rr = r(range(1, 1));
    std::cout << rr << "\n\n";
    rr = r(range(1, 2));
    std::cout << rr << "\n\n";
    rr = r(range(1, 3));
    std::cout << rr << "\n\n";

OUTPUT:
[3](0,1,2)

[0]()

[1](0)

[2](0,1)

[3](0,1,2)

[0]()

[1](1)

[2](1,2)


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net