Create a range proctor to manage an array of objects at the specified origin. Optionally specify length to define its range, which by default is empty (i.e., length = 0). The sequence of objects may extend in either direction from origin. A positive length represents the sequence of objects starting at origin and extending "up" to length (not including the object at the index position origin + length). A negative length represents the sequence of objects starting at one position below origin and extending "down" to the absolute value of length (including the object at index position origin + length). If length is 0, then this range proctor manages no objects. The behavior is undefined unless both origin and length are zero, or origin is non-zero and all objects (if any) within the managed range (as defined by length) are valid. Note that when length is non-positive, the object at the origin is not managed by this range proctor. For example, if origin is at the index position 2, a length of 2 signifies that the objects at positions 2 and 3 are managed, whereas a length of -2 signifies that the objects at positions 0 and 1 are managed: ` length = -2 length = 2 |<----->| |<----->| ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ | 0 | 1 | 2 | 3 | 4 | | 0 | 1 | 2 | 3 | 4 | =^=====^=' =^=====^=' ^------------ origin ^------------ origin `
Declared in <bslma_autodestructor.h>
explicit
AutoDestructor(
TYPE* origin,
int length = 0);