Boost logo

Boost Users :

From: Kresimir Fresl (fresl_at_[hidden])
Date: 2003-06-10 01:20:49


cerenoc wrote:

> 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.

No. First argument defines the starting point, but the second
defines `one past the end', similar to iterator ranges: [begin, end).
For example:

   range (0, 1) => 0
   range (0, 3) => 0 1 2
   range (1, 3) => 1 2
   range (2, 3) => 2
   range (3, 3) => empty
   range (4, 3) => assertation error

[On the other hand, when defining a slice, length is given by the
third argument (first is starting point, second is step (or stride)); e.g.:

   slice (0, 1, 3) => 0 1 2
   slice (1, 1, 3) => 1 2 3
   slice (1, 2, 3) => 1 3 5
]

Regards,

fres


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